]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Jonathan Wolfe <jonathan.wolfe@gmail.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 7 Feb 2011 04:16:22 +0000 (21:16 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 7 Feb 2011 04:16:22 +0000 (21:16 -0700)
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.

src/adaptation/ecap/Host.cc
src/adaptation/ecap/MessageRep.cc

index 830ab457a16418892761c6ee83df27ddf4134af5..27baa73fcbfa8842b639f790703773de30b69821 100644 (file)
@@ -28,6 +28,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);
index f95afcf94ae0959be54235d1cf1c106b6e491231..a86bfe3c6f9d81399a83eef687c0c0ad73d46b63 100644 (file)
@@ -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