diff --git a/fetch.bs b/fetch.bs index c4c2ff47c..47093bc87 100644 --- a/fetch.bs +++ b/fetch.bs @@ -572,7 +572,10 @@ uses the more colloquial term "header". [[HTTP]] headers. It is initially « ».

A header list is essentially a specialized multimap: an ordered list of -key-value pairs with potentially duplicate keys. +key-value pairs with potentially duplicate keys. Since headers other than `Set-Cookie` +are always combined when exposed to client-side JavaScript, implementations could choose a more +efficient representation, as long as they also support an associated data structure for +`Set-Cookie` headers.

To @@ -891,12 +894,33 @@ directly. Use get, decode, and split instead.

For each name of names:

    -
  1. Let value be the result of getting name - from list. +

  2. +

    If name is `set-cookie`, then: + +

      +
    1. Let values be a list of all values of + headers in list whose name is a + byte-case-insensitive match for name, in order. + +

    2. +

      For each value of values: + +

        +
      1. Append (name, value) to headers. +

      +
    -
  3. Assert: value is non-null. +

  4. +

    Otherwise: + +

      +
    1. Let value be the result of getting name + from list. -

    2. Append (name, value) to headers. +

    3. Assert: value is non-null. + +

    4. Append (name, value) to headers. +

  • Return headers. @@ -6498,20 +6522,13 @@ interface Headers { undefined append(ByteString name, ByteString value); undefined delete(ByteString name); ByteString? get(ByteString name); + sequence<ByteString> getSetCookie(); boolean has(ByteString name); undefined set(ByteString name, ByteString value); iterable<ByteString, ByteString>; }; -

    Unlike a header list, a {{Headers}} object cannot represent more than one -`Set-Cookie` header. In a way this is problematic as unlike all other -headers `Set-Cookie` headers cannot be combined, but since `Set-Cookie` -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 -header list, as long as they also support an associated data structure for -`Set-Cookie` headers. -

    A {{Headers}} object has an associated header list (a header list), which is initially empty. This @@ -6556,6 +6573,9 @@ new Headers(meta2);

    Returns as a string the values of all headers whose name is name, separated by a comma and a space. +

    headers . getSetCookie() +

    Returns a list of the values for all headers whose name is `Set-Cookie`. +

    headers . has(name)

    Returns whether there is a header whose name is name. @@ -6722,6 +6742,19 @@ method steps are to append (name, value

  • +
    +

    The getSetCookie() method steps are: + +

      +
    1. If this's header list does not contain + `Set-Cookie`, then return « ». + +

    2. Return the values of all headers in this's + header list whose name is a byte-case-insensitive match + for `Set-Cookie`, in order. +

    +
    +

    The has(name) method steps are: