HTTP library for HTTP server.
- receive :: Handle -> IO (Maybe Request)
- respond :: Handle -> Version -> Persist -> Response -> IO ()
- data Request
- reqMethod :: Request -> Method
- reqURI :: Request -> URI
- reqVersion :: Request -> Version
- reqFields :: Request -> Fields
- reqBody :: Request -> Maybe ByteString
- reqLength :: Request -> Integer
- data Response
- rspStatus :: Response -> Status
- rspFields :: Response -> Fields
- rspBody :: Response -> Maybe ByteString
- rspLength :: Response -> Maybe Integer
- rspLogMsg :: Response -> String
- makeResponse :: Status -> [(FieldKey, FieldValue)] -> Response
- makeResponse2 :: Status -> Maybe ByteString -> Maybe Integer -> [(FieldKey, FieldValue)] -> Response
- makeResponse3 :: Status -> Maybe ByteString -> Maybe Integer -> Fields -> Response
- class Comm a
- data Fields
- lookupField :: Comm a => FieldKey -> a -> Maybe FieldValue
- lookupField' :: FieldKey -> Fields -> Maybe FieldValue
- insertField :: Comm a => FieldKey -> FieldValue -> a -> a
- insertField' :: FieldKey -> FieldValue -> Fields -> Fields
- receiveFields :: Handle -> IO Fields
- data Method
- toMethod :: ByteString -> Method
- data Version
- toVersion :: ByteString -> Version
- fromVersion :: Version -> ByteString
- data Status
- = Continue
- | SwitchingProtocols
- | OK
- | Created
- | Accepted
- | NonAuthoritativeInformation
- | NoContent
- | ResetContent
- | PartialContent Integer Integer
- | MultipleChoices
- | MovedPermanently
- | Found
- | SeeOther
- | NotModified
- | UseProxy
- | TemporaryRedirect
- | BadRequest
- | Unauthorized
- | PaymentRequired
- | Forbidden
- | NotFound
- | MethodNotAllowed
- | NotAcceptable
- | ProxyAuthenticationRequired
- | RequestTimeout
- | Conflict
- | Gone
- | LengthRequired
- | PreconditionFailed
- | RequestEntityTooLarge
- | RequestURITooLarge
- | UnsupportedMediaType
- | RequestedRangeNotSatisfiable
- | ExpectationFailed
- | InternalServerError
- | NotImplemented
- | BadGateway
- | ServiceUnavailable
- | GatewayTimeout
- | HTTPVersionNotSupported
- toStatus :: ByteString -> Maybe Status
- fromStatus :: Status -> ByteString
- badStatus :: Status -> Bool
- data Persist
- = Close
- | Keep
- | PerUnknown
- toPersist :: ByteString -> Persist
- fromPersist :: Persist -> ByteString
- data ServerException
- data FieldKey
- type FieldValue = ByteString
- toFieldKey :: ByteString -> FieldKey
- fromFieldKey :: FieldKey -> ByteString
- type CT = ByteString
- textHtml :: CT
- selectContentType :: String -> CT
Documentation
reqVersion :: Request -> VersionSource
HTTP version
reqBody :: Request -> Maybe ByteStringSource
Entity body if exists
rspBody :: Response -> Maybe ByteStringSource
makeResponse :: Status -> [(FieldKey, FieldValue)] -> ResponseSource
A function to make Response
.
makeResponse2 :: Status -> Maybe ByteString -> Maybe Integer -> [(FieldKey, FieldValue)] -> ResponseSource
A function to make Response
.
makeResponse3 :: Status -> Maybe ByteString -> Maybe Integer -> Fields -> ResponseSource
A function to make Response
.
lookupField :: Comm a => FieldKey -> a -> Maybe FieldValueSource
Looking up the HTTP field value.
lookupField' :: FieldKey -> Fields -> Maybe FieldValueSource
Looking up the HTTP field value.
insertField :: Comm a => FieldKey -> FieldValue -> a -> aSource
Inserting the HTTP field.
insertField' :: FieldKey -> FieldValue -> Fields -> FieldsSource
Inserting the HTTP field.
receiveFields :: Handle -> IO FieldsSource
Parsing HTTP header from Handle
.
This function is useful to parse CGI output.
Methods of HTTP.
toMethod :: ByteString -> MethodSource
toVersion :: ByteString -> VersionSource
Status of HTTP.
fromStatus :: Status -> ByteStringSource
The type for persist connection or not
toPersist :: ByteString -> PersistSource
data ServerException Source
Exceptions for Web server
Field key of HTTP header.
type FieldValue = ByteStringSource
Field value of HTTP header.
toFieldKey :: ByteString -> FieldKeySource
Converting field key to FieldKey
.
fromFieldKey :: FieldKey -> ByteStringSource
Converting FieldKey
to field key.
type CT = ByteStringSource
The type for Content-Type.
selectContentType :: String -> CTSource
Selecting a value of Content-Type from a file suffix.