Skip to content

Commit 94cd212

Browse files
committed
Address comments
1 parent 4df9b54 commit 94cd212

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

fetch.bs

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,37 +3251,37 @@ steps:
32513251

32523252
<h4 id=https-upgrades-upgrade>Upgrade algorithm</h4>
32533253

3254-
<p>Given a request <var>request</var>, this algorithm will rewrite its URL if the request should be
3255-
modified and loaded over <code>"https"</code>, via the following algorithm:
3254+
To <dfn>upgrade an HTTP request</dfn> given a <a for=/>request</a> <var>request</var>, run these
3255+
steps:
32563256

32573257
<ol>
32583258
<li>
32593259
<p>If one or more of the following conditions are met, return without modifying request:
32603260
<ul>
3261-
<li><p><var>request</var> is not a navigation request whose destination is document</li>
3262-
3263-
<li><p><var>request</var>'s method is not `<code>GET</code>`</li>
3261+
<li><p><var>request</var>'s <a for="request">destination</a> is "<code>document</code>"
32643262

3265-
<li><p><var>request</var>'s URL's scheme is not <code>"http"</code></li>
3263+
<li><p><var>request</var>'s <a for="request">method</a> is not "<code>GET</code>"
32663264

3267-
<li><p><var>request</var>'s URL's host is non-unique (i.e., contains a non-registrable or
3268-
non-assignable domain name such as .local or an IP address that falls in a range reserved for
3269-
non-publicly routable networks)</li>
3265+
<li><p><var>request</var>'s <a for="request">URL</a>'s <a for=url>scheme</a> is not
3266+
"<code>http</code>"
32703267

3271-
<li><p>Optionally, <var>request</var>'s URL's host is exempted from upgrades by the user agent
3272-
</li>
3268+
<li><p><var>request</var>'s <a for="request">URL</a>'s <a for=url>host</a> is exempted from
3269+
upgrades in an <a>implementation-defined</a> way. For example, if <a for=url>host</a> is a
3270+
non-registrable or non-assignable domain name such as .local or an IP address that falls in a
3271+
range reserved for non-publicly routable networks, the implementation might return without
3272+
modifying <var>request</var>.
32733273
</ul>
32743274
</li>
32753275

32763276
<li><p>If <var>request</var>'s <code>https-upgrade-fallback-url</code> is non-null, this is a
32773277
fallback request that shouldn't be upgraded again. Clear the <code>https-upgrade</code> and
3278-
<code>https-upgrade-fallback-url</code> flags and return <var>request</var>.</li>
3278+
<code>https-upgrade-fallback-url</code> flags and return.
32793279

32803280
<li><p>Otherwise, upgrade the request by setting the following fields:
32813281
<ul>
3282-
<li>Set <code>https-upgrade-fallback-url</code> to request's URL</li>
3283-
<li>Set <var>request</var>'s URL's scheme to <code>"https"</code></li>
3284-
<li>Set <code>https-upgrade</code> flag to true</li>
3282+
<li>Set <code>https-upgrade-fallback-url</code> to request's URL
3283+
<li>Set <var>request</var>'s URL's scheme to <code>"https"</code>
3284+
<li>Set <code>https-upgrade</code> flag to true
32853285
</ul>
32863286
</li>
32873287
</ol>
@@ -3291,30 +3291,27 @@ modified and loaded over <code>"https"</code>, via the following algorithm:
32913291
<p>Runs after the Upgrade algorithm. This algorithm determines whether the upgraded
32923292
request completed without a network error. If not, it retries the request over <code>"http"</code>.
32933293

3294+
To <dfn>handle an HTTPS upgrade fallback</dfn> given a <a for=/>request</a> <var>request</var>, run
3295+
these steps:
3296+
32943297
<ol>
3295-
<li><p>If the <code>https-upgrade</code> flag is not set, return without modifying request.</li>
3298+
<li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, return without
3299+
modifying request.
32963300

32973301
<li><p>Otherwise, this is an upgraded request. Let <var>upgradedResponse</var> be the result of
3298-
fetching the upgraded request.</li>
3302+
fetching the upgraded request.
32993303

33003304
<li>
3301-
<p>If <var>upgradedResponse</var> is a network error, initiate a fallback http load by doing the
3302-
following:
3305+
<p>If <var>upgradedResponse</var> is a network error, initiate a fallback load by creating a
3306+
synthetic redirect response <var>fallbackResponse</var> that redirects to <var>request</var>'s
3307+
<code>https-upgrade-fallback-url</code> flag with status 307. Return
3308+
<var>fallbackResponse</var>.
33033309

3304-
<ul>
3305-
<li><p>Set <var>request</var>'s URL to the value of <var>request</var>'s
3306-
<code>https-upgrade-fallback-url</code> flag</li>
3307-
3308-
<li><p>Set response to the result of running <a>HTTP-redirect fetch</a> given fetchParams and
3309-
<var>upgradedResponse</var>.</li>
3310-
</ul>
3311-
</li>
3312-
3313-
<li><p>Otherwise, the upgrade was successful. Return <var>upgradedResponse</var>.</li>
3310+
<li><p>Otherwise, the upgrade was successful. Return <var>upgradedResponse</var>.
33143311
</ol>
33153312

3316-
<p>
3317-
Optionally, user agents may implement a fast-fallback option by canceling slow fetches on upgraded
3313+
<p class=note>
3314+
User agents may implement an optional fast-fallback path by canceling slow fetches on upgraded
33183315
requests and quickly initiate a fallback http load.
33193316

33203317
</div>
@@ -3336,15 +3333,6 @@ requests and quickly initiate a fallback http load.
33363333
A fallback request will be initiated to <code>http://a.com</code>.
33373334
</div>
33383335

3339-
<div id=example-https-upgrade-slow-https class=example>
3340-
<p>
3341-
Optional fast-fallback example: <code>a.com</code> serves <code>http://a.com</code> and loads very
3342-
slowly over <code>https://a.com</code>.
3343-
An eligible request to <code>http://a.com</code> will be upgraded to <code>https://a.com</code>.
3344-
If the upgraded request doesn't return a response for N seconds, the fetch will be canceled.
3345-
A fallback request will be initiated to <code>http://a.com</code>.
3346-
</div>
3347-
33483336
<h2 id=http-extensions>HTTP extensions</h2>
33493337

33503338
<h3 id=origin-header>`<code>Origin</code>` header</h3>
@@ -4523,7 +4511,7 @@ steps:
45234511

45244512
<li><p><a>Upgrade <var>request</var> to a potentially trustworthy URL, if appropriate</a>.
45254513

4526-
<li><p><a href="#https-upgrades-upgrade">Optionally, run HTTPS upgrading algorithm on <var>request</var>, if appropriate</a>.
4514+
<li><p>Optionally, run <a>upgrade an HTTP request</a> algorithm on <var>request</var>, if appropriate</a>.
45274515

45284516
<li><p><a>Upgrade a mixed content <var>request</var> to a potentially trustworthy URL, if appropriate</a>.
45294517

@@ -5310,6 +5298,8 @@ these steps:
53105298
<a>CORS check</a>, as <var>request</var>'s <a for=request>client</a> and the service worker can
53115299
have different embedder policies.
53125300

5301+
<li><p>Run <a>handle an HTTPS upgrade fallback</a> algorithm on <var>request</var>, if appropriate.</a>
5302+
53135303
<li>
53145304
<p>If <var>actualResponse</var>'s <a for=response>status</a> is a <a>redirect status</a>, then:
53155305

@@ -5344,8 +5334,6 @@ these steps:
53445334
<!-- not resetting actualResponse since it's no longer used anyway -->
53455335
</ol>
53465336

5347-
<li><p><a href="#https-upgrades-fallback">Optionally, run HTTPS upgrading fallback algorithm, if appropriate.</a>
5348-
53495337
<li><p>Return <var>response</var>. <span class=note>Typically <var>actualResponse</var>'s
53505338
<a for=response>body</a>'s <a for=body>stream</a> is still being enqueued to after
53515339
returning.</span>

0 commit comments

Comments
 (0)