Safe Haskell | None |
---|
- data Response a = Response {
- responseStatus :: Status
- responseHeaders :: [Header]
- responseBody :: a
- readResponse :: Method -> Connection -> IO (Response BodyReader)
- readResponseWithLimit :: Limit -> Method -> Connection -> IO (Response BodyReader)
- parseStatusLine :: ByteString -> Maybe Status
- sendResponse :: (ByteString -> IO ()) -> Response BodyReader -> IO ()
- formatStatusLine :: Status -> ByteString
- determineResponseBodyType :: Method -> Status -> [Header] -> BodyType
Documentation
Response | |
|
readResponse :: Method -> Connection -> IO (Response BodyReader)Source
Same as readResponseWithLimit
with a Limit
of
defaultHeaderSizeLimit
.
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:
-
InvalidStatusLine
if status-line is malformed. -
HeaderTooLarge
if status-line and headers together exceed the specified sizeLimit
-
InvalidHeader
if status-line is missing or a header is malformed
parseStatusLine :: ByteString -> Maybe StatusSource
Parse status-line (see RFC 2616, Section 6.1).
sendResponse :: (ByteString -> IO ()) -> Response BodyReader -> IO ()Source
Send an HTTP response.
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).