wai-extra-3.0.21.0: 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 Source #

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 Source #

Instances

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

gzipFiles :: GzipSettings -> GzipFiles Source #

data GzipFiles Source #

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

gzipCheckMime :: GzipSettings -> ByteString -> Bool Source #

def :: Default a => a #

The default value for this type.

defaultCheckMime :: ByteString -> Bool Source #

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