@@ -572,7 +572,10 @@ uses the more colloquial term "header". [[HTTP]]
572
572
<a for=/>headers</a> . It is initially « ».
573
573
574
574
<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.
576
579
577
580
<div algorithm>
578
581
<p> To
@@ -891,12 +894,33 @@ directly. Use <a for="header list">get, decode, and split</a> instead.
891
894
<p> <a for=list>For each</a> <var> name</var> of <var> names</var> :
892
895
893
896
<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>
896
912
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> .
898
919
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>
900
924
</ol>
901
925
902
926
<li><p> Return <var> headers</var> .
@@ -6498,20 +6522,13 @@ interface Headers {
6498
6522
undefined append(ByteString name, ByteString value);
6499
6523
undefined delete(ByteString name);
6500
6524
ByteString? get(ByteString name);
6525
+ sequence<ByteString> getSetCookie();
6501
6526
boolean has(ByteString name);
6502
6527
undefined set(ByteString name, ByteString value);
6503
6528
iterable<ByteString, ByteString>;
6504
6529
};
6505
6530
</pre>
6506
6531
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
-
6515
6532
<p> A {{Headers}} object has an associated
6516
6533
<dfn export for=Headers id=concept-headers-header-list>header list</dfn> (a
6517
6534
<a for=/>header list</a> ), which is initially empty. <span class=note> This
@@ -6556,6 +6573,9 @@ new Headers(meta2);
6556
6573
<dd><p> Returns as a string the values of all headers whose name is <var> name</var> , separated by a
6557
6574
comma and a space.
6558
6575
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
+
6559
6579
<dt><code><var> headers</var> . <a method for=Headers lt=has()>has</a> (<var> name</var> )</code>
6560
6580
<dd><p> Returns whether there is a header whose name is <var> name</var> .
6561
6581
@@ -6722,6 +6742,19 @@ method steps are to <a for=Headers>append</a> (<var>name</var>, <var>value</var>
6722
6742
</ol>
6723
6743
</div>
6724
6744
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
+
6725
6758
<div algorithm>
6726
6759
<p> The <dfn export for=Headers method><code>has(<var>name</var>)</code></dfn> method steps are:
6727
6760
0 commit comments