diff --git a/fetch.bs b/fetch.bs index 92c09c30b..be793b6b0 100644 --- a/fetch.bs +++ b/fetch.bs @@ -732,12 +732,34 @@ a header list list, run these steps:

For each name in names:

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

  2. +

    If name is equal to `set-cookie`, then:

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

    2. +
    3. +

      For each value of values:

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

      +
    +
  3. +
  4. +

    Else:

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

    2. Assert: value is not null. +

    3. Assert: value is not null. -

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

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

    +
  • Return headers. @@ -5966,12 +5988,17 @@ interface Headers { }; -

    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 +

    Unlike a header list, a {{Headers}} object combines the values of +multiple headers of the same name into a single header value. This is problematic for the +`Set-Cookie` 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 +`Set-Cookie`. This can be problematic for server-side runtimes that do expose this +header. Because of this there is some special handling for the `Set-Cookie` header in +the implementation of the `Headers` interface: +`Set-Cookie` 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 may be +returned. 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