Re: [whatwg/fetch] How are reloads mapped to cache modes? (#524)

Might need @mcmanus here to understand our cache-control header mappings.

I think maybe we should separate this into two questions:

1) How do RequestCache values map to Request headers sent?
2) What mode is used when the refresh button is pressed?

I think (1) should be spec'd, but I'm not sure about (2).  Browsers seem to want to differentiate on refresh button UX.

> Firefox Nightly
> Upon a "normal" reload, requests HTML/CSS/JS/IMG conditionally, with CC: max-age=0.

Gecko maps a normal reload to the concept of "validate always":

https://dxr.mozilla.org/mozilla-central/source/docshell/base/nsDocShell.cpp#11480

Which from the current fetch spec language seems to best match "no-cache" RequestCache value:

"Fetch creates a conditional request if there is a response in the HTTP cache and a normal request otherwise. It then updates the HTTP cache with the response"

https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/HttpBaseChannel.cpp#2677

This is then mapped to "max-age=0" for greater H1.1 and newer here:

https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpChannel.cpp#913

The comment there is interesting.

> Upon a "hard" reload, requests HTML/CSS/JS/IMG unconditionally, with CC: no-cache.

For a hard reload gecko intends this to "bypass the cache":

https://dxr.mozilla.org/mozilla-central/source/docshell/base/nsDocShell.cpp#11492

>From the fetch spec this seems to map to "reload":

"Fetch behaves as if there is no HTTP cache on the way to the network. Ergo, it creates a normal request and updates the HTTP cache with the response. "

https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/HttpBaseChannel.cpp#2675

This is then mapped to "no-cache" for all HTTP protocol versions with a similar comment as above:

https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpChannel.cpp#899

-- 
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/524#issuecomment-293908308

Received on Thursday, 13 April 2017 14:17:47 UTC