gzip -is:module
Generic zip controlled by a function with type-specific branches
Gzip compression with default parameters.
Use gzip to compress the body of the response.
Twin map for monadic transformation
Twin map for transformation
The gzip format uses a header with a checksum and some optional
meta-data about the compressed file. It is intended primarily for
compressing individual files but is also sometimes used for network
protocols such as HTTP. The format is described in detail in RFC #1952
http://www.ietf.org/rfc/rfc1952.txt
This is not a format as such. It enabled zlib or gzip decoding with
automatic header detection. This only makes sense for decompression.
Decide which files to compress based on MIME type
The
ByteString is the value of the "Content-Type" response
header and will default to
False if the header is missing.
E.g. if you'd only want to compress
json data, you might
define your own function as follows:
myCheckMime mime = mime == "application/json"
Gzip behavior for files
Only applies to
ResponseFile (
responseFile) responses.
So any streamed data will be compressed based solely on the response
headers having the right "Content-Type" and "Content-Length". (which
are checked with
gzipCheckMime and
gzipSizeThreshold,
respectively)
Skip compression when the size of the response body is below this
amount of bytes (default: 860.)
Setting this option to less than 150 will actually increase
the size of outgoing data if its original size is less than 150
bytes.
This will only skip compression if the response includes a
"Content-Length" header AND the length is less than this
threshold.
Takes the ETag response header into consideration when caching files
in the given folder. If there's no ETag header, this setting is
equivalent to
GzipCacheFolder.
N.B. Make sure the
gzip middleware is applied before any
Middleware that will set the ETag header.
Compress files, caching the compressed version in the given directory.