Re: The case for Content-Unencoded-Length



> On Jul 22, 2026, at 2:46 AM, Julian Reschke <julian.reschke@gmx.de> wrote:
> 
> Am 21.07.2026 um 21:53 schrieb Guoye Zhang:
>> ...
>> The server header is nginx, there are also a Via header from Google and an envoy header.
>> ...
> 
> We should find out who's setting the response field and why HEAD is broken.
> 
>>> I asked ChatGPT to do some research (https://chatgpt.com/ share/6a5f7d11-badc-83eb-b575-e10c2cbd2178 <https://chatgpt.com/ share/6a5f7d11-badc-83eb-b575-e10c2cbd2178>) and the original use case may have been slightly different (filtering, content rewriting...).
>>> 
>>>> Preflight with HEAD is not possible since browser downloads are triggered by a Content-Disposition response header and not known ahead of time. We also don’t know if a Content-Encoding is used until the
>>> 
>>> a) Content-Disposition: not always, right?
>>> 
>>> b) Why is that a problem? The user agent decides to GET the contents; why can't it do a preflight request?
>> It’s not feasible to preflight all browser GET requests with HEAD.
> 
> Did anybody ask for *all*?

Under which conditions do you propose to preflight GET with HEAD? As discussed, browsers don’t know 1. If a request will result in a download prior to receiving the response Content-Disposition, 2. Whether the response body will be encoded.
> 
>> ...
>>> a) Do we need to optimize for HTTP/1.1? (There, I said it). Re expensive: the user agent would need an additional (short-lived) connection. Is that a problem when only needed for a somewhat long running download? (Otherwise you wouldn't need a progress indicator, right?)
>> I agree that we don’t need to optimize for HTTP/1. However, this is a change that could potentially double the number of connections browsers make to the server which will incur additional costs.
> 
> No. Not for all; just for some downloads.

If they are live compressing all downloads using zstd and serving the content through HTTP/1, in which case could the extra connection be avoided if we do a concurrent HEAD? I guess we can implement some sort of delay in case the file is small. Or maybe the connection can be reused from a different download if the user started multiple. Overall I think and I hope you agree that the complexity of this approach is way higher than an additional header field.
> 
>>> b) How would that request "not be performed by the browser"??? If it's not the browser, who else would do it?
>> Yeah I need to clarify my statement a bit. The browser calls our library to perform HTTP requests, and there are WHATWG specs on how to do it which they do not want to deviate from. It will require more deliberations if the HTTP library starts doing more requests than what the browser initiated. This topic also came up when discussing how to support resumable uploads in browsers.
> 
> Well, we should discuss this with AvK then.
> 
>> ...
>> That I don’t know, but it seems like a trivial change for them.
>> ...
> 
> Yes, but only when it is maintained in some way.

We have a high degree of confidence that the specific service provider is maintained and will be responsive to the changes we propose.
> 
> Best regards, Julian

Guoye

Received on Wednesday, 22 July 2026 17:04:54 UTC