-
In writer for example gzip, there is a size value indicating the uncompressed size. However, in situation like building a gzip middleware, the compressed size is also important for the Content-Length header. I struggled for a while to find the way to get the size, but failed. |
Beta Was this translation helpful? Give feedback.
Answered by
klauspost
Mar 28, 2024
Replies: 1 comment 2 replies
-
@slhmy The gzip size is 32 bits, so it wraps at 4GB. Also you can append separate gzip files in which case you need to read each (and you can really find each without decoding)- so in practical terms it is not that useful. It is the final 4 bytes of the gzip stored in little endian. gzhttp removes Content-Size instead, since it will do streaming writes. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
slhmy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@slhmy The gzip size is 32 bits, so it wraps at 4GB. Also you can append separate gzip files in which case you need to read each (and you can really find each without decoding)- so in practical terms it is not that useful.
It is the final 4 bytes of the gzip stored in little endian.
gzhttp removes Content-Size instead, since it will do streaming writes.