This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Description
Hi there,
Currently, on revalidation, a 304 will only be generated if the precondition matches:
https://github.com/aw/CacheRules/blob/master/lib/validations.rb#L124-L127"
However, this does not handle all the preconditions:
https://tools.ietf.org/html/rfc7234#section-4.3.2
If an If-None-Match header field is not present, a request containing
an If-Modified-Since header field (Section 3.3 of [RFC7232])
indicates that the client wants to validate one or more of its own
stored responses by modification date. A cache recipient SHOULD
generate a 304 (Not Modified) response (using the metadata of the
selected stored response) if one of the following cases is true: 1)
the selected stored response has a Last-Modified field-value that is
earlier than or equal to the conditional timestamp; 2) no
Last-Modified field is present in the selected stored response, but
it has a Date field-value that is earlier than or equal to the
conditional timestamp; or, 3) neither Last-Modified nor Date is
present in the selected stored response, but the cache recorded it as
having been received at a time earlier than or equal to the
conditional timestamp.
On such a request, CacheRules will return a 200 with REVALIDATED as lookup value.
The funny thing is, you have actually already written this:
https://github.com/aw/CacheRules/blob/master/lib/validations.rb#L29
A simple replacement of validator_match with precond_match here should fix this:
https://github.com/aw/CacheRules/blob/master/lib/cache_rules.rb#L89