Skip to content

Commit

Permalink
Add Set-Cookie as a forbidden header name
Browse files Browse the repository at this point in the history
Tests: web-platform-tests/wpt#34424.

Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
  • Loading branch information
lucacasonato and annevk committed Jun 28, 2022
1 parent 90a4d32 commit 50d77e6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ is a <a>byte-case-insensitive</a> match for one of
<li>`<code>Keep-Alive</code>`
<li>`<a http-header><code>Origin</code></a>`
<li>`<code>Referer</code>`
<li>`<code>Set-Cookie</code>`
<li>`<code>TE</code>`
<li>`<code>Trailer</code>`
<li>`<code>Transfer-Encoding</code>`
Expand All @@ -1025,10 +1026,18 @@ is a <a>byte-case-insensitive</a> match for one of
<p>or a <a for=/>header name</a> that when <a>byte-lowercased</a>
<a for="byte sequence">starts with</a> `<code>proxy-</code>` or `<code>sec-</code>`.

<p class=note>These are forbidden so the user agent remains in full control over them.
<a for=/>Header names</a> starting with `<code>Sec-</code>` are reserved to allow new
<a for=/>headers</a> to be minted that are safe from APIs using <a for=/>fetch</a> that allow
control over <a for=/>headers</a> by developers, such as {{XMLHttpRequest}}. [[XHR]]
<div class=note>
<p>These are forbidden so the user agent remains in full control over them.

<p><a for=/>Header names</a> starting with `<code>Sec-</code>` are reserved to allow new
<a for=/>headers</a> to be minted that are safe from APIs using <a for=/>fetch</a> that allow
control over <a for=/>headers</a> by developers, such as {{XMLHttpRequest}}. [[XHR]]

<p>The `<code>Set-Cookie</code>` header is semantically a response header, so it is not useful on
requests. Because `<code>Set-Cookie</code>` headers cannot be combined, they require more complex
handling in the {{Headers}} object. It is forbidden here to avoid leaking this complexity into
requests.
</div>

<p>A <dfn export>forbidden response-header name</dfn> is a <a for=/>header name</a> that is a
<a>byte-case-insensitive</a> match for one of:
Expand Down

0 comments on commit 50d77e6

Please sign in to comment.