w3c / ServiceWorker

Service Workers
https://w3c.github.io/ServiceWorker/
Other
3.63k stars 313 forks source link

Cache API Vary header processing should be clarified #1609

Open annevk opened 3 years ago

annevk commented 3 years ago

Let fieldValues be the list containing the elements corresponding to the field-values of the Vary header for the value of the header with name Vary.

This needs to be rewritten on top of https://fetch.spec.whatwg.org/#concept-header-list-get (or perhaps the algorithm below "get, decode, and split") as this sentence makes little sense.

madsruben commented 1 year ago

I assume this is related:

In the spec algorithm for matching a cached item at https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm, it is stated that each Vary header key listed in the Response shall be used to match the requestObject header value with the request's respective header value.

However, for Cache.put(), https://w3c.github.io/ServiceWorker/#cache-put, the Vary header matching only checks for '*' and not any other header keys. This appears to lead to cache items for the same request url being overwritten by put(), although they should have been stored as separate cache keys based on the Vary header values.