]> 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 12:16:27 +0000 (05:16 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 7 Feb 2011 12:16:27 +0000 (05: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 b98902d0012241ba1c8b1d2be60b4d480c32fc90..3db8325f4724a57fb8c05a909d1ecd28e5d14e2f 100644 (file)
@@ -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);
index 4a7dbb050644eddadf34aeccdeb9f54e7f1ef813..f7ebd4b6ff5f6a2e7362d5cfd8188b709ca0ea02 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