@@ -3251,37 +3251,37 @@ steps:
3251
3251
3252
3252
<h4 id=https-upgrades-upgrade>Upgrade algorithm</h4>
3253
3253
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 :
3256
3256
3257
3257
<ol>
3258
3258
<li>
3259
3259
<p> If one or more of the following conditions are met, return without modifying request:
3260
3260
<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> "
3264
3262
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> "
3266
3264
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> "
3270
3267
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> .
3273
3273
</ul>
3274
3274
</li>
3275
3275
3276
3276
<li><p> If <var> request</var> 's <code> https-upgrade-fallback-url</code> is non-null, this is a
3277
3277
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.
3279
3279
3280
3280
<li><p> Otherwise, upgrade the request by setting the following fields:
3281
3281
<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
3285
3285
</ul>
3286
3286
</li>
3287
3287
</ol>
@@ -3291,30 +3291,27 @@ modified and loaded over <code>"https"</code>, via the following algorithm:
3291
3291
<p> Runs after the Upgrade algorithm. This algorithm determines whether the upgraded
3292
3292
request completed without a network error. If not, it retries the request over <code> "http"</code> .
3293
3293
3294
+ To <dfn>handle an HTTPS upgrade fallback</dfn> given a <a for=/>request</a> <var> request</var> , run
3295
+ these steps:
3296
+
3294
3297
<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.
3296
3300
3297
3301
<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.
3299
3303
3300
3304
<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> .
3303
3309
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> .
3314
3311
</ol>
3315
3312
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
3318
3315
requests and quickly initiate a fallback http load.
3319
3316
3320
3317
</div>
@@ -3336,15 +3333,6 @@ requests and quickly initiate a fallback http load.
3336
3333
A fallback request will be initiated to <code> http://a.com</code> .
3337
3334
</div>
3338
3335
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
-
3348
3336
<h2 id=http-extensions>HTTP extensions</h2>
3349
3337
3350
3338
<h3 id=origin-header>`<code>Origin</code>` header</h3>
@@ -4523,7 +4511,7 @@ steps:
4523
4511
4524
4512
<li><p> <a>Upgrade <var>request</var> to a potentially trustworthy URL, if appropriate</a> .
4525
4513
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> .
4527
4515
4528
4516
<li><p> <a>Upgrade a mixed content <var>request</var> to a potentially trustworthy URL, if appropriate</a> .
4529
4517
@@ -5310,6 +5298,8 @@ these steps:
5310
5298
<a>CORS check</a> , as <var> request</var> 's <a for=request>client</a> and the service worker can
5311
5299
have different embedder policies.
5312
5300
5301
+ <li><p> Run <a>handle an HTTPS upgrade fallback</a> algorithm on <var> request</var> , if appropriate.</a>
5302
+
5313
5303
<li>
5314
5304
<p> If <var> actualResponse</var> 's <a for=response>status</a> is a <a>redirect status</a> , then:
5315
5305
@@ -5344,8 +5334,6 @@ these steps:
5344
5334
<!-- not resetting actualResponse since it's no longer used anyway -->
5345
5335
</ol>
5346
5336
5347
- <li><p> <a href="#https-upgrades-fallback">Optionally, run HTTPS upgrading fallback algorithm, if appropriate.</a>
5348
-
5349
5337
<li><p> Return <var> response</var> . <span class=note> Typically <var> actualResponse</var> 's
5350
5338
<a for=response>body</a> 's <a for=body>stream</a> is still being enqueued to after
5351
5339
returning.</span>
0 commit comments