-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConditionalGET expects both If-None-Match and If-Modified-Since headers #665
Comments
Additionally, it should compare the dates if the strings do not match. |
It looks like there are several issues with ConditionalGET. I'll work on seperate PRs:
|
Not sure if this is exactly what you mean, but the RFC says it's expected to use an exact match:
|
I'm unsure that it's worth parsing the timestamp when they don't match. However, it's recommended that UAs both If-None-Match and If-Modified-Since as a fallback. (It looks like Googlebot and Chrome do this, for example.) By changing it to check If-None-Match when it exists, and not checking If-Modified-Since at all, we avoid the extra hit from mismatched timestamps. But if a UA does want to use it (for example, using the timestamp of when a file was retrieved and saved in a mirror, instead of a Last-Modified timestamp) then it will still work properly. |
There's another complication, at least with Apache and HTTP2 with gzip encoding. If I make a request with "Accept-Encoding: gzip" then Apache is adding a "-gzip" suffix th the etag. So the UA will send the modified ETag back, (This is apparently caused when fixing Plack::Middleware::ETag's malformed ETags.) I'm not sure if there's anything practical that we can do for that case. See https://bz.apache.org/bugzilla/show_bug.cgi?id=39727 |
Not much you can do, except maybe write an inline middleware to strip that part. |
The comment
is incorrect.
According to the RFC 7232
If the resource response contains both
ETag
andLast-Modified
headers, and the request has anIf-None-Match
header but noIf-Modified-Since
, then it will not return HTTP 304 when it should.The text was updated successfully, but these errors were encountered: