From: wessels <> Date: Wed, 5 May 1999 01:43:17 +0000 (+0000) Subject: henrik patch to handle multiline headers X-Git-Tag: SQUID_3_0_PRE1~2222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e70b9d13b967b9e8c21c786d7b52f3ee2bcb3e60;p=thirdparty%2Fsquid.git henrik patch to handle multiline headers --- diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 20c41f68cf..832fbc9027 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -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 ":[ws]" lines delimited by */ 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 */ + /* 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);