From: wessels <> Date: Wed, 11 Jan 2006 00:22:06 +0000 (+0000) Subject: ICAPClientRespmodPrecache::noteSourceStart() should know whether X-Git-Tag: SQUID_3_0_PRE4~374 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=247a7acf085f381742b13526882986ccffabf321;p=thirdparty%2Fsquid.git ICAPClientRespmodPrecache::noteSourceStart() should know whether or not to expect an HTTP body and call the appropriate next note function. --- diff --git a/src/ICAP/ICAPClientRespmodPrecache.cc b/src/ICAP/ICAPClientRespmodPrecache.cc index 50e2ffac96..f3d8518339 100644 --- a/src/ICAP/ICAPClientRespmodPrecache.cc +++ b/src/ICAP/ICAPClientRespmodPrecache.cc @@ -127,6 +127,10 @@ void ICAPClientRespmodPrecache::noteSourceStart(MsgPipe *p) { debug(93,5)("ICAPClientRespmodPrecache::noteSourceStart() called\n"); + /* + * May want to assert that adapted != NULL here + */ + HttpReply *reply = dynamic_cast(adapted->data->header); /* * The ICAP reply MUST have a new HTTP reply header, or else @@ -134,12 +138,28 @@ void ICAPClientRespmodPrecache::noteSourceStart(MsgPipe *p) * be handled prior to this point. */ assert(reply); // check that ICAP xaction created the right object - httpState->takeAdaptedHeaders(reply); - assert(reply == adapted->data->header); + + /* + * Examine the HTTP reply headers to find out if there is an associated + * body. We should probably check the ICAP Encapsulated header values + * as well. + */ + ssize_t dummy; + bool expect_body = reply->expectingBody(virgin->data->cause->method, dummy); + + /* + * When we call takeAdaptedHeaders() we give up any control over + * adapted->data->header + */ + httpState->takeAdaptedHeaders(reply); adapted->data->header = NULL; + reply = NULL; - noteSourceProgress(p); + if (expect_body) + noteSourceProgress(p); + else + noteSourceFinish(p); } // ICAP client sends more data