]> git.ipfire.org Git - thirdparty/squid.git/commit - src/http.cc
Bug 2621: Provide request headers to RESPMOD when using cache_peer.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 9 Mar 2011 17:44:55 +0000 (10:44 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 9 Mar 2011 17:44:55 +0000 (10:44 -0700)
commite11513e1d19c26fd3d7b8bc942e5a0d97d9039f8
treeb2715faf79fd9e7c01c806d3b496d01db7f54081
parent21c5a65e3d692a0e9884544ae301ae5a1d6f2e33
Bug 2621: Provide request headers to RESPMOD when using cache_peer.
A short-term fix.

When FwdServer::_peer is set, HttpStateData constructor creates a new special
HttpRequest, overwriting the request pointer set in the parent
(ServerStateData) constructor to fwd->request.

To make matters worse, this special peer request has no headers at all (even
though flags and some cached/computed header values are copied). We initialize
it with the right URL, method, and protocol. We copy flags and a few other
random properties from the original request. We never copy the original
headers.

Furthermore, regardless of the peering, when we create the headers to send to
the next hop, those headers are temporary and not stored in any request
structure (see HttpStateData::buildRequestPrefix). The non-peering code
survives this because the request member points to fwd->request, which has the
headers. The peering code fails as illustrated by this bug.

I believe both cases are buggy because server-side adaptation and core code
should have access to the request headers we sent rather than the request
headers we received and adapted (or no headers at all). After all, it is the
sent headers that determine the next hop view of our Squid and adaptation
services should see a pair of _matching_ request and response headers.

I am pretty sure there are other bugs related to HttpStateData using a special
peer request structure instead of fwd->request. Please note that FwdState has
no idea that this substitution is going on.

This quick short-term fix uses the original request and its headers when
checking RESPMOD ACLs. This is what the patch in bug #2562 did for Squid v3.0.
For the reasons described above, this patch may be either insufficient or
wrong for the long-term fix.
src/Server.cc
src/http.cc