Repository navigation
Include the Vary header field in a 304 response for a precompressed resource - #1163
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
…esource RFC 9110 requires a 304 response to include the Vary header field that would have been included in a 200 response to the same request. When precompressed resources were available the DefaultServlet added Vary: accept-encoding after the If headers had been checked so a 304 response did not include it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC 9110 section 15.4.5 requires a 304 response to include the Vary header field that would have been sent in a 200 response to the same request.
When precompressed resources are available, DefaultServlet adds Vary: accept-encoding to the response, but only after it has checked the If headers. A 304 response for If-None-Match or If-Modified-Since was therefore sent without it, although the 200 response has it.
The header is now added before the If headers are checked. The list of precompressed resources is only looked up once.
The new test fails without the change and passes with it. TestDefaultServlet, TestDefaultServletRfc9110Section13, TestDefaultServletIfMatchRequests and TestDefaultServletRangeRequests pass.