--------------------- PatchSet 1609 Date: 2005/08/25 21:52:28 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Do not parse response body if there is not one according to the Encapsulated header. Members: src/ICAPXaction.cc:1.1.2.10->1.1.2.11 src/ICAPXaction.h:1.1.2.5->1.1.2.6 Index: squid3/src/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.cc,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/ICAPXaction.cc 25 Aug 2005 21:13:11 -0000 1.1.2.10 +++ squid3/src/ICAPXaction.cc 25 Aug 2005 21:52:28 -0000 1.1.2.11 @@ -393,6 +393,23 @@ debugs(93, 5, "have " << readBuf.contentSize() << " body bytes to parse"); + if (httpHeaderGetByNameListMember(&icapReply->header, "Encapsulated", + "res-body", ',').size() > 0) { + if (!parsePresentBody()) + return; + } else { + debugs(93, 5, "not expecting a body"); + } + + stopReading(); + state.parsing = State::psDone; + state.doneSending = true; + adapted->sendSourceFinish(); + delete bodyParser; + bodyParser = 0; +} + +bool ICAPXaction::parsePresentBody() { if (!bodyParser) bodyParser = new ChunkedCodingParser; @@ -406,15 +423,10 @@ if (!parsed) { // needs more data Must(!state.doneReading); // will get more Must(readBuf.hasSpace()); // have place for more - return; + return false; } - stopReading(); - state.parsing = State::psDone; - state.doneSending = true; - adapted->sendSourceFinish(); - delete bodyParser; - bodyParser = 0; + return true; } // HTTP side added virgin body data Index: squid3/src/ICAPXaction.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid3/src/ICAPXaction.h 25 Aug 2005 21:13:11 -0000 1.1.2.5 +++ squid3/src/ICAPXaction.h 25 Aug 2005 21:52:28 -0000 1.1.2.6 @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.1.2.5 2005/08/25 21:13:11 rousskov Exp $ + * $Id: ICAPXaction.h,v 1.1.2.6 2005/08/25 21:52:28 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -90,6 +90,7 @@ void parseHeaders(); void parseHeader(HttpReply *header); void parseBody(); + bool parsePresentBody(); void pickService();