- From: Anne van Kesteren <notifications@github.com>
- Date: Mon, 01 Nov 2021 02:36:10 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1346/review/794004745@github.com>
@annevk commented on this pull request. > @@ -5960,18 +5977,24 @@ interface Headers { undefined append(ByteString name, ByteString value); undefined delete(ByteString name); ByteString? get(ByteString name); + sequence<ByteString> getSetCookie(); ```suggestion sequence<ByteString> getSetCookie(); ``` > @@ -732,12 +732,29 @@ a <a for=/>header list</a> <var>list</var>, run these steps: <p><a for=list>For each</a> <var>name</var> in <var>names</var>: <ol> - <li><p>Let <var>value</var> be the result of <a for="header list">getting</a> <var>name</var> - from <var>list</var>. + <li><p>If <var>name</var> is "<code>set-cookie</code>", then: + + <ol> + <li><p>Let <var>values</var> be a list of all <a for=/>headers</a> in <var>list</var> whose + <a for=header>name</a> is a <a>byte-case-insensitive</a> match for <var>name</var>, in order. be a list of all values of headers*? > @@ -732,12 +732,29 @@ a <a for=/>header list</a> <var>list</var>, run these steps: <p><a for=list>For each</a> <var>name</var> in <var>names</var>: <ol> - <li><p>Let <var>value</var> be the result of <a for="header list">getting</a> <var>name</var> - from <var>list</var>. + <li><p>If <var>name</var> is "<code>set-cookie</code>", then: ```suggestion <li><p>If <var>name</var> is `<code>set-cookie</code>`, then: ``` > @@ -6018,6 +6041,9 @@ new Headers(meta2); <dd><p>Returns as a string the values of all headers whose name is <var>name</var>, separated by a comma and a space. + <dt><code><var>headers</var> . <a method for=Headers lt=getSetCookie()>getSetCookie</a>()</code> + <dd><p>Returns a list of the values for all headers whose name is <code>set-cookie</code>. ```suggestion <dd><p>Returns a list of the values for all headers whose name is `<code>Set-Cookie</code>`. ``` > @@ -6160,6 +6186,14 @@ method steps are to <a for=Headers>append</a> (<var>name</var>, <var>value</var> <a for=Headers>header list</a>. </ol> +<p>The <dfn export for=Headers method><code>getSetCookie()</code></dfn> method steps are: + +<ol> + <li><p>Return <a lt=value for=header>values</a> of all <a for=/>headers</a> in <a>this</a>'s + <a for=Headers>header list</a> whose <a for=header>name</a> is a <a>byte-case-insensitive</a> match + for `<code>set-cookie</code>`, in order. +</ol> This needs a step that returns an empty list when there are no such headers. The second step should say "Return the values ... Set-Cookie ..." (in particular "the" and casing). > -`<code>Set-Cookie</code>` <a for=/>header</a>. In a way this is problematic as unlike all other -headers `<code>Set-Cookie</code>` headers cannot be combined, but since `<code>Set-Cookie</code>` -headers are not exposed to client-side JavaScript this is deemed an acceptable compromise. -Implementations could choose the more efficient {{Headers}} object representation even for a -<a for=/>header list</a>, as long as they also support an associated data structure for +<p class=note>Unlike a <a for=/>header list</a>, a {{Headers}} object combines the values of +multiple headers of the same name into a single header value. This is problematic for the +`<code>Set-Cookie</code>` header, as unlike all other headers it can not be safely combined. For +client-side JavaScript this is not very problematic, as the platform never exposes +`<code>Set-Cookie</code>`. This can be problematic for server-side runtimes that do expose this +header. Because of this there is some special handling for the `<code>Set-Cookie</code>` header in +the implementation of the {{Headers}} interface: `<code>Set-Cookie</code>` headers are not +concatenated when they are returned from the {{Headers}} iterator. This means that specifically for +this header, multiple tuples of the same name can be returned. Implementations could choose the more +efficient {{Headers}} object representation even for a <a for=/>header list</a>, as long as they +also support an associated data structure for `<code>Set-Cookie</code>` headers. It's not true that client-side JavaScript never exposes Set-Cookie. That's only true in the general case. So I don't think we need the client-side vs server-side exposition here. We should note that we special-case Set-Cookie, just like HTTP. And that this alternative representation could be used for header lists in theory. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1346#pullrequestreview-794004745
Received on Monday, 1 November 2021 09:36:23 UTC