--------------------- PatchSet 1579 Date: 2005/08/24 06:09:57 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Accept protocol prefix when parsing status lines. - TODO: There seems to be an inconsistency with regard to protocol case compared to processReplyHeader() code (now in HttpReply::parse). We should either demand strict case match everywhere or allow any case everywhere. Members: src/HttpStatusLine.cc:1.3->1.3.12.1 src/HttpStatusLine.h:1.1->1.1.16.1 Index: squid3/src/HttpStatusLine.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpStatusLine.cc,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -u -r1.3 -r1.3.12.1 --- squid3/src/HttpStatusLine.cc 2 Sep 2003 02:12:39 -0000 1.3 +++ squid3/src/HttpStatusLine.cc 24 Aug 2005 06:09:57 -0000 1.3.12.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.cc,v 1.3 2003/09/02 02:12:39 squidadm Exp $ + * $Id: HttpStatusLine.cc,v 1.3.12.1 2005/08/24 06:09:57 rousskov Exp $ * * DEBUG: section 57 HTTP Status-line * AUTHOR: Alex Rousskov @@ -79,15 +79,17 @@ /* pack fields using Packer */ int -httpStatusLineParse(HttpStatusLine * sline, const char *start, const char *end) +httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, const char *start, const char *end) { assert(sline); sline->status = HTTP_INVALID_HEADER; /* Squid header parsing error */ - if (strncasecmp(start, "HTTP/", 5)) + // XXX: HttpReply::parse() has a similar check but is using + // casesensitive comparison (which is required by HTTP errata?) + if (protoPrefix.caseCmp(start, protoPrefix.size()) != 0) return 0; - start += 5; + start += protoPrefix.size(); if (!xisdigit(*start)) return 0; Index: squid3/src/HttpStatusLine.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpStatusLine.h,v retrieving revision 1.1 retrieving revision 1.1.16.1 diff -u -r1.1 -r1.1.16.1 --- squid3/src/HttpStatusLine.h 2 Sep 2003 02:12:39 -0000 1.1 +++ squid3/src/HttpStatusLine.h 24 Aug 2005 06:09:57 -0000 1.1.16.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.h,v 1.1 2003/09/02 02:12:39 squidadm Exp $ + * $Id: HttpStatusLine.h,v 1.1.16.1 2005/08/24 06:09:57 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -56,8 +56,8 @@ SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline); /* parse/pack */ /* parse a 0-terminating buffer and fill internal structires; returns true on success */ -SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const char *start, - const char *end); +SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, + const char *start, const char *end); /* pack fields using Packer */ SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p);