--------------------- PatchSet 1610 Date: 2005/08/25 22:09:00 Author: rousskov Branch: squid3-icap Tag: Z-squid3-icap_branchpoint **INVALID** Log: - Do not parse encapsulated HTTP response header if Encapsulated ICAP header does not list "res-hdr". - Polished encapsulated section presence test. Members: src/ICAPXaction.cc:1.1.2.11->1.1.2.12 src/ICAPXaction.h:1.1.2.6->1.1.2.7 Index: squid3/src/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.cc,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -r1.1.2.11 -r1.1.2.12 --- squid3/src/ICAPXaction.cc 25 Aug 2005 21:52:28 -0000 1.1.2.11 +++ squid3/src/ICAPXaction.cc 25 Aug 2005 22:09:00 -0000 1.1.2.12 @@ -363,8 +363,12 @@ if (state.parsing == State::psIcapHeader) parseHeader(icapReply); - if (state.parsing == State::psHttpHeader) - parseHeader(adapted->data->header); + if (state.parsing == State::psHttpHeader) { + if (gotEncapsulated("res-hdr")) + parseHeader(adapted->data->header); + else + state.parsing = State::psBody; + } if (state.parsingHeaders()) // need more data Must(!state.doneReading); @@ -393,8 +397,7 @@ debugs(93, 5, "have " << readBuf.contentSize() << " body bytes to parse"); - if (httpHeaderGetByNameListMember(&icapReply->header, "Encapsulated", - "res-body", ',').size() > 0) { + if (gotEncapsulated("res-body")) { if (!parsePresentBody()) return; } else { @@ -624,3 +627,8 @@ status.terminate(); return status.content(); } + +bool ICAPXaction::gotEncapsulated(const char *section) const { + return httpHeaderGetByNameListMember(&icapReply->header, "Encapsulated", + section, ',').size() > 0; +} Index: squid3/src/ICAPXaction.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.h,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- squid3/src/ICAPXaction.h 25 Aug 2005 21:52:28 -0000 1.1.2.6 +++ squid3/src/ICAPXaction.h 25 Aug 2005 22:09:00 -0000 1.1.2.7 @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.1.2.6 2005/08/25 21:52:28 rousskov Exp $ + * $Id: ICAPXaction.h,v 1.1.2.7 2005/08/25 22:09:00 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -109,6 +109,7 @@ private: // returns a temporary string depicting transaction status, for debugging const char *status() const; + bool gotEncapsulated(const char *section) const; Pointer self; MsgPipe *virgin;