HTTP/1.1: improve handling of malformed 304 responses#2400
HTTP/1.1: improve handling of malformed 304 responses#2400yadij wants to merge 4 commits intosquid-cache:masterfrom
Conversation
This PR is related to Bug 5538 |
It is removed because changing that header means the entire 304 cannot be used. No need to ignore only the one header field, when the entire message is being ignored. |
RFC 9110 section 3.1 and 3.2 define a lot more than just Vary header to be skipped on 304 updates.
|
In c0cc5a9 I have restored |
A number of bugs have been identified with 304 processing with
various attempts made to fix "wrong" header values being used
after a 304 response alters cached objects. Worst examples of
these historically being Content-Length:0 or Vary header change
producing wrong response messages from Squid.
Behind these issues lays the HTTP concept of resource
representation. A resource is identified by its URL, but each
resource has many possible representations (eg language
translations, versions, encodings, and more).
A revalidation request identifies a representation being
checked. If the server uses another representation with
different properties (eg. size, Vary key, etc) the 304 headers
produced may appear "malformed" and cause corruption problems
when the updates are applied to the Squid object.
Solution: do not trust the server blindly.
Compare the representation identifiers from the 304 received
with the cached object to determine whether the representations
match before applying the 304 updates. Enforcing RFC 9111
section 4.3.4 better.
Also, extend the skipUpdateHeader() to obey all MUST and most
SHOULD NOT update requirements in RFC 9111 section 3.1 and 3.2.