1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

Improve conformance to the HTTP specification by using case-insensitive

comparisons for header keywords.  Apparently some proxies use creative
capitalization.

Weird proxy found by:	brooks
MFC after:		3 days
This commit is contained in:
Colin Percival 2008-02-13 20:46:23 +00:00
parent 84887fa362
commit e81875ba53
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176250

View File

@ -503,11 +503,11 @@ main(int argc, char *argv[])
* Check for "Connection: close" or
* "Connection: Keep-Alive" header
*/
if (strncmp(hln, "Connection:", 11) == 0) {
if (strncasecmp(hln, "Connection:", 11) == 0) {
hln += 11;
if (strstr(hln, "close") != NULL)
if (strcasestr(hln, "close") != NULL)
pipelined = 0;
if (strstr(hln, "Keep-Alive") != NULL)
if (strcasestr(hln, "Keep-Alive") != NULL)
keepalive = 1;
/* Next header... */
@ -515,7 +515,7 @@ main(int argc, char *argv[])
}
/* Check for "Content-Length:" header */
if (strncmp(hln, "Content-Length:", 15) == 0) {
if (strncasecmp(hln, "Content-Length:", 15) == 0) {
hln += 15;
contentlength = 0;
@ -539,9 +539,9 @@ main(int argc, char *argv[])
}
/* Check for "Transfer-Encoding: chunked" header */
if (strncmp(hln, "Transfer-Encoding:", 18) == 0) {
if (strncasecmp(hln, "Transfer-Encoding:", 18) == 0) {
hln += 18;
if (strstr(hln, "chunked") != NULL)
if (strcasestr(hln, "chunked") != NULL)
chunked = 1;
/* Next header... */