Repository navigation
Conversation
…with it
The static file handler compared If-None-Match with the file's entity
tag as a whole string, so a list ("other", "etag"), "*" and a weak
W/"etag" never matched. It also checked If-Modified-Since when the
request had If-None-Match, so a stale entity tag together with the
current date still got 304 and a cache kept a response the server
considered changed.
If-None-Match is now split into entity tags and compared weakly, "*"
matches, and If-Modified-Since is only evaluated when the request has
no If-None-Match (RFC 9110 sections 13.1.2 and 13.2.2).
unittest/http_static_not_modified_test checks a list, "*", a weak tag,
a mismatch, If-Modified-Since alone, and If-Modified-Since ignored next
to a mismatching If-None-Match.
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.
The static file handler compares
If-None-Matchwith the file's entity tag as one string, and then checksIf-Modified-Sinceregardless. This causes two problems:*and weak tags never match.If-None-Match: "other", "<etag>",If-None-Match: *andIf-None-Match: W/"<etag>"all get200. RFC 9110 section 13.1.2 definesIf-None-Matchas*or a list of entity tags, compared with the weak comparison.If-Modified-Sinceis evaluated even when the request hasIf-None-Match, soIf-None-Match: "stale"together with the currentIf-Modified-Sincegets304. A cache then keeps a response whose entity tag the server no longer considers current. RFC 9110 section 13.2.2 saysIf-Modified-Sinceis only evaluated whenIf-None-Matchis absent.If-None-Matchis now split into entity tags and compared weakly (aW/prefix on either side is ignored), and*matches.If-Modified-Sinceis only checked when the request has noIf-None-Match. TheIf-Modified-Sincecomparison itself is unchanged.The new
unittest/http_static_not_modified_test(added to the Makefile, CMake andscripts/unittest.sh) checks:*and a weak tag (304);If-Modified-Sincealone (304);If-None-Matchtogether with a matchingIf-Modified-Since(200).Without the change it fails on the list case. With the change it passes.