Re: [whatwg/fetch] Return a `content-encoding` header for resource timing and more (PR #1796)

@annevk commented on this pull request.



> @@ -6319,6 +6321,23 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
          <li><p>Let <var>codings</var> be the result of <a>extracting header list values</a> given
          `<code>Content-Encoding</code>` and <var>response</var>'s <a for=response>header list</a>.
 
+         <li><p>Let <var>filteredCoding</var> be "<code>unknown</code>".
+
+         <li><p>If <var>codings</var> is null, then set <var>filteredCoding</var> to the empty string.
+
+         <li><p>Otherwise, if <var>codings</var>'s <a for=list>size</a> is 2 or more, then set

```suggestion
         <li><p>Otherwise, if <var>codings</var>'s <a for=list>size</a> is greater than 1, then set
```

> +         <li><p>Let <var>filteredCoding</var> be "<code>unknown</code>".
+
+         <li><p>If <var>codings</var> is null, then set <var>filteredCoding</var> to the empty string.
+
+         <li><p>Otherwise, if <var>codings</var>'s <a for=list>size</a> is 2 or more, then set
+         <var>filteredCoding</var> to "<code>multiple</code>".
+
+         <li><p>Otherwise, if <var>codings</var>[0] is the empty string, or it is supported by the user agent,
+         and is a <a>byte-case-insensitive</a> match for an entry listed in the
+         <a href="https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding">
+         <cite>HTTP Content Coding Registry</cite></a> of [[!IANA-HTTP-PARAMS]], then set
+         <var>filteredCoding</var> to <var>codings</var>[0].
+
+         <li><p>Set <var>response</var>'s <a for=response>body info</a>'s
+         <a for="response body info">content encoding</a> to the result of
+         <a lt=byte-lowercased>byte-lowercasing</a>  <var>filteredCoding</var>.

```suggestion
         <a lt=byte-lowercased>byte-lowercasing</a> <var>filteredCoding</var>.
```

> +         <li><p>Otherwise, if <var>codings</var>[0] is the empty string, or it is supported by the user agent,
+         and is a <a>byte-case-insensitive</a> match for an entry listed in the
+         <a href="https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding">
+         <cite>HTTP Content Coding Registry</cite></a> of [[!IANA-HTTP-PARAMS]], then set
+         <var>filteredCoding</var> to <var>codings</var>[0].

I think it would be clearer if you did the lowercasing here. There's no reason to lowercase the other branches.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1796#pullrequestreview-2767613009
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1796/review/2767613009@github.com>

Received on Tuesday, 15 April 2025 09:51:57 UTC