Expand description
The two framings around a DEFLATE stream: gzip (RFC 1952) and zlib (RFC 1950).
Both wrap the same raw stream from deflate.rs; they differ only in the
header and which checksum ends them. HTTP names them gzip and —
confusingly — deflate: despite the name, Content-Encoding: deflate is
the zlib format in practice (RFC 9110 §8.4.1.2 says so, and every browser
and server agrees), so the middleware uses zlib_compress and
zlib_decompress for it, never the raw stream.
Functions§
- compress
- Wrap
inputas a single gzip member. - decompress
- Unwrap and inflate gzip data, with output capped at
deflate::DEFAULT_MAX_OUTPUT. - decompress_
with_ limit - Unwrap and inflate gzip data, refusing to produce more than
max_outbytes in total. - zlib_
compress - Wrap
inputin the zlib format — what HTTP callsdeflate. - zlib_
decompress - Unwrap and inflate zlib data, with output capped at
deflate::DEFAULT_MAX_OUTPUT. - zlib_
decompress_ with_ limit - Unwrap and inflate zlib data, refusing to produce more than
max_outbytes. The Adler-32 trailer is verified, and a stream that asks for a preset dictionary (FDICT) is rejected: nothing in HTTP defines one.