Search code examples
httphttp-headerscontent-lengthcontent-encodinghttp-content-length

HTTP header for decompressed length


When using Content-Encoding: gzip, Content-Length is the compressed, post-gzip-encoding size.

I want to add a header for the uncompressed, pre-gzip-encoding size. An embedded application will read this and preallocate a correctly sized buffer for the decoded data up front.

What should this header be? Is there any convention I can follow? Or shall I choose something kinda arbitrary, like X-Decoded-Content-Length?


Solution

  • There is no official specification for such a header.

    Looking around the Internet, the most common convention I could find is x-amz-decoded-content-length or x-decompressed-content-length, but even these have as few as 100s or 1000s of GitHub search results.