Safe Haskell | None |
---|---|
Language | Haskell98 |
Filter for compressing the Response
body.
- compressedResponseFilter :: (FilterMonad Response m, MonadPlus m, WebMonad Response m, ServerMonad m) => m String
- compressWithFilter :: FilterMonad Response m => (ByteString -> ByteString) -> String -> Bool -> m ()
- gzipFilter :: FilterMonad Response m => String -> Bool -> m ()
- deflateFilter :: FilterMonad Response m => String -> Bool -> m ()
- encodings :: GenParser Char st [(String, Maybe Double)]
Documentation
compressedResponseFilter Source
:: (FilterMonad Response m, MonadPlus m, WebMonad Response m, ServerMonad m) | |
=> m String | name of the encoding chosen |
reads the Accept-Encoding
header. Then, if possible
will compress the response body with methods gzip
or deflate
.
main = simpleHTTP nullConf $ do str <- compressedResponseFilter return $ toResponse ("This response compressed using: " ++ str)
:: FilterMonad Response m | |
=> (ByteString -> ByteString) | function to compress the body |
-> String | encoding to use for Content-Encoding header |
-> Bool | fallback to identity for SendFile |
-> m () |
Ignore the Accept-Encoding
header in the Request
and attempt to compress the body of the response using the supplied compressor.
We can not compress files being transfered using SendFile
. If
identity
is an allowed encoding, then just return the Response
unmodified. Otherwise we return "406 Not Acceptable".
see also: gzipFilter
and defaultFilter
:: FilterMonad Response m | |
=> String | encoding to use for Content-Encoding header |
-> Bool | fallback to identity for SendFile |
-> m () |
Ignore the Accept-Encoding
header in the Request
and attempt to compress the body of the response with gzip
.
calls compressWithFilter
using compress
.
see also: compressedResponseFilter
:: FilterMonad Response m | |
=> String | encoding to use for Content-Encoding header |
-> Bool | fallback to identity for SendFile |
-> m () |
Ignore the Accept-Encoding
header in the Request
and attempt compress the body of the response with zlib's
deflate
method
calls compressWithFilter
using compress
.
see also: compressedResponseFilter