Module static_web_server::compression
source · Available on crate feature
compression
only.Expand description
Auto-compression module to compress responses body.
Structs
- A wrapper around any type that implements
Stream
to be compatible with async_compression’sStream
based encoders.
Constants
- Contains a fixed list of common text-based MIME types in order to apply compression.
Functions
- Create a wrapping handler that compresses the Body of a
hyper::Response
usinggzip
,deflate
,brotli
orzstd
if is specified in theAccept-Encoding
header, addingcontent-encoding: <coding>
to the Response’sHeaderMap
. It also provides the ability to apply compression for text-based MIME types only. - brotli
compression-brotli
- Given an optional existing encoding header, appends to the existing or creates a new one.
- deflate
compression-deflate
- Try to get the prefered
content-encoding
via theaccept-encoding
header. - gzip
compression-gzip
- zstd
compression-zstd