Network.Web.HTTP
Description
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
- data Version
- 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 :: String -> Maybe Status
- badStatus :: Status -> Bool
- data Persist
- = Close
- | Keep
- | PerUnknown
- data ServerException
- data FieldKey
- = FkAcceptLanguage
- | FkCacheControl
- | FkConnection
- | FkContentLength
- | FkContentType
- | FkCookie
- | FkDate
- | FkHost
- | FkIfModifiedSince
- | FkIfRange
- | FkIfUnmodifiedSince
- | FkLastModified
- | FkLocation
- | FkRange
- | FkServer
- | FkSetCookie2
- | FkStatus
- | FkTransferEncoding
- | FkOther String
- type FieldValue = String
- toFieldKey :: String -> FieldKey
- fromFieldKey :: FieldKey -> String
- type CT = String
- 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.
Versions of HTTP.
Status of HTTP.
Constructors
The type for persist connection or not
Constructors
| Close | |
| Keep | |
| PerUnknown |
Field key of HTTP header.
type FieldValue = StringSource
Field value of HTTP header.
toFieldKey :: String -> FieldKeySource
Converting field key to FieldKey.
fromFieldKey :: FieldKey -> StringSource
Converting FieldKey to field key.
selectContentType :: String -> CTSource
Selecting a value of Content-Type from a file suffix.