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].
Commit
5f47bb59a7846aeb3e073ffe24629bb87809b86358c7124d9b4596817c3599d5
Parent
133e6e59b97d118…
1 file changed
+2
-5
+2
-5
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -569,16 +569,13 @@ | ||
| 569 | 569 | closeConnection = 0; |
| 570 | 570 | }else if( fossil_strnicmp(zLine, "content-length:", 15)==0 ){ |
| 571 | 571 | for(i=15; fossil_isspace(zLine[i]); i++){} |
| 572 | 572 | iLength = atoi(&zLine[i]); |
| 573 | 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' ){ | |
| 574 | + if( sqlite3_strlike("%close%", &zLine[11], 0)==0 ){ | |
| 578 | 575 | closeConnection = 1; |
| 579 | - }else if( c=='k' || c=='K' ){ | |
| 576 | + }else if( sqlite3_strlike("%keep-alive%", &zLine[11], 0)==0 ){ | |
| 580 | 577 | closeConnection = 0; |
| 581 | 578 | } |
| 582 | 579 | }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && |
| 583 | 580 | fossil_strnicmp(zLine, "location:", 9)==0 ){ |
| 584 | 581 | int i, j; |
| 585 | 582 |
| --- 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 |