- From: Andreu Botella <notifications@github.com>
- Date: Wed, 18 Jan 2023 10:52:16 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1346/review/1254117507@github.com>
@andreubotella commented on this pull request. > -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 cannot be safely combined. Because +of this, there is some special handling for the `<code>Set-Cookie</code>` header in +the implementation of the {{Headers}} interface, just like in the HTTP spec. +`<code>Set-Cookie</code>` headers are not concatenated when they are returned from the {{Headers}} +iterator, and there is a +<code><var>headers</var> . <a method for=Headers lt=getSetCookie()>getSetCookie</a>()</code> method +to retrieve the list of all `<code>Set-Cookie</code>`, ordered and uncombined. This means that +specifically for this header, multiple tuples of the same name can be returned from the {{Headers}} +iterator. 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 Before this PR, header lists had to store `Set-Cookie` header values separately, since cookie parsing is a step in the HTTP-network fetch algorithm which uses header lists, but `Headers` objects could combine them. Now there is no difference in the handling of `Set-Cookie` between header lists and `Headers` objects. This note should therefore be rewritten, since now there is no "more efficient" representation for `Headers` that doesn't work for header lists. It should also probably be moved to the definition of header list. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1346#pullrequestreview-1254117507 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1346/review/1254117507@github.com>
Received on Wednesday, 18 January 2023 18:52:29 UTC