Fossil SCM

Fix parsing of the argument to the "Connection:" header of HTTP reply messages to deal with unusual arguments added by Apache mod_cgi. See [forum:/forumpost/ca6fc85c80f4704f|forum thread ca6fc85c80f4704f].

drh 2024-04-21 16:20 trunk merge
Commit 5f47bb59a7846aeb3e073ffe24629bb87809b86358c7124d9b4596817c3599d5
1 file changed +2 -5
+2 -5
--- src/http.c
+++ src/http.c
@@ -569,16 +569,13 @@
569569
closeConnection = 0;
570570
}else if( fossil_strnicmp(zLine, "content-length:", 15)==0 ){
571571
for(i=15; fossil_isspace(zLine[i]); i++){}
572572
iLength = atoi(&zLine[i]);
573573
}else if( fossil_strnicmp(zLine, "connection:", 11)==0 ){
574
- char c;
575
- for(i=11; fossil_isspace(zLine[i]); i++){}
576
- c = zLine[i];
577
- if( c=='c' || c=='C' ){
574
+ if( sqlite3_strlike("%close%", &zLine[11], 0)==0 ){
578575
closeConnection = 1;
579
- }else if( c=='k' || c=='K' ){
576
+ }else if( sqlite3_strlike("%keep-alive%", &zLine[11], 0)==0 ){
580577
closeConnection = 0;
581578
}
582579
}else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
583580
fossil_strnicmp(zLine, "location:", 9)==0 ){
584581
int i, j;
585582
--- src/http.c
+++ src/http.c
@@ -569,16 +569,13 @@
569 closeConnection = 0;
570 }else if( fossil_strnicmp(zLine, "content-length:", 15)==0 ){
571 for(i=15; fossil_isspace(zLine[i]); i++){}
572 iLength = atoi(&zLine[i]);
573 }else if( fossil_strnicmp(zLine, "connection:", 11)==0 ){
574 char c;
575 for(i=11; fossil_isspace(zLine[i]); i++){}
576 c = zLine[i];
577 if( c=='c' || c=='C' ){
578 closeConnection = 1;
579 }else if( c=='k' || c=='K' ){
580 closeConnection = 0;
581 }
582 }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
583 fossil_strnicmp(zLine, "location:", 9)==0 ){
584 int i, j;
585
--- src/http.c
+++ src/http.c
@@ -569,16 +569,13 @@
569 closeConnection = 0;
570 }else if( fossil_strnicmp(zLine, "content-length:", 15)==0 ){
571 for(i=15; fossil_isspace(zLine[i]); i++){}
572 iLength = atoi(&zLine[i]);
573 }else if( fossil_strnicmp(zLine, "connection:", 11)==0 ){
574 if( sqlite3_strlike("%close%", &zLine[11], 0)==0 ){
 
 
 
575 closeConnection = 1;
576 }else if( sqlite3_strlike("%keep-alive%", &zLine[11], 0)==0 ){
577 closeConnection = 0;
578 }
579 }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
580 fossil_strnicmp(zLine, "location:", 9)==0 ){
581 int i, j;
582

Keyboard Shortcuts

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