Re: Collapsed requests and response freshness checks

Hi Alex,

I'd answer 'yes' and 'yes' -- unless there's something in the response that makes it ineligible for use with a particular request, there's no reason to think that the server will respond any differently to a subsequent retry of that request. In this view, the response is treated as if it's a response to each individual request, rather than being something that has already been stored by a cache.

I agree that it's not clear in the spec; the text on collapsed forwarding is new in 9111, and we didn't go into great detail. One of the things we factored out of 2616 was the concept of 'first-hand' - it might be useful again here.

I already have an issue[1] open to probe the edges of collapsed forwarding for cache-tests.fyi; I'll try to explore these aspects too when I get to it.

Cheers, 



1. https://github.com/http-tests/cache-tests/issues/129



> On 18 Feb 2024, at 09:02, Alex Rousskov <rousskov@measurement-factory.com> wrote:
> 
> Hello,
> 
>    RFC 9111 Section 4[1] says "cache can use a response that is stored or storable to satisfy multiple requests, provided that it is allowed to reuse that response for the requests in question". I am trying to understand which rules allow or prohibit that reuse. My guess is that _all_ "MUST not reuse a stored response unless..." rules in that Section apply, but since the response to the collapsed request is not necessarily a "stored response" (i.e. it could be "storable"), I want to double check.
> 
> For example, can a cache reuse a stale-on-arrival response to satisfy a collapsed request (without doing revalidation)? Let's assume the response in question is not "allowed to be served stale". Informally, the response in question is nearly as fresh as they get because it is being received to satisfy a _concurrent_ request (that our request has collapsed on). However, formal freshness rules may still require treating this response as stale (e.g., max-age=0), either in general (i.e. for any request) or with respect to our collapsed request.
> 
> Similarly, can a cache reuse a stale-on-arrival response with a must-revalidate directive to satisfy a collapsed request (without doing revalidation)? Here, the wiggle room for reuse appears to be even smaller because a cache "MUST NOT reuse that response to satisfy another request until it has been successfully validated by the origin".
> 
> I suspect the answers are "no" and "no", and, more generally speaking, there are just no reuse exceptions for collapsed requests compared to regular cache hits -- a cache has to treat the incoming response as if it was a previously stored cache hit, even though the response may still be coming into the cache (as the result of the original request that our request has collapsed on). In other words, all Section 4 reuse rules[1] apply. I would appreciate a confirmation.
> 
> 
> Thank you,
> 
> Alex.
> 
> [1]: https://www.rfc-editor.org/rfc/rfc9111.html#name-constructing-responses-from
> 

--
Mark Nottingham   https://www.mnot.net/

Received on Saturday, 17 February 2024 22:38:26 UTC