]> git.ipfire.org Git - thirdparty/squid.git/commit
Do not blindly forward cache peer CONNECT responses.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 9 Jul 2015 03:21:33 +0000 (20:21 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 9 Jul 2015 03:21:33 +0000 (20:21 -0700)
commit94aaf79eeaa2905b263455e33f1878c8a6b68308
tree88a458d9a9ac98356b5b3d683bc2ad480b76ac9f
parent6ec68eb9be41795e50f52f88236f5415db48193a
Do not blindly forward cache peer CONNECT responses.

Squid blindly forwards cache peer CONNECT responses to clients. This
may break things if the peer responds with something like HTTP 403
(Forbidden) and keeps the connection with Squid open:
  -  The client application issues a CONNECT request.
  -  Squid forwards this request to a cache peer.
  -  Cache peer correctly responds back with a "403 Forbidden".
  -  Squid does not parse cache peer response and
     just forwards it as if it was a Squid response to the client.
  -  The TCP connections are not closed.

At this stage, Squid is unaware that the CONNECT request has failed. All
subsequent requests on the user agent TCP connection are treated as
tunnelled traffic. Squid is forwarding these requests to the peer on the
TCP connection previously used for the 403-ed CONNECT request, without
proper processing. The additional headers which should have been applied
by Squid to these requests are not applied, and the requests are being
forwarded to the cache peer even though the Squid configuration may
state that these requests must go directly to the origin server.

This fixes Squid to parse cache peer responses, and if an error response
found, respond with "502 Bad Gateway" to the client and close the
connections.
src/tunnel.cc