Re: [whatwg/fetch] Process 103 Early Hints response (PR #1404)

@annevk commented on this pull request.

Overall this looks reasonable to me. I have some nits and questions, and I might have some further editorial suggestions that I can also make in a fixup commit once everyone is aligned on the approach.

> @@ -5460,22 +5467,55 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
        <a for=request>body</a> cannot be recreated and that is why the buffer is needed.
       </div>
 
-     <li><p>Set <var>timingInfo</var>'s
-     <a for="fetch timing info">final network-response start time</a> to the
-     <a for=/>coarsened shared current time</a> given <var>fetchParams</var>'s
-     <a for="fetch params">cross-origin isolated capability</a>, immediately after the user agent's
-     HTTP parser receives the first byte of the response (e.g., frame header bytes for HTTP/2 or
-     response status line for HTTP/1.x).
-
-     <li><p>Wait until all the <a for=/>headers</a> are transmitted.
+     <li><p>Let <var>responseStartTime</var> be null.

Do we need this variable or can we check if the fetch timing info field is 0?

> +
+         <li><p>If <var>status</var> is 103, then:
+          <ol>
+           <li><p>If <var>fetchParams</var>'s <a for="fetch params">process early hints response</a>
+           is non-null, then:
+           <ol>
+            <li><p><a for=/>Assert</a>: <var>request</var>'s <a for=request>mode</a> is
+            "<code>navigate</code>".
+
+            <p class="note nobackref">The following step might trigger other fetches. The assertion
+            is to avoid potential CORS breakage.
+
+            <li><p><a>Queue a fetch task</a> to run <var>fetchParams</var>'s
+            <a for="fetch params">process early hints response</a>, with <a for=/>headers</a>.
+           </ol>
+           <li><p><a for=iteration>Continue</a>.

This isn't needed if you drop "Otherwise" from the next continue.

>  
-      <p class="note no-backref">These kind of <a for=/>responses</a> are eventually followed by a
-      "final" <a for=/>response</a>.
+       <li><p>Let <var>status</var> be <a for=response>status</a> of <a for=/>response</a>.
+
+       <li><p>If <var>status</var> is in the range 100 to 199, inclusive:
+        <ol>
+         <li><p>If <var>status</var> is 101, <a for=iteration>break</a>.
+
+         <li><p>If <var>status</var> is 103, then:

I suggest merging this conditional with the non-null check for process early hints response.

> -      "final" <a for=/>response</a>.
+       <li><p>Let <var>status</var> be <a for=response>status</a> of <a for=/>response</a>.
+
+       <li><p>If <var>status</var> is in the range 100 to 199, inclusive:
+        <ol>
+         <li><p>If <var>status</var> is 101, <a for=iteration>break</a>.
+
+         <li><p>If <var>status</var> is 103, then:
+          <ol>
+           <li><p>If <var>fetchParams</var>'s <a for="fetch params">process early hints response</a>
+           is non-null, then:
+           <ol>
+            <li><p><a for=/>Assert</a>: <var>request</var>'s <a for=request>mode</a> is
+            "<code>navigate</code>".
+
+            <p class="note nobackref">The following step might trigger other fetches. The assertion

```suggestion
            <p class=note>The following step might trigger other fetches. The assertion
```

> +
+       <li><p>If <var>responseStartTime</var> is null, set <var>responseStartTime</var> to
+       <a for=/>coarsened shared current time</a> given <var>fetchParams</var>'s
+       <a for="fetch params">cross-origin isolated capability</a>, immediately after the user
+       agent's HTTP parser receives the first byte of the response (e.g., frame header bytes for
+       HTTP/2 or response status line for HTTP/1.x).
+
+       <li><p>Let <var>status</var> be <a for=response>status</a> of <a for=/>response</a>.
+
+       <li><p>If <var>status</var> is in the range 100 to 199, inclusive:
+        <ol>
+         <li><p>If <var>status</var> is 101, <a for=iteration>break</a>.
+
+         <li><p>If <var>status</var> is 103, then:
+          <ol>
+           <li><p>If <var>fetchParams</var>'s <a for="fetch params">process early hints response</a>

As in it would bypass the same-origin policy? Presumably the 103 could come with CORS headers in theory?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1404#pullrequestreview-895138139
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1404/review/895138139@github.com>

Received on Monday, 28 February 2022 14:26:00 UTC