Fossil SCM

A valid /chat-ping request should set the Access-Control-Allow-Origin in the reply header, to avoid client-side errors.

drh 2020-12-24 19:28 trunk
Commit ffb40fd8940c59a72fd68a0737f32d0c621307422d85b99fc9466a686256f17b
1 file changed +4 -1
+4 -1
--- src/chat.c
+++ src/chat.c
@@ -587,11 +587,14 @@
587587
** a single \007 (bel) character to be written on the controlling TTY.
588588
** This is used to implement an audiable alert by local web clients.
589589
*/
590590
void chat_ping_webpage(void){
591591
const char *zIpAddr = PD("REMOTE_ADDR","nil");
592
- if( cgi_is_loopback(zIpAddr) ) fputc(7, stderr);
592
+ if( cgi_is_loopback(zIpAddr) ){
593
+ cgi_append_header("Access-Control-Allow-Origin: *\r\n");
594
+ fputc(7, stderr);
595
+ }
593596
}
594597
595598
/*
596599
** COMMAND: chat
597600
**
598601
--- src/chat.c
+++ src/chat.c
@@ -587,11 +587,14 @@
587 ** a single \007 (bel) character to be written on the controlling TTY.
588 ** This is used to implement an audiable alert by local web clients.
589 */
590 void chat_ping_webpage(void){
591 const char *zIpAddr = PD("REMOTE_ADDR","nil");
592 if( cgi_is_loopback(zIpAddr) ) fputc(7, stderr);
 
 
 
593 }
594
595 /*
596 ** COMMAND: chat
597 **
598
--- src/chat.c
+++ src/chat.c
@@ -587,11 +587,14 @@
587 ** a single \007 (bel) character to be written on the controlling TTY.
588 ** This is used to implement an audiable alert by local web clients.
589 */
590 void chat_ping_webpage(void){
591 const char *zIpAddr = PD("REMOTE_ADDR","nil");
592 if( cgi_is_loopback(zIpAddr) ){
593 cgi_append_header("Access-Control-Allow-Origin: *\r\n");
594 fputc(7, stderr);
595 }
596 }
597
598 /*
599 ** COMMAND: chat
600 **
601

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button