From da6732a3d8d45699aeae6c3246ab0ff333081173 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 7 Feb 2011 05:16:27 -0700 Subject: [PATCH] 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. --- src/adaptation/ecap/Host.cc | 1 + src/adaptation/ecap/MessageRep.cc | 6 ++++++ 2 files changed, 7 insertions(+) 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 -- 2.47.3