-- 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.6.5.1 module Network.HTTP.Types type Ascii = ByteString -- | HTTP method (flat string type). type Method = Ascii -- | HTTP Method constants. methodGet, methodOptions, methodConnect, methodTrace, methodDelete, methodPut, methodHead, methodPost :: Method -- | HTTP standard method (as defined by RFC 2616). data StdMethod GET :: StdMethod POST :: StdMethod HEAD :: StdMethod PUT :: StdMethod DELETE :: StdMethod TRACE :: StdMethod CONNECT :: StdMethod OPTIONS :: StdMethod -- | Convert a method ByteString to a StdMethod if -- possible. parseMethod :: Method -> Either Ascii StdMethod -- | Convert an algebraic method to a ByteString. renderMethod :: Either Ascii 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. -- -- Note that the Show instance is only for debugging. data Status Status :: Int -> Ascii -> Status statusCode :: Status -> Int statusMessage :: Status -> Ascii -- | OK status200, statusOK :: Status -- | Created status201, statusCreated :: Status -- | PartialContent status206, statusPartialContent :: Status -- | Moved Permanently status301, statusMovedPermanently :: Status -- | Found status302, statusFound :: Status -- | See Other status303, statusSeeOther :: Status -- | Not Modified status304, statusNotModified :: Status -- | Bad Request status400, statusBadRequest :: Status -- | Unauthorized status401, statusUnauthorized :: Status -- | Forbidden status403, statusForbidden :: Status -- | Not Found status404, statusNotFound :: Status -- | Method Not Allowed status405, statusNotAllowed :: Status -- | Precondition Failed status412, statusPreconditionFailed :: Status -- | Requested Range Not Satisfiable status416, statusRequestedRangeNotSatisfiable :: Status -- | Internal Server Error status500, statusServerError :: Status -- | Not Implemented status501, statusNotImplemented :: Status -- | Header type Header = (CI Ascii, Ascii) -- | Request Headers type RequestHeaders = [Header] -- | Response Headers type ResponseHeaders = [Header] -- | HTTP Headers headerAccept, headerDate, headerContentMD5, headerContentType, headerContentLength, headerConnection, headerCacheControl, headerAuthorization :: Ascii -> Header -- | 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 -> Ascii renderQueryBuilder :: Bool -> Query -> Builder -- | Convert SimpleQuery to ByteString. renderSimpleQuery :: Bool -> SimpleQuery -> Ascii -- | Split out the query string into a list of keys and values. A few -- importants points: -- -- parseQuery :: ByteString -> Query -- | Parse SimpleQuery from a ByteString. parseSimpleQuery :: ByteString -> SimpleQuery type QueryText = [(Text, Maybe Text)] queryTextToQuery :: QueryText -> Query queryToQueryText :: Query -> QueryText renderQueryText :: Bool -> QueryText -> Builder parseQueryText :: ByteString -> QueryText -- | Encodes a list of path segments into a valid URL fragment. -- -- This function takes the following three steps: -- -- -- -- For example: -- --
--   encodePathInfo [\"foo\", \"bar\", \"baz\"]
--   
-- -- "foo/bar/baz" -- --
--   encodePathInfo [\"foo bar\", \"baz\/bin\"]
--   
-- -- "foo%20bar/baz%2Fbin" -- --
--   encodePathInfo [\"\"]
--   
-- -- "%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 decodePathSegments :: ByteString -> [Text] encodePath :: [Text] -> Query -> Builder decodePath :: ByteString -> ([Text], Query) urlEncodeBuilder :: Bool -> ByteString -> Builder urlEncode :: Bool -> ByteString -> Ascii -- | Percent-decoding. urlDecode :: Bool -> ByteString -> ByteString instance Read StdMethod instance Show StdMethod instance Eq StdMethod instance Ord StdMethod instance Enum StdMethod instance Bounded StdMethod instance Ix StdMethod instance Eq HttpVersion instance Ord HttpVersion instance Show Status instance Ord Status instance Eq Status instance Show HttpVersion