[whatwg/fetch] Concurrent GET requests can cause cache misses? (#932)

According to https://fetch.spec.whatwg.org/#http-network-or-cache-fetch when doing an http-network-or-cache-fetch, a user agent should first (5.19.1) 

> Set storedResponse to the result of selecting a response from the HTTP cache, possibly needing validation, as per the "Constructing Responses from Caches" chapter of HTTP Caching [HTTP-CACHING], if any.

and later (7.5.2)

> Store httpRequest and forwardResponse in the HTTP cache, as per the "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]

As far as I can tell, there's no locking mechanism, so if two GET requests for the same resource arrive concurrently, and the second arrives before the response for the first, then a UA is required to treat it as a cache miss and refetch the data.

This is in line with RFC 7234, https://httpwg.org/specs/rfc7234.html#rfc.section.3.1 which only allows storing partial responses after the status code has arrived, but doesn't seem ideal.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/932

Received on Tuesday, 10 September 2019 00:55:23 UTC