Re: The case for Content-Unencoded-Length

Am 21.07.2026 um 02:08 schrieb Guoye Zhang:
> 
>> On Jul 19, 2026, at 05:17, Julian Reschke <julian.reschke@gmx.de> wrote:
>>
>> Am 16.07.2026 um 10:45 schrieb Guoye Zhang:
>>> Hi,
>>> We recently enabled zstd support in Safari and received complaints 
>>> that downloads from a popular cloud storage website are no longer 
>>> showing progress and no longer resumable. Turns out that they are 
>>> doing streaming zstd compression so they don’t know the Content-Length.
>>> Are there interests in standardizing a new header field Content- 
>>> Unencoded-Length (similar to Unencoded-Digest)? I'm also interested 
>>> in discussing a new range unit unencoded-bytes for download resumption.
>>> Thanks,
>>> Guoye Zhang
>>
>> How about:
>>
>>  HEAD /file.bin HTTP/1.1
>>  Host: example.com
>>  Accept-Encoding: identity
>>
>> ->
>>
>>  HTTP/1.1 200 OK
>>  Content-Length: 5242880
>>
>> This would be the non-encoded length.
>>
>> Yes, one additional round trip (but HEAD can be done after starting 
>> the download), race conditions can be avoided with ETags.

Actually, the Etag wouldn't help because it's for a different 
representation. (My fault)

>> Best regards, Julian
> 
> I experimented with HEAD, and got some interesting results:
> 
>  1. For this particular provider, the GET or HEAD responses do not carry
>     ETag or Last-Modified headers. Though the URL looks fairly unique.

Either an oversight, or the server really does not know.

>  2. Even if I add Accept-Encoding: zstd to the HEAD request, the HEAD
>     response does not use Content-Encoding and always contains a valid
>     Content-Length.

"valid" as in "non-encoded", I assume? FWIW, that Content-Length (for 
the zstd encoded content) would not be what you need.

>  3. Sometimes HEAD results in a 404 and I haven’t figured out when
>     that’s the case.

That sounds like a bug.

>  4. They already put a non-standard X-Original-Content-Length header on
>     the response which contains the information we need.

OTOH, the server seems to have a few serious problems, so I have some 
doubts that it is well maintained.

Do we actually know what kind of server this is?

I asked ChatGPT to do some research 
(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?

> response is received. The only viable solution is a concurrent HEAD 

You mean, you don't want to do the extra HEAD if you don't have to? Ok.

> which can be expensive in HTTP/1. Automatically performing requests not 
> initiated by the browser is also thorny. I think the easiest solution is 

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?)

b) How would that request "not be performed by the browser"??? If it's 
not the browser, who else would do it?

> to use the value in X-Original-Content-Length.

(you might want to test/measure how many servers are returning this, and 
whether it always has the information that you expect)

> Maybe this is a topic we can bring to a working group meeting.
Sure.

Thought: for a server as the one mentioned above, how likely is it that 
it would be changed to return a new response field?

Best regards, Julian

Received on Tuesday, 21 July 2026 14:20:48 UTC