Expand description
Response decompression.
Provides streaming decompression of response bodies based on
Content-Encoding headers. Supports gzip, deflate, brotli, and
zstd via feature-gated async-compression decoders.
§Policy
When automatic decompression is enabled (the default when any compression feature is compiled in), the client:
- Advertises supported encodings in
Accept-Encoding. - Decodes compressed response bodies transparently.
- Strips
Content-EncodingandContent-Lengthfrom decoded response headers.
If the server responds with an unsupported encoding and automatic
decompression is enabled, an Error::UnsupportedContentEncoding
is returned. If decompression is disabled, the raw bytes pass
through unchanged.
Structs§
- Decompression
Limit - Limits applied during response body decompression.
Enums§
- Content
Coding - A content coding identifier.
Functions§
- accept_
encoding_ value - Generate the
Accept-Encodingheader value for the compiled-in features. ReturnsNoneif no compression features are enabled. - decompress_
buffered - Decompress a fully buffered byte slice using synchronous decoding.
- decompress_
stream - Wrap a byte stream in decompression decoders based on the
Content-Encodingheader. - validate_
content_ encodings - Check whether a
Content-Encodingheader value contains only supported encodings.