From: Amos Jeffries Date: Mon, 7 Feb 2011 12:16:27 +0000 (-0700) Subject: Author: Jonathan Wolfe X-Git-Tag: SQUID_3_1_11~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da6732a3d8d45699aeae6c3246ab0ff333081173;p=thirdparty%2Fsquid.git Author: Jonathan Wolfe Bug 3149: not caching ecap adapted body eCAP adapters may remove or edit the Content-Length header, and to allow caching of the adapted body squid must reflect that new (or unspecified) content length when deciding whether or not the adapted body can be cached. --- diff --git a/src/adaptation/ecap/Host.cc b/src/adaptation/ecap/Host.cc index b98902d001..3db8325f47 100644 --- a/src/adaptation/ecap/Host.cc +++ b/src/adaptation/ecap/Host.cc @@ -25,6 +25,7 @@ Adaptation::Ecap::Host::Host() // this code can run only once libecap::headerReferer.assignHostId(HDR_REFERER); + libecap::headerContentLength.assignHostId(HDR_CONTENT_LENGTH); libecap::protocolHttp.assignHostId(PROTO_HTTP); libecap::protocolHttps.assignHostId(PROTO_HTTPS); diff --git a/src/adaptation/ecap/MessageRep.cc b/src/adaptation/ecap/MessageRep.cc index 4a7dbb0506..f7ebd4b6ff 100644 --- a/src/adaptation/ecap/MessageRep.cc +++ b/src/adaptation/ecap/MessageRep.cc @@ -48,6 +48,9 @@ Adaptation::Ecap::HeaderRep::add(const Name &name, const Value &value) HttpHeaderEntry *e = new HttpHeaderEntry(squidId, name.image().c_str(), value.toString().c_str()); theHeader.addEntry(e); + + if (squidId == HDR_CONTENT_LENGTH) + theMessage.content_length = theHeader.getInt64(HDR_CONTENT_LENGTH); } void @@ -58,6 +61,9 @@ Adaptation::Ecap::HeaderRep::removeAny(const Name &name) theHeader.delByName(name.image().c_str()); else theHeader.delById(squidId); + + if (squidId == HDR_CONTENT_LENGTH) + theMessage.content_length = theHeader.getInt64(HDR_CONTENT_LENGTH); } libecap::Area