]> git.ipfire.org Git - thirdparty/squid.git/commit - src/HttpHeader.h
Reject non-chunked HTTP messages with conflicting Content-Length values.
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 10 Aug 2015 21:23:12 +0000 (15:23 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 10 Aug 2015 21:23:12 +0000 (15:23 -0600)
commit3e42b3569e9ad26100a4622d2fd7301365cd883a
tree1be273754d969453e824607537354b7dc10c4f78
parent1fdc4f422f91a57150aa5eae88d5115976e8b821
Reject non-chunked HTTP messages with conflicting Content-Length values.

Squid used to trust and forward the largest Content-Length header. This
behavior violated an RFC 7230 MUST in Section 3.3.3 item #4. It also confused
some ICAP services and probably some HTTP agents. Squid now refuses to forward
the badly framed message to the ICAP service and HTTP agent, responding with
an HTTP 411 or 502 (depending on the message direction) error instead.

This is a quick-and-dirty implementation. A polished version should reject
responses with invalid Content-Length values as well (per RFC 7230 MUST) and
should behave the same regardless of the relaxed_header_parser setting (this
is not a header parsing issue).
src/HttpHeader.cc
src/HttpHeader.h
src/client_side.cc
src/http.cc