Re: [whatwg/fetch] Add Stale While Revalidate Handling (#853)

annevk commented on this pull request.

Thanks for filing those bugs. It seems there's tests too. Do we have one other interested implementer?

> -         <a for="header list">contains</a> `<code>ETag</code>`, then <a for="header list">append</a>
-         `<code>If-None-Match</code>` with its value to <var>httpRequest</var>'s
-         <a for=request>header list</a>.
-
-         <li><p>If <var>storedResponse</var>'s <a for=response>header list</a>
-         <a for="header list">contains</a> `<code>Last-Modified</code>`, then
-         <a for="header list">append</a> `<code>If-Modified-Since</code>` with its value to
-         <var>httpRequest</var>'s <a for=request>header list</a>.
-        </ol>
+         <li><p>Set <var>response</var> to <var>storedResponse</var>.
+         <li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
+         <li><p>Let <var>revalidateRequest</var> be a <a for=request>clone</a> of <var>request</var>.
+         <li><p>Set <var>revalidateRequest</var>'s <a for=request>cache mode</a> set to
+         "<code>no-cache</code>".
+         <li><p>Set <var>revalidateRequest</var>'s <a for=request>prevent no-cache cache-control header modification flag</a>
+         set.

You can drop "set" at the end here.

> -
-         <li><p>If <var>storedResponse</var>'s <a for=response>header list</a>
-         <a for="header list">contains</a> `<code>Last-Modified</code>`, then
-         <a for="header list">append</a> `<code>If-Modified-Since</code>` with its value to
-         <var>httpRequest</var>'s <a for=request>header list</a>.
-        </ol>
+         <li><p>Set <var>response</var> to <var>storedResponse</var>.
+         <li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
+         <li><p>Let <var>revalidateRequest</var> be a <a for=request>clone</a> of <var>request</var>.
+         <li><p>Set <var>revalidateRequest</var>'s <a for=request>cache mode</a> set to
+         "<code>no-cache</code>".
+         <li><p>Set <var>revalidateRequest</var>'s <a for=request>prevent no-cache cache-control header modification flag</a>
+         set.
+         <li><p>Set <var>revalidateRequest</var>'s <a for=request>service-workers mode</a> set to
+         "<code>none</code>".
+         <li><p><a>In parallel</a> perform <a for=main>main fetch</a> using

This `<li>` contains two children, so `<p>` needs to be on an indented newline.

>  
-        <p class=note>See also the
-        "<a href=https://tools.ietf.org/html/rfc7234#section-4.3.4>Sending a Validation Request</a>"
-        chapter of <cite>HTTP Caching</cite> [[!HTTP-CACHING]].
+        </ol>
+       <li><p>Otherwise:

Indented newline.

> @@ -1404,10 +1407,14 @@ Unless stated otherwise, it is unset.
 <div class="note no-backref">
  <dl>
   <dt>"<code>default</code>"
-  <dd><a for=/>Fetch</a> will inspect the HTTP cache on the way to the network.
-  If there is a fresh response it will be used. If there is a stale response a conditional request
-  will be created, and a normal request otherwise. It then updates the HTTP cache with the response.
-  [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
+  <dd><a for=/>Fetch</a> will inspect the HTTP cache on the way to the network. If the HTTP cache
+  contains a matching <a>fresh response</a> it will be returned. If the HTTP cache contains a
+  matching <a>stale-while-revalidate response</a> it will be returned, and a conditional network
+  fetch will be made to update the entry in the HTTP cache. If the HTTP cache contains a matching
+  <a>stale response</a>, a conditional network will be created and returned to update the entry in

network fetch*

> @@ -1404,10 +1407,14 @@ Unless stated otherwise, it is unset.
 <div class="note no-backref">
  <dl>
   <dt>"<code>default</code>"
-  <dd><a for=/>Fetch</a> will inspect the HTTP cache on the way to the network.
-  If there is a fresh response it will be used. If there is a stale response a conditional request
-  will be created, and a normal request otherwise. It then updates the HTTP cache with the response.
-  [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
+  <dd><a for=/>Fetch</a> will inspect the HTTP cache on the way to the network. If the HTTP cache
+  contains a matching <a>fresh response</a> it will be returned. If the HTTP cache contains a
+  matching <a>stale-while-revalidate response</a> it will be returned, and a conditional network
+  fetch will be made to update the entry in the HTTP cache. If the HTTP cache contains a matching
+  <a>stale response</a>, a conditional network will be created and returned to update the entry in

Also, "created and" doesn't seem needed given the other wording?

-- 
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/pull/853#pullrequestreview-213507361

Received on Tuesday, 12 March 2019 16:44:34 UTC