diff --git a/fetch.bs b/fetch.bs index 70f08d11c..7dcb5d73b 100644 --- a/fetch.bs +++ b/fetch.bs @@ -41,6 +41,9 @@ url:https://tools.ietf.org/html/rfc7234#section-1.2.1;text:delta-seconds;type:df "REFERRER": { "aliasOf": "referrer-policy" }, + "STALE-WHILE-REVALIDATE": { + "aliasOf": "RFC5861" + }, "SW": { "aliasOf": "service-workers" }, @@ -1404,10 +1407,14 @@ Unless stated otherwise, it is unset.
default
"
- no-store
"
basic
", "cors
", or "opaque
".
Unless stated otherwise, it is "basic
".
+A request has an associated +prevent no-cache cache-control header modification flag. +Unless stated otherwise, it is unset. +
A request has an associated done flag. Unless stated otherwise, it is unset. @@ -1896,6 +1907,17 @@ is a filtered response whose
Return newResponse. +
A fresh response is a response whose +age is within its freshness lifetime. + +
A stale-while-revalidate response is a +response that is not a fresh response, and its current age is within +the stale-while-revalidate lifetime. + +
A stale response is +a response is a response that is not a fresh response or a +stale-while-revalidate response. +
If-Range
`, then set httpRequest's
cache mode to "no-store
".
- If httpRequest's cache mode is "no-cache
" and
- httpRequest's header list does not contain
- `Cache-Control
`, then append
- `Cache-Control
`/`max-age=0
` to
+
If httpRequest's cache mode is "no-cache
",
+ httpRequest's prevent no-cache cache-control header modification flag
+ is unset, and httpRequest's header list
+ does not contain `Cache-Control
`, then
+ append `Cache-Control
`/`max-age=0
` to
httpRequest's header list.
If storedResponse requires validation (i.e., it is not fresh), then set the - revalidatingFlag. -
If the revalidatingFlag is set and httpRequest's
- cache mode is neither "force-cache
" nor
- "only-if-cached
", then:
-
+
If cache mode is "default
" and
+ storedResponse is a stale-while-revalidate response, then:
If storedResponse's header list
- contains `ETag
`, then append
- `If-None-Match
` with its value to httpRequest's
- header list.
-
-
If storedResponse's header list
- contains `Last-Modified
`, then
- append `If-Modified-Since
` with its value to
- httpRequest's header list.
-
Set response to storedResponse. +
Set response's cache state to "local
".
+
Let revalidateRequest be a clone of request. +
Set revalidateRequest's cache mode set to
+ "no-cache
".
+
Set revalidateRequest's prevent no-cache cache-control header modification flag + set. +
Set revalidateRequest's service-workers mode set to
+ "none
".
+
In parallel perform main fetch using + revalidateRequest. + +
Note the parallel fetch is only meant to update the state of the HTTP cache + and the response will be unused until another cache access. The stale response will be used + as the response to current request. The parallel fetch will be issued in the context of + the browsing context so if it is destroyed the request will be aborted. -
See also the - "Sending a Validation Request" - chapter of HTTP Caching [[!HTTP-CACHING]]. +
Otherwise: +
If storedResponse is a stale response, then set the + revalidatingFlag. -
Otherwise, set response to storedResponse and set
- response's cache state to "local
".
+
If the revalidatingFlag is set and httpRequest's
+ cache mode is neither "force-cache
" nor
+ "only-if-cached
", then:
+
+
If storedResponse's header list
+ contains `ETag
`, then append
+ `If-None-Match
` with its value to httpRequest's
+ header list.
+
+
If storedResponse's header list
+ contains `Last-Modified
`, then
+ append `If-Modified-Since
` with its value to
+ httpRequest's header list.
+
See also the + "Sending a Validation Request" + chapter of HTTP Caching [[!HTTP-CACHING]]. + +
Otherwise, set response to storedResponse and set
+ response's cache state to "local
".
+