Skip to content

Commit b028da0

Browse files
committed
Add opaqueauth response type
This introduces a new type of opaque filtered response, used by the browser when it can't prompt for credentials mid-request and will handle the authentication out-of-band (or not at all). See whatwg#1132
1 parent 78f9bdd commit b028da0

File tree

1 file changed

+52
-28
lines changed

1 file changed

+52
-28
lines changed

fetch.bs

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,8 +2047,9 @@ evolves over time. That is, not all its fields are available straight away.
20472047
"<code>cors</code>",
20482048
"<code>default</code>",
20492049
"<code>error</code>",
2050-
"<code>opaque</code>", or
2051-
"<code>opaqueredirect</code>".
2050+
"<code>opaque</code>",
2051+
"<code>opaqueredirect</code>", or
2052+
"<code>opaqueauth</code>".
20522053
Unless stated otherwise, it is "<code>default</code>".
20532054

20542055
<p>A <a for=/>response</a> can have an associated
@@ -2235,6 +2236,15 @@ is a <a>filtered response</a> whose
22352236
<a attribute for=Response lt=ok><code>response.ok</code></a>, will return rather useless results.
22362237
</div>
22372238

2239+
<p>An
2240+
<dfn export id=concept-filtered-response-opaque-auth>opaque-auth filtered response</dfn>
2241+
is a <a>filtered response</a> whose
2242+
<a for=response>type</a> is "<code>opaqueauth</code>",
2243+
<a for=response>status</a> is 0,
2244+
<a for=response>status message</a> is the empty byte sequence,
2245+
<a for=response>header list</a> is empty, and
2246+
<a for=response>body</a> is null.
2247+
22382248
<p>To <dfn export for=response id=concept-response-clone>clone</dfn> a
22392249
<a for=/>response</a> <var>response</var>, run these steps:
22402250

@@ -4864,10 +4874,12 @@ steps. They return a <a for=/>response</a>.
48644874

48654875
<li><p>Let <var>httpRequest</var> be null.
48664876

4867-
<li><p>Let <var>response</var> be null.
4877+
<li><p>Let <var>actualResponse</var> be null.
48684878

48694879
<li><p>Let <var>storedResponse</var> be null.
48704880

4881+
<li><p>Let <var>response</var> be null.
4882+
48714883
<li><p>Let <var>httpCache</var> be null.
48724884

48734885
<li><p>Let the <var>revalidatingFlag</var> be unset.
@@ -5146,9 +5158,9 @@ steps. They return a <a for=/>response</a>.
51465158
<a for=request>client</a> is non-null, then:
51475159

51485160
<ol>
5149-
<li><p>Set <var>response</var> to <var>storedResponse</var>.
5161+
<li><p>Set <var>actualResponse</var> to <var>storedResponse</var>.
51505162

5151-
<li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
5163+
<li><p>Set <var>actualResponse</var>'s <a for=response>cache state</a> to "<code>local</code>".
51525164

51535165
<li><p>Let <var>revalidateRequest</var> be a <a for=request>clone</a> of
51545166
<var>request</var>.
@@ -5201,8 +5213,8 @@ steps. They return a <a for=/>response</a>.
52015213
"<a href=https://datatracker.ietf.org/doc/html/rfc7234#section-4.3.4>Sending a Validation Request</a>"
52025214
chapter of <cite>HTTP Caching</cite> [[!HTTP-CACHING]].
52035215

5204-
<li><p>Otherwise, set <var>response</var> to <var>storedResponse</var> and set
5205-
<var>response</var>'s <a for=response>cache state</a> to "<code>local</code>".
5216+
<li><p>Otherwise, set <var>actualResponse</var> to <var>storedResponse</var> and set
5217+
<var>actualResponse</var>'s <a for=response>cache state</a> to "<code>local</code>".
52065218
</ol>
52075219
</ol>
52085220
</ol>
@@ -5212,9 +5224,9 @@ steps. They return a <a for=/>response</a>.
52125224
<var>fetchParams</var>.
52135225

52145226

5215-
<!-- If response is still null, we require a forwarded request. -->
5227+
<!-- If actualResponse is still null, we require a forwarded request. -->
52165228
<li>
5217-
<p>If <var>response</var> is null, then:
5229+
<p>If <var>actualResponse</var> is null, then:
52185230

52195231
<ol>
52205232
<li><p>If <var>httpRequest</var>'s <a for=request>cache mode</a> is
@@ -5243,19 +5255,19 @@ steps. They return a <a for=/>response</a>.
52435255

52445256
<p class="note">This updates the stored response in cache as well.
52455257

5246-
<li><p>Set <var>response</var> to <var>storedResponse</var>.
5258+
<li><p>Set <var>actualResponse</var> to <var>storedResponse</var>.
52475259

52485260
<li><p>Set <var>response</var>'s <a for=response>cache state</a> to "<code>validated</code>".
52495261

52505262
<li><p><a for=/>Update timing info from stored response</a> given <var>fetchParams</var>'s
5251-
<a for="fetch params">timing info</a> and <var>response</var>.
5263+
<a for="fetch params">timing info</a> and <var>actualResponse</var>.
52525264
</ol>
52535265

52545266
<li>
5255-
<p>If <var>response</var> is null, then:
5267+
<p>If <var>actualResponse</var> is null, then:
52565268

52575269
<ol>
5258-
<li><p>Set <var>response</var> to <var>forwardResponse</var>.
5270+
<li><p>Set <var>actualResponse</var> to <var>forwardResponse</var>.
52595271

52605272
<li>
52615273
<p>Store <var>httpRequest</var> and <var>forwardResponse</var> in <var>httpCache</var>, as per
@@ -5270,17 +5282,17 @@ steps. They return a <a for=/>response</a>.
52705282
</ol>
52715283
</ol>
52725284

5273-
<li><p>Set <var>response</var>'s <a for=response>URL list</a> to a <a for=list>clone</a> of
5285+
<li><p>Set <var>actualResponse</var>'s <a for=response>URL list</a> to a <a for=list>clone</a> of
52745286
<var>httpRequest</var>'s <a for=request>URL list</a>.
52755287

52765288
<li><p>If <var>httpRequest</var>'s <a for=request>header list</a> <a for="header list">contains</a>
5277-
`<code>Range</code>`, then set <var>response</var>'s <a for=response>range-requested flag</a>.
5289+
`<code>Range</code>`, then set <var>actualResponse</var>'s <a for=response>range-requested flag</a>.
52785290

52795291
<li><p>Set <var>response</var>'s <a for=response>request-includes-credentials</a> to
52805292
<var>includeCredentials</var>.
52815293

52825294
<li>
5283-
<p>If <var>response</var>'s <a for=response>status</a> is 401, <var>httpRequest</var>'s
5295+
<p>If <var>actualResponse</var>'s <a for=response>status</a> is 401, <var>httpRequest</var>'s
52845296
<a for=request>response tainting</a> is not "<code>cors</code>", <var>includeCredentials</var> is
52855297
true, and <var>request</var>'s <a for=request>window</a> is an <a>environment settings object</a>,
52865298
then:
@@ -5311,21 +5323,26 @@ steps. They return a <a for=/>response</a>.
53115323

53125324
<li><p>Let <var>username</var> and <var>password</var> be the result of prompting the end user
53135325
for a username and password, respectively, in <var>request</var>'s
5314-
<a for=request>window</a>.
5326+
<a for=request>window</a>. If a username and password cannot be obtained from the end user,
5327+
set <var>response</var> to an <a>opaque-auth filtered response</a> whose
5328+
<a for="filtered response">internal response</a> is <var>actualResponse</var>. Otherwise:
5329+
5330+
<ol>
5331+
<li><p><a>Set the username</a> given <var>request</var>'s <a for=request>current URL</a> and
5332+
<var>username</var>.
53155333

5316-
<li><p><a>Set the username</a> given <var>request</var>'s <a for=request>current URL</a> and
5317-
<var>username</var>.
5334+
<li><p><a>Set the password</a> given <var>request</var>'s <a for=request>current URL</a> and
5335+
<var>password</var>.
53185336

5319-
<li><p><a>Set the password</a> given <var>request</var>'s <a for=request>current URL</a> and
5320-
<var>password</var>.
5337+
<li><p>Set <var>actualResponse</var> to the result of running <a>HTTP-network-or-cache fetch</a> given
5338+
<var>fetchParams</var> and true.
5339+
</ol>
53215340
</ol>
53225341

5323-
<li><p>Set <var>response</var> to the result of running <a>HTTP-network-or-cache fetch</a> given
5324-
<var>fetchParams</var> and true.
53255342
</ol>
53265343

53275344
<li>
5328-
<p>If <var>response</var>'s <a for=response>status</a> is 407, then:
5345+
<p>If <var>actualResponse</var>'s <a for=response>status</a> is 407, then:
53295346

53305347
<ol>
53315348
<li><p>If <var>request</var>'s <a for=request>window</a> is
@@ -5340,14 +5357,21 @@ steps. They return a <a for=/>response</a>.
53405357
<li>
53415358
<p>Prompt the end user as appropriate in <var>request</var>'s
53425359
<a for=request>window</a> and store the result as a
5343-
<a>proxy-authentication entry</a>. [[!HTTP-AUTH]]
5360+
<a>proxy-authentication entry</a>. [[!HTTP-AUTH]] If the user cannot be prompted,
5361+
set <var>response</var> to an <a>opaque-auth filtered response</a> whose
5362+
<a for="filtered response">internal response</a> is <var>actualResponse</var>. Otherwise:
5363+
5364+
<ol>
5365+
<li><p>Set <var>actualResponse</var> to the result of running <a>HTTP-network-or-cache fetch</a> given
5366+
<var>fetchParams</var>.
5367+
</ol>
53445368

53455369
<p class=note>Remaining details surrounding proxy authentication are defined by HTTP.
53465370

5347-
<li><p>Set <var>response</var> to the result of running <a>HTTP-network-or-cache fetch</a> given
5348-
<var>fetchParams</var>.
53495371
</ol>
53505372

5373+
<li>If <var>response</var> is null, set <var>response</var> to <var>actualResponse</var>.
5374+
53515375
<li>
53525376
<p>If all of the following are true
53535377

@@ -7401,7 +7425,7 @@ dictionary ResponseInit {
74017425
HeadersInit headers;
74027426
};
74037427

7404-
enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };
7428+
enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect", "opaqueauth" };
74057429
</pre>
74067430

74077431
<p>A {{Response}} object has an associated

0 commit comments

Comments
 (0)