Re: p6: Returning the freshest response

On 28 March 2013 23:10, Mark Nottingham <mnot@mnot.net  <mailto:mnot@mnot.net?Subject=Re%3A%20p6%3A%20Returning%20the%20freshest%20response&In-Reply-To=%253CCAF6rxg%3D96siQxgUUGwizQJYQ2XKyr1tdxj1URQWBjgWnS45WVw%40mail.gmail.com%253E&References=%253CCAF6rxg%3D96siQxgUUGwizQJYQ2XKyr1tdxj1URQWBjgWnS45WVw%40mail.gmail.com%253E>> wrote:

> p6 currently says;
>
> > When more than one suitable response is stored, a cache must use the most recent response (as determined by the Date header field).
>
> https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p6-cache.html#constructing.responses.from.caches
>
> ... which was sourced pretty directly from 2616:
>
> >  A correct cache MUST respond to a request with the most up-to-date response held by the cache that is appropriate to the request
>
> Interpreted strictly*, this means that if a cache has two fresh representations:
>
>    Content-Type: image/jpeg
>    Date: Thu, 14 Feb 2013 03:08:09 GMT
>
>    Content-Type: image/png
>    Date: Thu, 14 Feb 2013 03:08:08 GMT
>
> and it gets a request with:
>
>    Accept: image/jpeg;q=0.1, image/png;q=1.0
>
> then it'll return the JPEG because it's fresher, even though the client clearly prefers the PNG.
>
> However that's not the whole story. To get to those multiple responses, the cache goes through the process of winnowing down the potentially matching stored responses, using the process described in <https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p6-cache.html#caching.negotiated.responses>.
>
> That section says:
>
> > If multiple selected responses are available, the most recent response (as determined by the Date header field) is used; see Section 4.
>
> which I put into p6 based upon the above.
>
> So, I'm wondering if we should change that to something like:
>
> """
> If multiple selected responses are available, the cache will need to choose one to use. If a selecting header has a known mechanism for doing so (e.g., qvalues on Accept and similar request headers), it MAY be used to select one; otherwise, the most recent response (as determined by the Date header field) is used, as per Section 4.
> """
>
> Thoughts?

Again, I am the farthest thing from a HTTP cache expert but here are my 
thoughts based on my numerous readings of the current p6 draft in an 
attempt to educate myself.  Forgive me if I have waded too far into the 
deep end.

It seems to me that the rules in Sections 4 and 4.3 center around the 
fact that a cached response resulting from proactive content negotiation 
will include a Vary header, even though the presence of such a header in 
the server response is a MAY per 
https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p2-semantics.html#proactive.negotiation.

So the (my) question is, what can/should a cache do with multiple stored 
responses in the absence of any Vary headers, as in your example above?  
Can the cache use proactive content negotiation headers provided in the 
request to select the stored response that the client would prefer?  Or 
should the cache not select a response and punt it to the origin server 
per Section 4.2?

-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University

Received on Friday, 29 March 2013 15:23:58 UTC