Re: The case for Content-Unencoded-Length

> 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.
> 
> Best regards, Julian

I experimented with HEAD, and got some interesting results:

For this particular provider, the GET or HEAD responses do not carry ETag or Last-Modified headers. Though the URL looks fairly unique.
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.
Sometimes HEAD results in a 404 and I haven’t figured out when that’s the case.
They already put a non-standard X-Original-Content-Length header on the response which contains the information we need.

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 response is received. The only viable solution is a concurrent HEAD which can be expensive in HTTP/1. Automatically performing requests not initiated by the browser is also thorny. I think the easiest solution is to use the value in X-Original-Content-Length.

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

Guoye

Received on Tuesday, 21 July 2026 00:08:15 UTC