Safe Haskell | Safe-Infered |
---|
- type Ascii = ByteString
- type Method = Ascii
- methodGet, methodOptions, methodConnect, methodTrace, methodDelete, methodPut, methodHead, methodPost :: Method
- data StdMethod
- parseMethod :: Method -> Either Ascii StdMethod
- renderMethod :: Either Ascii StdMethod -> Method
- renderStdMethod :: StdMethod -> Method
- data HttpVersion = HttpVersion {}
- http09 :: HttpVersion
- http10 :: HttpVersion
- http11 :: HttpVersion
- data Status = Status {
- statusCode :: Int
- statusMessage :: Ascii
- status100 :: Status
- continue100 :: Status
- status101 :: Status
- switchingProtocols101 :: Status
- status200 :: Status
- ok200 :: Status
- status201 :: Status
- created201 :: Status
- status202 :: Status
- accepted202 :: Status
- status203 :: Status
- nonAuthoritative203 :: Status
- status204 :: Status
- noContent204 :: Status
- status205 :: Status
- resetContent205 :: Status
- status206 :: Status
- partialContent206 :: Status
- status300 :: Status
- multipleChoices300 :: Status
- status301 :: Status
- movedPermanently301 :: Status
- status302 :: Status
- found302 :: Status
- status303 :: Status
- seeOther303 :: Status
- status304 :: Status
- notModified304 :: Status
- status305 :: Status
- useProxy305 :: Status
- status307 :: Status
- temporaryRedirect307 :: Status
- status400 :: Status
- badRequest400 :: Status
- status401 :: Status
- unauthorized401 :: Status
- status402 :: Status
- paymentRequired402 :: Status
- status403 :: Status
- forbidden403 :: Status
- status404 :: Status
- notFound404 :: Status
- status405 :: Status
- methodNotAllowed405 :: Status
- status406 :: Status
- notAcceptable406 :: Status
- status407 :: Status
- proxyAuthenticationRequired407 :: Status
- status408 :: Status
- requestTimeout408 :: Status
- status409 :: Status
- conflict409 :: Status
- status410 :: Status
- gone410 :: Status
- status411 :: Status
- lengthRequired411 :: Status
- status412 :: Status
- preconditionFailed412 :: Status
- status413 :: Status
- requestEntityTooLarge413 :: Status
- status414 :: Status
- requestURITooLong414 :: Status
- status415 :: Status
- unsupportedMediaType415 :: Status
- status416 :: Status
- requestedRangeNotSatisfiable416 :: Status
- status417 :: Status
- expectationFailed417 :: Status
- status418 :: Status
- imATeaPot418 :: Status
- status500 :: Status
- internalServerError500 :: Status
- status501 :: Status
- notImplemented501 :: Status
- status502 :: Status
- badGateway502 :: Status
- status503 :: Status
- serviceUnavailable503 :: Status
- status504 :: Status
- gatewayTimeout504 :: Status
- status505 :: Status
- httpVersionNotSupported505 :: Status
- type Header = (CI Ascii, Ascii)
- type RequestHeaders = [Header]
- type ResponseHeaders = [Header]
- headerAccept, headerDate, headerContentMD5, headerContentType, headerContentLength, headerConnection, headerCacheControl, headerAuthorization :: Ascii -> Header
- type QueryItem = (ByteString, Maybe ByteString)
- type Query = [QueryItem]
- type SimpleQueryItem = (ByteString, ByteString)
- type SimpleQuery = [SimpleQueryItem]
- simpleQueryToQuery :: SimpleQuery -> Query
- renderQuery :: Bool -> Query -> Ascii
- renderQueryBuilder :: Bool -> Query -> Builder
- renderSimpleQuery :: Bool -> SimpleQuery -> Ascii
- parseQuery :: ByteString -> Query
- parseSimpleQuery :: ByteString -> SimpleQuery
- type QueryText = [(Text, Maybe Text)]
- queryTextToQuery :: QueryText -> Query
- queryToQueryText :: Query -> QueryText
- renderQueryText :: Bool -> QueryText -> Builder
- parseQueryText :: ByteString -> QueryText
- encodePathSegments :: [Text] -> Builder
- decodePathSegments :: ByteString -> [Text]
- encodePathSegmentsRelative :: [Text] -> Builder
- encodePath :: [Text] -> Query -> Builder
- decodePath :: ByteString -> ([Text], Query)
- urlEncodeBuilder :: Bool -> ByteString -> Builder
- urlEncode :: Bool -> ByteString -> Ascii
- urlDecode :: Bool -> ByteString -> ByteString
- statusNotAllowed :: Status
- statusContinue :: Status
- statusSwitchingProtocols :: Status
- statusOK :: Status
- statusCreated :: Status
- statusAccepted :: Status
- statusNonAuthoritative :: Status
- statusNoContent :: Status
- statusResetContent :: Status
- statusPartialContent :: Status
- statusMultipleChoices :: Status
- statusMovedPermanently :: Status
- statusFound :: Status
- statusSeeOther :: Status
- statusNotModified :: Status
- statusUseProxy :: Status
- statusTemporaryRedirect :: Status
- statusBadRequest :: Status
- statusUnauthorized :: Status
- statusPaymentRequired :: Status
- statusForbidden :: Status
- statusNotFound :: Status
- statusNotAcceptable :: Status
- statusProxyAuthenticationRequired :: Status
- statusRequestTimeout :: Status
- statusConflict :: Status
- statusGone :: Status
- statusLengthRequired :: Status
- statusPreconditionFailed :: Status
- statusRequestEntityTooLarge :: Status
- statusRequestURITooLong :: Status
- statusUnsupportedMediaType :: Status
- statusRequestedRangeNotSatisfiable :: Status
- statusExpectationFailed :: Status
- statusImATeapot :: Status
- statusServerError :: Status
- statusNotImplemented :: Status
- statusBadGateway :: Status
- statusServiceUnavailable :: Status
- statusGatewayTimeout :: Status
- statusHTTPVersionNotSupported :: Status
General
type Ascii = ByteStringSource
Methods
methodGet, methodOptions, methodConnect, methodTrace, methodDelete, methodPut, methodHead, methodPost :: MethodSource
HTTP Method constants.
HTTP standard method (as defined by RFC 2616).
parseMethod :: Method -> Either Ascii StdMethodSource
Convert a method ByteString
to a StdMethod
if possible.
renderStdMethod :: StdMethod -> MethodSource
Convert a StdMethod
to a ByteString
.
Versions
data HttpVersion Source
HTTP Version.
Note that the Show instance is intended merely for debugging.
HTTP 0.9
HTTP 1.0
HTTP 1.1
Status
HTTP Status.
Only the statusCode
is used for comparisons.
Note that the Show instance is only for debugging.
Status | |
|
Continue 100
switchingProtocols101 :: StatusSource
Switching Protocols 101
Created 201
Accepted 202
nonAuthoritative203 :: StatusSource
Non-Authoritative Information 203
No Content 204
resetContent205 :: StatusSource
Reset Content 205
partialContent206 :: StatusSource
Partial Content 206
multipleChoices300 :: StatusSource
Multiple Choices 300
movedPermanently301 :: StatusSource
Moved Permanently 301
See Other 303
notModified304 :: StatusSource
Not Modified 304
Use Proxy 305
temporaryRedirect307 :: StatusSource
Temporary Redirect 307
Bad Request 400
unauthorized401 :: StatusSource
Unauthorized 401
paymentRequired402 :: StatusSource
Payment Required 402
Forbidden 403
Not Found 404
methodNotAllowed405 :: StatusSource
Method Not Allowed 405
notAcceptable406 :: StatusSource
Not Acceptable 406
proxyAuthenticationRequired407 :: StatusSource
Proxy Authentication Required 407
requestTimeout408 :: StatusSource
Request Timeout 408
Conflict 409
lengthRequired411 :: StatusSource
Length Required 411
preconditionFailed412 :: StatusSource
Precondition Failed 412
requestEntityTooLarge413 :: StatusSource
Request Entity Too Large 413
requestURITooLong414 :: StatusSource
Request-URI Too Long 414
unsupportedMediaType415 :: StatusSource
Unsupported Media Type 415
requestedRangeNotSatisfiable416 :: StatusSource
Requested Range Not Satisfiable 416
expectationFailed417 :: StatusSource
Expectation Failed 417
I'm a teapot 418
internalServerError500 :: StatusSource
Internal Server Error 500
notImplemented501 :: StatusSource
Not Implemented 501
Bad Gateway 502
serviceUnavailable503 :: StatusSource
Service Unavailable 503
gatewayTimeout504 :: StatusSource
Gateway Timeout 504
httpVersionNotSupported505 :: StatusSource
HTTP Version Not Supported 505
Headers
type RequestHeaders = [Header]Source
Request Headers
type ResponseHeaders = [Header]Source
Response Headers
headerAccept, headerDate, headerContentMD5, headerContentType, headerContentLength, headerConnection, headerCacheControl, headerAuthorization :: Ascii -> HeaderSource
HTTP Headers
Query string
type QueryItem = (ByteString, Maybe ByteString)Source
Query item
type Query = [QueryItem]Source
Query.
General form: a=b&c=d, but if the value is Nothing, it becomes a&c=d.
type SimpleQueryItem = (ByteString, ByteString)Source
Simplified Query item type without support for parameter-less items.
type SimpleQuery = [SimpleQueryItem]Source
Simplified Query type without support for parameter-less items.
simpleQueryToQuery :: SimpleQuery -> QuerySource
Convert SimpleQuery
to Query
.
:: Bool | prepend question mark? |
-> SimpleQuery | |
-> Ascii |
Convert SimpleQuery
to ByteString
.
parseQuery :: ByteString -> QuerySource
Split out the query string into a list of keys and values. A few importants points:
parseSimpleQuery :: ByteString -> SimpleQuerySource
Parse SimpleQuery
from a ByteString
.
Text query string (UTF8 encoded)
Path segments
encodePathSegments :: [Text] -> BuilderSource
Encodes a list of path segments into a valid URL fragment.
This function takes the following three steps:
- UTF-8 encodes the characters.
- Performs percent encoding on all unreserved characters, as well as :@=+$,
- Prepends each segment with a slash.
For example:
encodePathSegments [\"foo\", \"bar\", \"baz\"]
"/foo/bar/baz"
encodePathSegments [\"foo bar\", \"baz\/bin\"]
"/foo%20bar/baz%2Fbin"
encodePathSegments [\"שלום\"]
"/%D7%A9%D7%9C%D7%95%D7%9D"
Huge thanks to Jeremy Shaw who created the original implementation of this function in web-routes and did such thorough research to determine all correct escaping procedures.
decodePathSegments :: ByteString -> [Text]Source
encodePathSegmentsRelative :: [Text] -> BuilderSource
Like encodePathSegments, but without the initial slash.
Path (segments + query string)
encodePath :: [Text] -> Query -> BuilderSource
decodePath :: ByteString -> ([Text], Query)Source
URL encoding / decoding
:: Bool | Whether input is in query string. True: Query string, False: Path element |
-> ByteString | |
-> Builder |
urlEncode :: Bool -> ByteString -> AsciiSource
Deprecated functions
statusNotAllowed :: StatusSource
Method Not Allowed 405 (DEPRECATED!)
statusContinue :: StatusSource
Continue 100 (DEPRECATED)
statusSwitchingProtocols :: StatusSource
Switching Protocols 101 (DEPRECATED)
Created 201 (DEPRECATED)
statusAccepted :: StatusSource
Accepted 202 (DEPRECATED)
statusNonAuthoritative :: StatusSource
Non-Authoritative Information 203 (DEPRECATED)
statusNoContent :: StatusSource
No Content 204 (DEPRECATED)
statusResetContent :: StatusSource
Reset Content 205 (DEPRECATED)
statusPartialContent :: StatusSource
Partial Content 206 (DEPRECATED)
statusMultipleChoices :: StatusSource
Multiple Choices 300 (DEPRECATED)
statusMovedPermanently :: StatusSource
Moved Permanently 301 (DEPRECATED)
Found 302 (DEPRECATED)
statusSeeOther :: StatusSource
See Other 303 (DEPRECATED)
statusNotModified :: StatusSource
Not Modified 304 (DEPRECATED)
statusUseProxy :: StatusSource
Use Proxy 305 (DEPRECATED)
statusTemporaryRedirect :: StatusSource
Temporary Redirect 307 (DEPRECATED)
statusBadRequest :: StatusSource
Bad Request 400 (DEPRECATED)
statusUnauthorized :: StatusSource
Unauthorized 401 (DEPRECATED)
statusPaymentRequired :: StatusSource
Payment Required 402 (DEPRECATED)
statusForbidden :: StatusSource
Forbidden 403 (DEPRECATED)
statusNotFound :: StatusSource
Not Found 404 (DEPRECATED)
statusNotAcceptable :: StatusSource
Not Acceptable 406 (DEPRECATED)
statusProxyAuthenticationRequired :: StatusSource
Proxy Authentication Required 407
statusRequestTimeout :: StatusSource
Request Timeout 408 (DEPRECATED)
statusConflict :: StatusSource
Conflict 409 (DEPRECATED)
Gone 410 (DEPRECATED)
statusLengthRequired :: StatusSource
Length Required 411 (DEPRECATED)
statusPreconditionFailed :: StatusSource
Precondition Failed 412 (DEPRECATED)
statusRequestEntityTooLarge :: StatusSource
Request Entity Too Large 413 (DEPRECATED)
statusRequestURITooLong :: StatusSource
Request-URI Too Long 414 (DEPRECATED)
statusUnsupportedMediaType :: StatusSource
Unsupported Media Type 415 (DEPRECATED)
statusRequestedRangeNotSatisfiable :: StatusSource
Requested Range Not Satisfiable 416 (DEPRECATED)
statusExpectationFailed :: StatusSource
Expectation Failed 417 (DEPRECATED)
statusImATeapot :: StatusSource
I'm a teapot 418 (DEPRECATED)
statusServerError :: StatusSource
Internal Server Error 500 (DEPRECATED)
statusNotImplemented :: StatusSource
Not Implemented 501 (DEPRECATED)
statusBadGateway :: StatusSource
Bad Gateway 502 (DEPRECATED)
statusServiceUnavailable :: StatusSource
Service Unavailable 503 (DEPRECATED)
statusGatewayTimeout :: StatusSource
Gateway Timeout 504 (DEPRECATED)
statusHTTPVersionNotSupported :: StatusSource
HTTP Version Not Supported 505 (DEPRECATED)