bsb-http-chunked-0.0.0.4: Chunked HTTP transfer encoding for bytestring builders

Safe HaskellNone
LanguageHaskell98

Data.ByteString.Builder.HTTP.Chunked

Description

HTTP/1.1 chunked transfer encoding as defined in RFC 7230 Section 4.1

Synopsis

Documentation

chunkedTransferEncoding :: Builder -> Builder Source #

Transform a builder such that it uses chunked HTTP transfer encoding.

>>> :set -XOverloadedStrings
>>> import Data.ByteString.Builder as B
>>> let f = B.toLazyByteString . chunkedTransferEncoding . B.lazyByteString
>>> f "data"
"004\r\ndata\r\n"
>>> f ""
""

Note: While for many inputs, the bytestring chunks that can be obtained from the output via toChunks . toLazyByteString each form a chunk in the sense of RFC 7230 Section 4.1, this correspondence doesn't hold in general.

chunkedTransferTerminator :: Builder Source #

The zero-length chunk 0\r\n\r\n signalling the termination of the data transfer.