wai-extra-3.0.19.1: Provides some basic WAI handlers and middleware.

Copyright | Michael Snoyman
License | BSD3
Maintainer | Michael Snoyman <michael@snoyman.com>
Stability | Unstable
Portability | portable
Safe Haskell | None
Language | Haskell2010

Network.Wai.Middleware.Gzip

Description

Automatic gzip compression of responses.

Synopsis

- gzip :: GzipSettings -> Middleware
- data GzipSettings
- gzipFiles :: GzipSettings -> GzipFiles
- data GzipFiles
  - = GzipIgnore
  - | GzipCompress
  - | GzipCacheFolder FilePath
  - | GzipPreCompressed GzipFiles
- gzipCheckMime :: GzipSettings -> ByteString -> Bool
- def :: Default a => a
- defaultCheckMime :: ByteString -> Bool

# Documentation

gzip :: GzipSettings -> Middleware #

Use gzip to compress the body of the response.

Analyzes the "Accept-Encoding" header from the client to determine if gzip is supported.

File responses will be compressed according to the `GzipFiles` setting.

data GzipSettings #

Instances

Default GzipSettings # | Use default MIME settings; do not compress files.
Methods def :: GzipSettings #

gzipFiles :: GzipSettings -> GzipFiles #

data GzipFiles #

Gzip behavior for files.

Constructors

GzipIgnore | Do not compress file responses.
GzipCompress | Compress files. Note that this may counteract zero-copy response optimizations on some platforms.
GzipCacheFolder FilePath | Compress files, caching them in some directory.
GzipPreCompressed GzipFiles | If we use compression then try to use the filename with ".gz" appended to it, if the file is missing then try next action Since: 3.0.17

Instances

Eq GzipFiles # |
Methods (==) :: GzipFiles -> GzipFiles -> Bool # (/=) :: GzipFiles -> GzipFiles -> Bool #
Read GzipFiles # |
Methods readsPrec :: Int -> ReadS GzipFiles # readList :: ReadS [GzipFiles] # readPrec :: ReadPrec GzipFiles # readListPrec :: ReadPrec [GzipFiles] #
Show GzipFiles # |
Methods showsPrec :: Int -> GzipFiles -> ShowS # show :: GzipFiles -> String # showList :: [GzipFiles] -> ShowS #

gzipCheckMime :: GzipSettings -> ByteString -> Bool #

def :: Default a => a #

The default value for this type.

defaultCheckMime :: ByteString -> Bool #

MIME types that will be compressed by default: `text/*`, `application/json`, `application/javascript`, `application/ecmascript`, `image/x-icon`.