Re: [whatwg/fetch] HTTPS upgrades proposal (PR #1655)

@yoavweiss commented on this pull request.



>  
+To <dfn>upgrade an HTTP request</dfn> given a <a for=/>request</a> <var>request</var>, run these
+steps:
+
+<ol>
+  <li>
+    <p>If one or more of the following conditions are met, return without modifying request:

"without modifying request" can be implicit here.

> +To <dfn>upgrade an HTTP request</dfn> given a <a for=/>request</a> <var>request</var>, run these
+steps:
+
+<ol>
+  <li>
+    <p>If one or more of the following conditions are met, return without modifying request:
+    <ul>
+      <li><p><var>request</var>'s <a for="request">destination</a> is not "<code>document</code>"
+
+      <li><p><var>request</var>'s <a for="request">method</a> is not "<code>GET</code>"
+
+      <li><p><var>request</var>'s <a for="request">URL</a>'s <a for=url>scheme</a> is not
+      "<code>http</code>"
+
+      <li><p><var>request</var>'s <a for="request">URL</a>'s <a for=url>host</a> is exempted from
+      upgrades in an <a>implementation-defined</a> way. For example, if <a for=url>host</a> is a

Can you move the example to a note?

> +      <li><p><var>request</var>'s <a for="request">URL</a>'s <a for=url>host</a> is exempted from
+      upgrades in an <a>implementation-defined</a> way. For example, if <a for=url>host</a> is a
+      non-registrable or non-assignable domain name such as .local or an IP address that falls in a
+      range reserved for non-publicly routable networks, the implementation might return without
+      modifying <var>request</var>.
+    </ul>
+  </li>
+
+  <li><p>If <var>request</var>'s <code>https-upgrade-fallback-url</code> is non-null, clear the
+  <code>https-upgrade</code> and <code>https-upgrade-fallback-url</code> flags and return.
+
+  <p class="note">This is a fallback request that shouldn't be upgraded again. 
+
+  <li><p>Otherwise, upgrade the request by setting the following fields:
+    <ul>
+      <li>Set <code>https-upgrade-fallback-url</code> to request's URL

"request" and "URL" should be linked

> +      upgrades in an <a>implementation-defined</a> way. For example, if <a for=url>host</a> is a
+      non-registrable or non-assignable domain name such as .local or an IP address that falls in a
+      range reserved for non-publicly routable networks, the implementation might return without
+      modifying <var>request</var>.
+    </ul>
+  </li>
+
+  <li><p>If <var>request</var>'s <code>https-upgrade-fallback-url</code> is non-null, clear the
+  <code>https-upgrade</code> and <code>https-upgrade-fallback-url</code> flags and return.
+
+  <p class="note">This is a fallback request that shouldn't be upgraded again. 
+
+  <li><p>Otherwise, upgrade the request by setting the following fields:
+    <ul>
+      <li>Set <code>https-upgrade-fallback-url</code> to request's URL
+      <li>Set <var>request</var>'s URL's scheme to <code>"https"</code>

"URL" and "scheme" should be linked. 

> +      non-registrable or non-assignable domain name such as .local or an IP address that falls in a
+      range reserved for non-publicly routable networks, the implementation might return without
+      modifying <var>request</var>.
+    </ul>
+  </li>
+
+  <li><p>If <var>request</var>'s <code>https-upgrade-fallback-url</code> is non-null, clear the
+  <code>https-upgrade</code> and <code>https-upgrade-fallback-url</code> flags and return.
+
+  <p class="note">This is a fallback request that shouldn't be upgraded again. 
+
+  <li><p>Otherwise, upgrade the request by setting the following fields:
+    <ul>
+      <li>Set <code>https-upgrade-fallback-url</code> to request's URL
+      <li>Set <var>request</var>'s URL's scheme to <code>"https"</code>
+      <li>Set <code>https-upgrade</code> flag to true

"." at the end of sentences (here and above)

> +  </li>
+</ol>
+
+<h4 id=https-upgrades-fallback>Fallback algorithm</h4>
+
+To run <dfn>HTTPS upgrade fallback</dfn> given a <a for=/>request</a>
+<var>request</var> and <a for=/>response</a> <var>response</var>, run these steps:
+
+<ol>
+  <li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, return
+  <var>response</var>.
+
+  <p class="note">This means <var>request</var> was not upgraded.
+
+  <li>
+    <p>Otherwise, the request was upgraded.

No need for the "otherwise" and the rest should be a note

> +
+<h4 id=https-upgrades-fallback>Fallback algorithm</h4>
+
+To run <dfn>HTTPS upgrade fallback</dfn> given a <a for=/>request</a>
+<var>request</var> and <a for=/>response</a> <var>response</var>, run these steps:
+
+<ol>
+  <li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, return
+  <var>response</var>.
+
+  <p class="note">This means <var>request</var> was not upgraded.
+
+  <li>
+    <p>Otherwise, the request was upgraded.
+
+    <p>If <var>response</var> is a network error, the upgrade failed. Initiate a fallback

"if response is a network error, run the following steps:

Note: this means that the upgrade failed and initiates a fallback load"

> +<var>request</var> and <a for=/>response</a> <var>response</var>, run these steps:
+
+<ol>
+  <li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, return
+  <var>response</var>.
+
+  <p class="note">This means <var>request</var> was not upgraded.
+
+  <li>
+    <p>Otherwise, the request was upgraded.
+
+    <p>If <var>response</var> is a network error, the upgrade failed. Initiate a fallback
+    load by running the following steps:
+
+     <ol>
+      <li><p>Create a synthetic redirect response <var>fallbackResponse</var> that redirects to

"Let <var>fallbackResponse</var> be a new Response with its Location header set to https-upgrade-fallback-url, and its status set to 307" (anything else??)

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

Message ID: <whatwg/fetch/pull/1655/review/1506622929@github.com>

Received on Friday, 30 June 2023 07:18:44 UTC