From 5525e95af09748e937b1b92870caca4a31486bf1 Mon Sep 17 00:00:00 2001 From: cperciva Date: Wed, 13 Feb 2008 20:46:23 +0000 Subject: 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 --- usr.sbin/portsnap/phttpget/phttpget.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'usr.sbin/portsnap/phttpget') diff --git a/usr.sbin/portsnap/phttpget/phttpget.c b/usr.sbin/portsnap/phttpget/phttpget.c index ffd14c3..e109124 100644 --- a/usr.sbin/portsnap/phttpget/phttpget.c +++ b/usr.sbin/portsnap/phttpget/phttpget.c @@ -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... */ -- cgit v1.1