]> git.ipfire.org Git - thirdparty/squid.git/commit - src/HttpHeaderRange.h
Bug 2821: Ignore Content-Range in non-206 responses (#77)
authorEduard Bagdasaryan <dictiano@gmail.com>
Thu, 16 Nov 2017 00:05:21 +0000 (03:05 +0300)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 16 Nov 2017 00:05:21 +0000 (17:05 -0700)
commit8341f96de105a95265087b6546c1a57d98c7ac39
tree0397c6f2cde424fee9e768d7af3cd346ba5d6efe
parente3bf07f56ff949f596b3060ba55f20ba6edf170e
Bug 2821: Ignore Content-Range in non-206 responses (#77)

Squid used to honor Content-Range header in HTTP 200 OK (and possibly
other non-206) responses, truncating (and possibly enlarging) some
response bodies. RFC 7233 declares Content-Range meaningless for
standard HTTP status codes other than 206 and 416. Squid now relays
meaningless Content-Range as is, without using its value.

Why not just strip a meaningless Content-Range header? Squid does not
really know whether it is the status code or the header that is "wrong".
Let the client figure it out while the server remains responsible.

Also ignore Content-Range in 416 (Range Not Satisfiable) responses
because that header does not apply to the response body.

Also fixed body corruption of (unlikely) multipart 206 responses to
single-part Range requests. Valid multipart responses carry no
Content-Range (in the primary header), which confused Squid.
src/HttpHdrRange.cc
src/HttpHeaderRange.h
src/HttpReply.cc
src/HttpReply.h
src/clients/Client.cc
src/http/Stream.cc
src/tests/stub_HttpReply.cc