[PATCH] Follow RFC-7232 while evaluating the precedence of conditional headers

Maxim Dounin mdounin at mdounin.ru
Thu May 14 22:25:26 UTC 2020


Hello!

On Fri, May 01, 2020 at 03:05:05PM -0700, Karthik Uthaman wrote:

> Nginx evaluates the conditional headers in the following order
> if_unmodified_since
> if_match
> if_modified_since
> if_none_match
> 
> which ignores some of the subtleties mentioned in RFC-7232, which
> gives more precedence to etag based validation over time.
> 
> https://tools.ietf.org/html/rfc7232#section-3.4
> A recipient MUST ignore If-Unmodified-Since if the request contains
> an If-Match header field; the condition in If-Match is considered to
> be a more accurate replacement for the condition in
> If-Unmodified-Since, and the two are only combined for the sake of
> interoperating with older intermediaries that might not implement
> If-Match.
> 
> https://tools.ietf.org/html/rfc7232#section-3.3 and
> A recipient MUST ignore If-Modified-Since if the request contains an
> If-None-Match header field; the condition in If-None-Match is
> considered to be a more accurate replacement for the condition in
> If-Modified-Since, and the two are only combined for the sake of
> interoperating with older intermediaries that might not implement
> If-None-Match.
> 
> Along with those I have followed the precedence guidance provided in
> https://tools.ietf.org/html/rfc7232#section-6 to change the order of
> conditional headers being evaluated in nginx.
> 
> Please let me know if the changes in the patch file looks good. Happy to
> address any concerns you may have.

This was previously discussed in the thread here:

http://mailman.nginx.org/pipermail/nginx-devel/2014-November/006245.html

TL;DR: the required behaviour was changed in RFC 7232 compared to 
RFC 2616, and no explanation is known why the change in question 
was introduced in RFC 7232.  Currently nginx follows RFC 2616 and 
checks both validators.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list