-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Sebastiaan van Erk opened SPR-14224 and commented
According to RFC2616 https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html if a request has the If-None-Match or If-Modified-Since headers are set on a request (that is, either one or the other, but not both), a 304 Not Modified can be returned if the the ETag matches or the resource is has not been modified since the specified date.
According to the same specification, if both headers are set, the behavior of the server is undefined. In other words, a client should never use both, as it does not make sense (the server could return "418 I'm a teapot" if it felt like it).
Thus for the checkNotModified(String etag, long lastModifiedTimestamp) method to be useful, it should:
- Check the etag if the If-None-Match header is the only header present.
- Check the last modified timestamp if the If-Modified-Since header is the only header present.
- Do something sane if both are present (which they shouldn't be). In my opinion, the most sane option is to check the etag, because it's generally stronger than the last modified date.
However, currently the implementation of the method returns false unless both headers are present (a case which should never happen). Thus effectively it always returns false.
Affects: 4.2.5
Issue Links:
- ServletWebRequest.isEtagNotModified does not support commas and spaces in client ETags [SPR-14216] #18790 ServletWebRequest.isEtagNotModified does not support commas and spaces in client ETags
Referenced from: commits a50ea80