-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generic HTTP types for Haskell (for both client and server code). -- -- Generic HTTP types for Haskell (for both client and server code). @package http-types @version 0.8.5 module Network.HTTP.Types.Version -- | HTTP Version. -- -- Note that the Show instance is intended merely for debugging. data HttpVersion HttpVersion :: !Int -> !Int -> HttpVersion httpMajor :: HttpVersion -> !Int httpMinor :: HttpVersion -> !Int -- | HTTP 0.9 http09 :: HttpVersion -- | HTTP 1.0 http10 :: HttpVersion -- | HTTP 1.1 http11 :: HttpVersion instance Eq HttpVersion instance Ord HttpVersion instance Show HttpVersion module Network.HTTP.Types.URI -- | Query item type QueryItem = (ByteString, Maybe ByteString) -- | Query. -- -- General form: a=b&c=d, but if the value is Nothing, it becomes -- a&c=d. type Query = [QueryItem] -- | Simplified Query item type without support for parameter-less items. type SimpleQueryItem = (ByteString, ByteString) -- | Simplified Query type without support for parameter-less items. type SimpleQuery = [SimpleQueryItem] -- | Convert SimpleQuery to Query. simpleQueryToQuery :: SimpleQuery -> Query -- | Convert Query to ByteString. renderQuery :: Bool -> Query -> ByteString -- | Convert Query to a Builder. renderQueryBuilder :: Bool -> Query -> Builder -- | Convert SimpleQuery to ByteString. renderSimpleQuery :: Bool -> SimpleQuery -> ByteString -- | Split out the query string into a list of keys and values. A few -- importants points: -- --
-- 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. encodePathSegments :: [Text] -> Builder -- | Parse a list of path segments from a valid URL fragment. decodePathSegments :: ByteString -> [Text] -- | Like encodePathSegments, but without the initial slash. encodePathSegmentsRelative :: [Text] -> Builder -- | Extract whole path (path segments + query) from a RFC 2616 -- Request-URI. -- --
-- >>> extractPath "/path" -- "/path" ---- --
-- >>> extractPath "http://example.com:8080/path" -- "/path" ---- --
-- >>> extractPath "http://example.com" -- "/" ---- --
-- >>> extractPath "" -- "/" --extractPath :: ByteString -> ByteString -- | Encode a whole path (path segments + query). encodePath :: [Text] -> Query -> Builder -- | Decode a whole path (path segments + query). decodePath :: ByteString -> ([Text], Query) -- | Percent-encoding for URLs (using Builder). urlEncodeBuilder :: Bool -> ByteString -> Builder -- | Percent-encoding for URLs. urlEncode :: Bool -> ByteString -> ByteString -- | Percent-decoding. urlDecode :: Bool -> ByteString -> ByteString module Network.HTTP.Types.Status -- | HTTP Status. -- -- Only the statusCode is used for comparisons. -- -- Please use mkStatus to create status codes from code and -- message, or the Enum instance or the status code constants -- (like ok200). There might be additional record members in the -- future. -- -- Note that the Show instance is only for debugging. data Status Status :: Int -> ByteString -> Status statusCode :: Status -> Int statusMessage :: Status -> ByteString -- | Create a Status from status code and message. mkStatus :: Int -> ByteString -> Status -- | Continue 100 status100 :: Status -- | Continue 100 continue100 :: Status -- | Switching Protocols 101 status101 :: Status -- | Switching Protocols 101 switchingProtocols101 :: Status -- | OK 200 status200 :: Status -- | OK 200 ok200 :: Status -- | Created 201 status201 :: Status -- | Created 201 created201 :: Status -- | Accepted 202 status202 :: Status -- | Accepted 202 accepted202 :: Status -- | Non-Authoritative Information 203 status203 :: Status -- | Non-Authoritative Information 203 nonAuthoritative203 :: Status -- | No Content 204 status204 :: Status -- | No Content 204 noContent204 :: Status -- | Reset Content 205 status205 :: Status -- | Reset Content 205 resetContent205 :: Status -- | Partial Content 206 status206 :: Status -- | Partial Content 206 partialContent206 :: Status -- | Multiple Choices 300 status300 :: Status -- | Multiple Choices 300 multipleChoices300 :: Status -- | Moved Permanently 301 status301 :: Status -- | Moved Permanently 301 movedPermanently301 :: Status -- | Found 302 status302 :: Status -- | Found 302 found302 :: Status -- | See Other 303 status303 :: Status -- | See Other 303 seeOther303 :: Status -- | Not Modified 304 status304 :: Status -- | Not Modified 304 notModified304 :: Status -- | Use Proxy 305 status305 :: Status -- | Use Proxy 305 useProxy305 :: Status -- | Temporary Redirect 307 status307 :: Status -- | Temporary Redirect 307 temporaryRedirect307 :: Status -- | Bad Request 400 status400 :: Status -- | Bad Request 400 badRequest400 :: Status -- | Unauthorized 401 status401 :: Status -- | Unauthorized 401 unauthorized401 :: Status -- | Payment Required 402 status402 :: Status -- | Payment Required 402 paymentRequired402 :: Status -- | Forbidden 403 status403 :: Status -- | Forbidden 403 forbidden403 :: Status -- | Not Found 404 status404 :: Status -- | Not Found 404 notFound404 :: Status -- | Method Not Allowed 405 status405 :: Status -- | Method Not Allowed 405 methodNotAllowed405 :: Status -- | Not Acceptable 406 status406 :: Status -- | Not Acceptable 406 notAcceptable406 :: Status -- | Proxy Authentication Required 407 status407 :: Status -- | Proxy Authentication Required 407 proxyAuthenticationRequired407 :: Status -- | Request Timeout 408 status408 :: Status -- | Request Timeout 408 requestTimeout408 :: Status -- | Conflict 409 status409 :: Status -- | Conflict 409 conflict409 :: Status -- | Gone 410 status410 :: Status -- | Gone 410 gone410 :: Status -- | Length Required 411 status411 :: Status -- | Length Required 411 lengthRequired411 :: Status -- | Precondition Failed 412 status412 :: Status -- | Precondition Failed 412 preconditionFailed412 :: Status -- | Request Entity Too Large 413 status413 :: Status -- | Request Entity Too Large 413 requestEntityTooLarge413 :: Status -- | Request-URI Too Long 414 status414 :: Status -- | Request-URI Too Long 414 requestURITooLong414 :: Status -- | Unsupported Media Type 415 status415 :: Status -- | Unsupported Media Type 415 unsupportedMediaType415 :: Status -- | Requested Range Not Satisfiable 416 status416 :: Status -- | Requested Range Not Satisfiable 416 requestedRangeNotSatisfiable416 :: Status -- | Expectation Failed 417 status417 :: Status -- | Expectation Failed 417 expectationFailed417 :: Status -- | I'm a teapot 418 status418 :: Status -- | I'm a teapot 418 imATeaPot418 :: Status -- | Precondition Required 428 (RFC 6585) status428 :: Status -- | Precondition Required 428 (RFC 6585) preconditionRequired428 :: Status -- | Too Many Requests 429 (RFC 6585) status429 :: Status -- | Too Many Requests 429 (RFC 6585) tooManyRequests429 :: Status -- | Request Header Fields Too Large 431 (RFC 6585) status431 :: Status -- | Request Header Fields Too Large 431 (RFC 6585) requestHeaderFieldsTooLarge431 :: Status -- | Internal Server Error 500 status500 :: Status -- | Internal Server Error 500 internalServerError500 :: Status -- | Not Implemented 501 status501 :: Status -- | Not Implemented 501 notImplemented501 :: Status -- | Bad Gateway 502 status502 :: Status -- | Bad Gateway 502 badGateway502 :: Status -- | Service Unavailable 503 status503 :: Status -- | Service Unavailable 503 serviceUnavailable503 :: Status -- | Gateway Timeout 504 status504 :: Status -- | Gateway Timeout 504 gatewayTimeout504 :: Status -- | HTTP Version Not Supported 505 status505 :: Status -- | Network Authentication Required 511 (RFC 6585) status511 :: Status -- | Network Authentication Required 511 (RFC 6585) networkAuthenticationRequired511 :: Status -- | HTTP Version Not Supported 505 httpVersionNotSupported505 :: Status -- | Informational class statusIsInformational :: Status -> Bool -- | Successful class statusIsSuccessful :: Status -> Bool -- | Redirection class statusIsRedirection :: Status -> Bool -- | Client Error class statusIsClientError :: Status -> Bool -- | Server Error class statusIsServerError :: Status -> Bool instance Show Status instance Enum Status instance Ord Status instance Eq Status module Network.HTTP.Types.QueryLike -- | Types which can, and commonly are, converted to Query are in -- this class. -- -- You can use lists of simple key value pairs, with ByteString -- (strict, or lazy: ByteString), Text, or String as -- the key/value types. You can also have the value type lifted into a -- Maybe to support keys without values; and finally it is possible to -- put each pair into a Maybe for key-value pairs that aren't always -- present. class QueryLike a toQuery :: QueryLike a => a -> Query -- | Types which, in a Query-like key-value list, are used in the Key -- position. class QueryKeyLike a toQueryKey :: QueryKeyLike a => a -> ByteString -- | Types which, in a Query-like key-value list, are used in the Value -- position. class QueryValueLike a toQueryValue :: QueryValueLike a => a -> Maybe ByteString instance QueryValueLike a => QueryValueLike (Maybe a) instance QueryValueLike [Char] instance QueryValueLike Text instance QueryValueLike ByteString instance QueryValueLike ByteString instance QueryKeyLike [Char] instance QueryKeyLike Text instance QueryKeyLike ByteString instance QueryKeyLike ByteString instance (QueryKeyLike k, QueryValueLike v) => QueryLike [Maybe (k, v)] instance (QueryKeyLike k, QueryValueLike v) => QueryLike [(k, v)] module Network.HTTP.Types.Method -- | HTTP method (flat string type). type Method = ByteString -- | HTTP Method constants. methodGet :: Method -- | HTTP Method constants. methodPost :: Method -- | HTTP Method constants. methodHead :: Method -- | HTTP Method constants. methodPut :: Method -- | HTTP Method constants. methodDelete :: Method -- | HTTP Method constants. methodTrace :: Method -- | HTTP Method constants. methodConnect :: Method -- | HTTP Method constants. methodOptions :: Method -- | HTTP Method constants. methodPatch :: Method -- | HTTP standard method (as defined by RFC 2616, and PATCH which is -- defined by RFC 5789). data StdMethod GET :: StdMethod POST :: StdMethod HEAD :: StdMethod PUT :: StdMethod DELETE :: StdMethod TRACE :: StdMethod CONNECT :: StdMethod OPTIONS :: StdMethod PATCH :: StdMethod -- | Convert a method ByteString to a StdMethod if -- possible. parseMethod :: Method -> Either ByteString StdMethod -- | Convert an algebraic method to a ByteString. renderMethod :: Either ByteString StdMethod -> Method -- | Convert a StdMethod to a ByteString. renderStdMethod :: StdMethod -> Method instance Read StdMethod instance Show StdMethod instance Eq StdMethod instance Ord StdMethod instance Enum StdMethod instance Bounded StdMethod instance Ix StdMethod module Network.HTTP.Types.Header -- | Header type Header = (HeaderName, ByteString) -- | Header name type HeaderName = CI ByteString -- | Request Headers type RequestHeaders = [Header] -- | Response Headers type ResponseHeaders = [Header] -- | HTTP Header names hAccept :: HeaderName -- | HTTP Header names hAcceptLanguage :: HeaderName -- | HTTP Header names hAuthorization :: HeaderName -- | HTTP Header names hCacheControl :: HeaderName -- | HTTP Header names hCookie :: HeaderName -- | HTTP Header names hConnection :: HeaderName -- | HTTP Header names hContentEncoding :: HeaderName -- | HTTP Header names hContentLength :: HeaderName -- | HTTP Header names hContentMD5 :: HeaderName -- | HTTP Header names hContentType :: HeaderName -- | HTTP Header names hDate :: HeaderName -- | HTTP Header names hIfModifiedSince :: HeaderName -- | HTTP Header names hIfRange :: HeaderName -- | HTTP Header names hLastModified :: HeaderName -- | HTTP Header names hLocation :: HeaderName -- | HTTP Header names hRange :: HeaderName -- | HTTP Header names hReferer :: HeaderName -- | HTTP Header names hServer :: HeaderName -- | HTTP Header names hUserAgent :: HeaderName -- | RFC 2616 Byte range (individual). -- -- Negative indices are not allowed! data ByteRange ByteRangeFrom :: !Integer -> ByteRange ByteRangeFromTo :: !Integer -> !Integer -> ByteRange ByteRangeSuffix :: !Integer -> ByteRange renderByteRangeBuilder :: ByteRange -> Builder renderByteRange :: ByteRange -> ByteString -- | RFC 2616 Byte ranges (set). type ByteRanges = [ByteRange] renderByteRangesBuilder :: ByteRanges -> Builder renderByteRanges :: ByteRanges -> ByteString instance Typeable ByteRange instance Show ByteRange instance Eq ByteRange instance Ord ByteRange instance Data ByteRange module Network.HTTP.Types -- | HTTP method (flat string type). type Method = ByteString -- | HTTP Method constants. methodGet :: Method -- | HTTP Method constants. methodPost :: Method -- | HTTP Method constants. methodHead :: Method -- | HTTP Method constants. methodPut :: Method -- | HTTP Method constants. methodDelete :: Method -- | HTTP Method constants. methodTrace :: Method -- | HTTP Method constants. methodConnect :: Method -- | HTTP Method constants. methodOptions :: Method -- | HTTP Method constants. methodPatch :: Method -- | HTTP standard method (as defined by RFC 2616, and PATCH which is -- defined by RFC 5789). data StdMethod GET :: StdMethod POST :: StdMethod HEAD :: StdMethod PUT :: StdMethod DELETE :: StdMethod TRACE :: StdMethod CONNECT :: StdMethod OPTIONS :: StdMethod PATCH :: StdMethod -- | Convert a method ByteString to a StdMethod if -- possible. parseMethod :: Method -> Either ByteString StdMethod -- | Convert an algebraic method to a ByteString. renderMethod :: Either ByteString StdMethod -> Method -- | Convert a StdMethod to a ByteString. renderStdMethod :: StdMethod -> Method -- | HTTP Version. -- -- Note that the Show instance is intended merely for debugging. data HttpVersion HttpVersion :: !Int -> !Int -> HttpVersion httpMajor :: HttpVersion -> !Int httpMinor :: HttpVersion -> !Int -- | HTTP 0.9 http09 :: HttpVersion -- | HTTP 1.0 http10 :: HttpVersion -- | HTTP 1.1 http11 :: HttpVersion -- | HTTP Status. -- -- Only the statusCode is used for comparisons. -- -- Please use mkStatus to create status codes from code and -- message, or the Enum instance or the status code constants -- (like ok200). There might be additional record members in the -- future. -- -- Note that the Show instance is only for debugging. data Status Status :: Int -> ByteString -> Status statusCode :: Status -> Int statusMessage :: Status -> ByteString -- | Create a Status from status code and message. mkStatus :: Int -> ByteString -> Status -- | Continue 100 status100 :: Status -- | Continue 100 continue100 :: Status -- | Switching Protocols 101 status101 :: Status -- | Switching Protocols 101 switchingProtocols101 :: Status -- | OK 200 status200 :: Status -- | OK 200 ok200 :: Status -- | Created 201 status201 :: Status -- | Created 201 created201 :: Status -- | Accepted 202 status202 :: Status -- | Accepted 202 accepted202 :: Status -- | Non-Authoritative Information 203 status203 :: Status -- | Non-Authoritative Information 203 nonAuthoritative203 :: Status -- | No Content 204 status204 :: Status -- | No Content 204 noContent204 :: Status -- | Reset Content 205 status205 :: Status -- | Reset Content 205 resetContent205 :: Status -- | Partial Content 206 status206 :: Status -- | Partial Content 206 partialContent206 :: Status -- | Multiple Choices 300 status300 :: Status -- | Multiple Choices 300 multipleChoices300 :: Status -- | Moved Permanently 301 status301 :: Status -- | Moved Permanently 301 movedPermanently301 :: Status -- | Found 302 status302 :: Status -- | Found 302 found302 :: Status -- | See Other 303 status303 :: Status -- | See Other 303 seeOther303 :: Status -- | Not Modified 304 status304 :: Status -- | Not Modified 304 notModified304 :: Status -- | Use Proxy 305 status305 :: Status -- | Use Proxy 305 useProxy305 :: Status -- | Temporary Redirect 307 status307 :: Status -- | Temporary Redirect 307 temporaryRedirect307 :: Status -- | Bad Request 400 status400 :: Status -- | Bad Request 400 badRequest400 :: Status -- | Unauthorized 401 status401 :: Status -- | Unauthorized 401 unauthorized401 :: Status -- | Payment Required 402 status402 :: Status -- | Payment Required 402 paymentRequired402 :: Status -- | Forbidden 403 status403 :: Status -- | Forbidden 403 forbidden403 :: Status -- | Not Found 404 status404 :: Status -- | Not Found 404 notFound404 :: Status -- | Method Not Allowed 405 status405 :: Status -- | Method Not Allowed 405 methodNotAllowed405 :: Status -- | Not Acceptable 406 status406 :: Status -- | Not Acceptable 406 notAcceptable406 :: Status -- | Proxy Authentication Required 407 status407 :: Status -- | Proxy Authentication Required 407 proxyAuthenticationRequired407 :: Status -- | Request Timeout 408 status408 :: Status -- | Request Timeout 408 requestTimeout408 :: Status -- | Conflict 409 status409 :: Status -- | Conflict 409 conflict409 :: Status -- | Gone 410 status410 :: Status -- | Gone 410 gone410 :: Status -- | Length Required 411 status411 :: Status -- | Length Required 411 lengthRequired411 :: Status -- | Precondition Failed 412 status412 :: Status -- | Precondition Failed 412 preconditionFailed412 :: Status -- | Request Entity Too Large 413 status413 :: Status -- | Request Entity Too Large 413 requestEntityTooLarge413 :: Status -- | Request-URI Too Long 414 status414 :: Status -- | Request-URI Too Long 414 requestURITooLong414 :: Status -- | Unsupported Media Type 415 status415 :: Status -- | Unsupported Media Type 415 unsupportedMediaType415 :: Status -- | Requested Range Not Satisfiable 416 status416 :: Status -- | Requested Range Not Satisfiable 416 requestedRangeNotSatisfiable416 :: Status -- | Expectation Failed 417 status417 :: Status -- | Expectation Failed 417 expectationFailed417 :: Status -- | I'm a teapot 418 status418 :: Status -- | I'm a teapot 418 imATeaPot418 :: Status -- | Internal Server Error 500 status500 :: Status -- | Internal Server Error 500 internalServerError500 :: Status -- | Not Implemented 501 status501 :: Status -- | Not Implemented 501 notImplemented501 :: Status -- | Bad Gateway 502 status502 :: Status -- | Bad Gateway 502 badGateway502 :: Status -- | Service Unavailable 503 status503 :: Status -- | Service Unavailable 503 serviceUnavailable503 :: Status -- | Gateway Timeout 504 status504 :: Status -- | Gateway Timeout 504 gatewayTimeout504 :: Status -- | HTTP Version Not Supported 505 status505 :: Status -- | HTTP Version Not Supported 505 httpVersionNotSupported505 :: Status -- | Informational class statusIsInformational :: Status -> Bool -- | Successful class statusIsSuccessful :: Status -> Bool -- | Redirection class statusIsRedirection :: Status -> Bool -- | Client Error class statusIsClientError :: Status -> Bool -- | Server Error class statusIsServerError :: Status -> Bool -- | Header type Header = (HeaderName, ByteString) -- | Header name type HeaderName = CI ByteString -- | Request Headers type RequestHeaders = [Header] -- | Response Headers type ResponseHeaders = [Header] -- | HTTP Header names hAccept :: HeaderName -- | HTTP Header names hAcceptLanguage :: HeaderName -- | HTTP Header names hAuthorization :: HeaderName -- | HTTP Header names hCacheControl :: HeaderName -- | HTTP Header names hCookie :: HeaderName -- | HTTP Header names hConnection :: HeaderName -- | HTTP Header names hContentEncoding :: HeaderName -- | HTTP Header names hContentLength :: HeaderName -- | HTTP Header names hContentMD5 :: HeaderName -- | HTTP Header names hContentType :: HeaderName -- | HTTP Header names hDate :: HeaderName -- | HTTP Header names hIfModifiedSince :: HeaderName -- | HTTP Header names hIfRange :: HeaderName -- | HTTP Header names hLastModified :: HeaderName -- | HTTP Header names hLocation :: HeaderName -- | HTTP Header names hRange :: HeaderName -- | HTTP Header names hReferer :: HeaderName -- | HTTP Header names hServer :: HeaderName -- | HTTP Header names hUserAgent :: HeaderName -- | RFC 2616 Byte range (individual). -- -- Negative indices are not allowed! data ByteRange ByteRangeFrom :: !Integer -> ByteRange ByteRangeFromTo :: !Integer -> !Integer -> ByteRange ByteRangeSuffix :: !Integer -> ByteRange renderByteRangeBuilder :: ByteRange -> Builder renderByteRange :: ByteRange -> ByteString -- | RFC 2616 Byte ranges (set). type ByteRanges = [ByteRange] renderByteRangesBuilder :: ByteRanges -> Builder renderByteRanges :: ByteRanges -> ByteString -- | Query item type QueryItem = (ByteString, Maybe ByteString) -- | Query. -- -- General form: a=b&c=d, but if the value is Nothing, it becomes -- a&c=d. type Query = [QueryItem] -- | Simplified Query item type without support for parameter-less items. type SimpleQueryItem = (ByteString, ByteString) -- | Simplified Query type without support for parameter-less items. type SimpleQuery = [SimpleQueryItem] -- | Convert SimpleQuery to Query. simpleQueryToQuery :: SimpleQuery -> Query -- | Convert Query to ByteString. renderQuery :: Bool -> Query -> ByteString -- | Convert Query to a Builder. renderQueryBuilder :: Bool -> Query -> Builder -- | Convert SimpleQuery to ByteString. renderSimpleQuery :: Bool -> SimpleQuery -> ByteString -- | Split out the query string into a list of keys and values. A few -- importants points: -- --
-- 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. encodePathSegments :: [Text] -> Builder -- | Parse a list of path segments from a valid URL fragment. decodePathSegments :: ByteString -> [Text] -- | Like encodePathSegments, but without the initial slash. encodePathSegmentsRelative :: [Text] -> Builder -- | Extract whole path (path segments + query) from a RFC 2616 -- Request-URI. -- --
-- >>> extractPath "/path" -- "/path" ---- --
-- >>> extractPath "http://example.com:8080/path" -- "/path" ---- --
-- >>> extractPath "http://example.com" -- "/" ---- --
-- >>> extractPath "" -- "/" --extractPath :: ByteString -> ByteString -- | Encode a whole path (path segments + query). encodePath :: [Text] -> Query -> Builder -- | Decode a whole path (path segments + query). decodePath :: ByteString -> ([Text], Query) -- | Percent-encoding for URLs (using Builder). urlEncodeBuilder :: Bool -> ByteString -> Builder -- | Percent-encoding for URLs. urlEncode :: Bool -> ByteString -> ByteString -- | Percent-decoding. urlDecode :: Bool -> ByteString -> ByteString