Fossil SCM

For the CGI handler in the extension CGI mechanism, unrecognized header strings coming back from the CGI program are passed through unaltered to the HTTP reply. This allows the CGI program to set cookies.

drh 2020-12-12 15:25 trunk
Commit 1cff8d318232ecfcdd38e9cb5c779fe0b93fd7772e3a1732c9522091ce16cd30
1 file changed +3
--- src/extcgi.c
+++ src/extcgi.c
@@ -327,10 +327,13 @@
327327
}else if( fossil_strnicmp(zLine,"Content-Type:",13)==0 ){
328328
int j;
329329
for(i=13; fossil_isspace(zLine[i]); i++){}
330330
for(j=i; zLine[j] && zLine[j]!=';'; j++){}
331331
zMime = mprintf("%.*s", j-i, &zLine[i]);
332
+ }else{
333
+ cgi_append_header(zLine);
334
+ cgi_append_header("\r\n");
332335
}
333336
}
334337
}
335338
blob_read_from_channel(&reply, fromChild, nContent);
336339
zFailReason = 0; /* Indicate success */
337340
--- src/extcgi.c
+++ src/extcgi.c
@@ -327,10 +327,13 @@
327 }else if( fossil_strnicmp(zLine,"Content-Type:",13)==0 ){
328 int j;
329 for(i=13; fossil_isspace(zLine[i]); i++){}
330 for(j=i; zLine[j] && zLine[j]!=';'; j++){}
331 zMime = mprintf("%.*s", j-i, &zLine[i]);
 
 
 
332 }
333 }
334 }
335 blob_read_from_channel(&reply, fromChild, nContent);
336 zFailReason = 0; /* Indicate success */
337
--- src/extcgi.c
+++ src/extcgi.c
@@ -327,10 +327,13 @@
327 }else if( fossil_strnicmp(zLine,"Content-Type:",13)==0 ){
328 int j;
329 for(i=13; fossil_isspace(zLine[i]); i++){}
330 for(j=i; zLine[j] && zLine[j]!=';'; j++){}
331 zMime = mprintf("%.*s", j-i, &zLine[i]);
332 }else{
333 cgi_append_header(zLine);
334 cgi_append_header("\r\n");
335 }
336 }
337 }
338 blob_read_from_channel(&reply, fromChild, nContent);
339 zFailReason = 0; /* Indicate success */
340

Keyboard Shortcuts

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