@@ -572,7 +572,10 @@ uses the more colloquial term "header". [[HTTP]]
572572<a for=/>headers</a> . It is initially « ».
573573
574574<p class=note> A <a for=/>header list</a> is essentially a specialized multimap: an ordered list of
575- key-value pairs with potentially duplicate keys.
575+ key-value pairs with potentially duplicate keys. Since headers other than `<code> Set-Cookie</code> `
576+ are always combined when exposed to client-side JavaScript, implementations could choose a more
577+ efficient representation, as long as they also support an associated data structure for
578+ `<code> Set-Cookie</code> ` headers.
576579
577580<div algorithm>
578581<p> To
@@ -891,12 +894,33 @@ directly. Use <a for="header list">get, decode, and split</a> instead.
891894 <p> <a for=list>For each</a> <var> name</var> of <var> names</var> :
892895
893896 <ol>
894- <li><p> Let <var> value</var> be the result of <a for="header list">getting</a> <var> name</var>
895- from <var> list</var> .
897+ <li>
898+ <p> If <var> name</var> is `<code> set-cookie</code> `, then:
899+
900+ <ol>
901+ <li><p> Let <var> values</var> be a list of all <a lt=value for=header>values</a> of
902+ <a for=/>headers</a> in <var> list</var> whose <a for=header>name</a> is a
903+ <a>byte-case-insensitive</a> match for <var> name</var> , in order.
904+
905+ <li>
906+ <p> <a for=list>For each</a> <var> value</var> of <var> values</var> :
907+
908+ <ol>
909+ <li><p> <a for=list>Append</a> (<var> name</var> , <var> value</var> ) to <var> headers</var> .
910+ </ol>
911+ </ol>
896912
897- <li><p> Assert: <var> value</var> is non-null.
913+ <li>
914+ <p> Otherwise:
915+
916+ <ol>
917+ <li><p> Let <var> value</var> be the result of <a for="header list">getting</a> <var> name</var>
918+ from <var> list</var> .
898919
899- <li><p> <a for=list>Append</a> (<var> name</var> , <var> value</var> ) to <var> headers</var> .
920+ <li><p> Assert: <var> value</var> is non-null.
921+
922+ <li><p> <a for=list>Append</a> (<var> name</var> , <var> value</var> ) to <var> headers</var> .
923+ </ol>
900924 </ol>
901925
902926 <li><p> Return <var> headers</var> .
@@ -6498,20 +6522,13 @@ interface Headers {
64986522 undefined append(ByteString name, ByteString value);
64996523 undefined delete(ByteString name);
65006524 ByteString? get(ByteString name);
6525+ sequence<ByteString> getSetCookie();
65016526 boolean has(ByteString name);
65026527 undefined set(ByteString name, ByteString value);
65036528 iterable<ByteString, ByteString>;
65046529};
65056530</pre>
65066531
6507- <p class=note> Unlike a <a for=/>header list</a> , a {{Headers}} object cannot represent more than one
6508- `<code> Set-Cookie</code> ` <a for=/>header</a> . In a way this is problematic as unlike all other
6509- headers `<code> Set-Cookie</code> ` headers cannot be combined, but since `<code> Set-Cookie</code> `
6510- headers are not exposed to client-side JavaScript this is deemed an acceptable compromise.
6511- Implementations could choose the more efficient {{Headers}} object representation even for a
6512- <a for=/>header list</a> , as long as they also support an associated data structure for
6513- `<code> Set-Cookie</code> ` headers.
6514-
65156532<p> A {{Headers}} object has an associated
65166533<dfn export for=Headers id=concept-headers-header-list>header list</dfn> (a
65176534<a for=/>header list</a> ), which is initially empty. <span class=note> This
@@ -6556,6 +6573,9 @@ new Headers(meta2);
65566573 <dd><p> Returns as a string the values of all headers whose name is <var> name</var> , separated by a
65576574 comma and a space.
65586575
6576+ <dt><code><var> headers</var> . <a method for=Headers lt=getSetCookie()>getSetCookie</a> ()</code>
6577+ <dd><p> Returns a list of the values for all headers whose name is `<code> Set-Cookie</code> `.
6578+
65596579 <dt><code><var> headers</var> . <a method for=Headers lt=has()>has</a> (<var> name</var> )</code>
65606580 <dd><p> Returns whether there is a header whose name is <var> name</var> .
65616581
@@ -6722,6 +6742,19 @@ method steps are to <a for=Headers>append</a> (<var>name</var>, <var>value</var>
67226742</ol>
67236743</div>
67246744
6745+ <div algorithm>
6746+ <p> The <dfn export for=Headers method><code>getSetCookie()</code></dfn> method steps are:
6747+
6748+ <ol>
6749+ <li><p> If <a>this</a> 's <a for=Headers>header list</a> <a for="header list">does not contain</a>
6750+ `<code> Set-Cookie</code> `, then return « ».
6751+
6752+ <li><p> Return the <a lt=value for=header>values</a> of all <a for=/>headers</a> in <a>this</a> 's
6753+ <a for=Headers>header list</a> whose <a for=header>name</a> is a <a>byte-case-insensitive</a> match
6754+ for `<code> Set-Cookie</code> `, in order.
6755+ </ol>
6756+ </div>
6757+
67256758<div algorithm>
67266759<p> The <dfn export for=Headers method><code>has(<var>name</var>)</code></dfn> method steps are:
67276760
0 commit comments