Skip to content

Commit eb89fcd

Browse files
authored
Remove request's omit-Origin-header flag
Instead use the CORS flag and request’s method as indicators for when to include it. Tests: web-platform-tests/wpt#4299. Fixes #225 and fixes whatwg/xhr#31.
1 parent 686fdbf commit eb89fcd

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

‎fetch.bs‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,6 @@ provides a convenient way for standards to not have to set
918918
<a for=/>Request</a>'s <a for=request>origin</a> can be
919919
changed during redirects too.
920920

921-
<p>A <a for=/>request</a> has an associated
922-
<dfn export>omit-<code>Origin</code>-header flag</dfn>. Unless stated
923-
otherwise it is unset.
924-
925921
<p>A <a for=/>request</a> has an associated
926922
<dfn export for=request id=concept-request-referrer>referrer</dfn>, which is
927923
"<code>no-referrer</code>", "<code>client</code>", or a <a for=/>URL</a>. Unless stated otherwise it
@@ -1747,7 +1743,7 @@ of the `<code>Referer</code>` [sic] header that does not reveal a
17471743
<a for=url>path</a>. It is used for
17481744
all <a lt="HTTP fetch">HTTP fetches</a> whose <i>CORS flag</i> is
17491745
set as well as those where <a for=/>request</a>'s
1750-
<a for=request>method</a> is `<code>POST</code>`. Due to
1746+
<a for=request>method</a> neither `<code>GET</code>` nor `<code>HEAD</code>`. Due to
17511747
compatibility constraints it is not included in all
17521748
<a lt=fetch for=/>fetches</a>.
17531749
<!-- Ian Hickson told me Adam Barth researched that -->
@@ -1797,8 +1793,9 @@ performed, to ensure <a for=/>request</a>'s
17971793

17981794
<p>A <dfn export>CORS request</dfn> is an HTTP request that includes an
17991795
`<a http-header><code>Origin</code></a>` header. It cannot be reliably identified as particpating in
1800-
the <a>CORS protocol</a> as the `<a http-header><code>Origin</code></a>` header is sometimes
1801-
included for other purposes too.
1796+
the <a>CORS protocol</a> as the `<a http-header><code>Origin</code></a>` header is also included for
1797+
all <a for=/>requests</a> whose <a for=request>method</a> is neither `<code>GET</code>` nor
1798+
`<code>HEAD</code>`.
18021799

18031800
<p>A <dfn id=cors-preflight-request export>CORS-preflight request</dfn> is a <a>CORS request</a> that checks to see
18041801
if the <a>CORS protocol</a> is understood. It uses `<code>OPTIONS</code>` as
@@ -3126,10 +3123,11 @@ steps:
31263123
<!-- XXX ideally we have an easier way to convert something ASCII-safe into bytes
31273124
concept-as-bytes -->
31283125

3129-
<li><p>If <var>httpRequest</var>'s <a>omit-<code>Origin</code>-header flag</a> is unset,
3130-
<a for="header list">append</a> `<code>Origin</code>`/<var>httpRequest</var>'s
3131-
<a for=request>origin</a>, <a lt="ASCII serialization of an origin">serialized</a> and
3132-
<a>utf-8 encoded</a>, to <var>httpRequest</var>'s <a for=request>header list</a>.
3126+
<li><p>If the <i>CORS flag</i> is set or <var>httpRequest</var>'s <a for=request>method</a> is
3127+
neither `<code>GET</code>` nor `<code>HEAD</code>`, then <a for="header list">append</a>
3128+
`<code>Origin</code>`/<var>httpRequest</var>'s <a for=request>origin</a>,
3129+
<a lt="ASCII serialization of an origin">serialized</a> and <a>utf-8 encoded</a>, to
3130+
<var>httpRequest</var>'s <a for=request>header list</a>.
31333131
<!-- XXX concept-as-bytes -->
31343132

31353133
<li><p>If <var>httpRequest</var>'s <a for=request>header list</a> does
@@ -4601,8 +4599,6 @@ constructor must run these steps:
46014599
<a>current settings object</a>,
46024600
<a for=request>window</a> is <var>window</var>,
46034601
<a for=request>origin</a> is "<code>client</code>",
4604-
<a>omit-<code>Origin</code>-header flag</a> is <var>request</var>'s
4605-
<a>omit-<code>Origin</code>-header flag</a>,
46064602
<a for=request>referrer</a> is <var>request</var>'s
46074603
<a for=request>referrer</a>,
46084604
<a for=request>referrer policy</a> is
@@ -4633,8 +4629,6 @@ constructor must run these steps:
46334629
"<code>navigate</code>", then set it to "<code>same-origin</code>".
46344630
<!-- This works because we have reset request's client too. -->
46354631

4636-
<li><p>Unset <var>request</var>'s <a>omit-<code>Origin</code>-header flag</a>.
4637-
46384632
<li><p>Set <var>request</var>'s <a for=request>referrer</a> to
46394633
"<code>client</code>"
46404634

0 commit comments

Comments
 (0)