http-kit-0.4.0: A low-level HTTP library

Safe HaskellNone

Network.HTTP.Toolkit.Response

Synopsis

Documentation

data Response a Source

Constructors

Response 

Instances

Functor Response 
Eq a => Eq (Response a) 
Show a => Show (Response a) 

readResponseWithLimit :: Limit -> Method -> Connection -> IO (Response BodyReader)Source

Read response from provided connection.

The corresponding request Method has to be specified so that the body length can be determined (see RFC 2616, Section 4.4).

Throws:

simpleResponse :: (ByteString -> IO ()) -> Status -> [Header] -> ByteString -> IO ()Source

Send a simple HTTP response. The provided ByteString is used as the message body. A suitable Content-Length header is added to the specified list of headers.

Note: The first argument to this function is used to send the data. For space efficiency it may be called multiple times.

sendResponse :: (ByteString -> IO ()) -> Response BodyReader -> IO ()Source

Send an HTTP response.

Note: The first argument to this function is used to send the data. For space efficiency it may be called multiple times.

formatStatusLine :: Status -> ByteStringSource

Format status-line.

determineResponseBodyType :: Method -> Status -> [Header] -> BodyTypeSource

Determine the message BodyType from a given Method, Status, and list of message headers (as of RFC 2616, Section 4.4).