]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
henrik patch to handle multiline headers
authorwessels <>
Wed, 5 May 1999 01:43:17 +0000 (01:43 +0000)
committerwessels <>
Wed, 5 May 1999 01:43:17 +0000 (01:43 +0000)
src/HttpHeader.cc

index 20c41f68cf977c84498105ed6092f01a08f1ecb1..832fbc9027f13db247a3b4975b96782ea62c2e57 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHeader.cc,v 1.62 1999/04/15 06:15:40 wessels Exp $
+ * $Id: HttpHeader.cc,v 1.63 1999/05/04 19:43:17 wessels Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -383,9 +383,22 @@ httpHeaderParse(HttpHeader * hdr, const char *header_start, const char *header_e
     HttpHeaderStats[hdr->owner].parsedCount++;
     /* commonn format headers are "<name>:[ws]<value>" lines delimited by <CRLF> */
     while (field_start < header_end) {
-       const char *field_end = field_start + strcspn(field_start, "\r\n");
+       const char *field_end = field_start;
+       do {
+           field_end = field_end + strcspn(field_end, "\r\n");
+           /* skip CRLF */
+           if (*field_end == '\r')
+               field_end++;
+           if (*field_end == '\n')
+               field_end++;
+       } while (*field_end == ' ' || *field_end == '\t');
        if (!*field_end || field_end > header_end)
            return httpHeaderReset(hdr);        /* missing <CRLF> */
+       /* back up over CRLF */
+       if (field_end > field_start && field_end[-1] == '\n')
+           field_end--;
+       if (field_end > field_start && field_end[-1] == '\r')
+           field_end--;
        e = httpHeaderEntryParseCreate(field_start, field_end);
        if (e != NULL)
            httpHeaderAddEntry(hdr, e);