-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Incremental HTTP iteratee
--
-- Incremental iteratee-based HTTP library using the enumerator
-- package.
@package ihttp
@version 0.1.0
-- | Enumeratees and other tools.
module Network.IHttp.Tools
-- | Fast ASCII version of toUpper.
asciiToUpper :: Char -> Char
-- | Fully parse a string with the given parser. Throw an iteratee error
-- with the given error constructor, if it fails.
parseIter :: (Exception ex, Monad m) => Parser b -> (String -> ex) -> ByteString -> Iteratee a m b
-- | Fully parse a string with the given parser.
parseFull :: Parser a -> ByteString -> Either String a
-- | Types for ihttp.
module Network.IHttp.Types
-- | Map of HTTP headers.
type HeaderMap = Map ByteString ByteString
-- | HTTP request method.
data HttpMethod
-- | CONNECT
ConnectMethod :: HttpMethod
-- | DELETE
DeleteMethod :: HttpMethod
-- | GET
GetMethod :: HttpMethod
-- | HEAD
HeadMethod :: HttpMethod
-- | OPTIONS
OptionsMethod :: HttpMethod
-- | PATCH
PatchMethod :: HttpMethod
-- | POST
PostMethod :: HttpMethod
-- | PUT
PutMethod :: HttpMethod
-- | TRACE
TraceMethod :: HttpMethod
-- | Methods this library doesn't know.
XMethod :: ByteString -> HttpMethod
-- | HTTP protocol version.
data HttpVersion
-- | Version 1.0 of HTTP.
Http1_0 :: HttpVersion
-- | Version 1.1 of HTTP.
Http1_1 :: HttpVersion
-- | HTTP request line with status code.
data Request
Request :: HeaderMap -> HttpMethod -> ByteString -> HttpVersion -> Request
-- | Request headers.
requestHeaders :: Request -> HeaderMap
-- | Request method.
requestMethod :: Request -> HttpMethod
-- | Request URI.
requestUri :: Request -> ByteString
-- | HTTP version of request.
requestVersion :: Request -> HttpVersion
-- | HTTP response line with the status code.
data Response
Response :: Int -> HeaderMap -> ByteString -> HttpVersion -> Response
-- | HTTP response code.
responseCode :: Response -> Int
-- | Response headers.
responseHeaders :: Response -> HeaderMap
-- | Response message.
responseMessage :: Response -> ByteString
-- | Protocol version of response.
responseVersion :: Response -> HttpVersion
-- | HTTP error.
data HttpError
-- | Invalid headers from client/server.
InvalidHeaderError :: String -> HttpError
httpErrorMessage :: HttpError -> String
-- | Invalid requests from client.
InvalidRequestError :: String -> HttpError
httpErrorMessage :: HttpError -> String
-- | Invalid responses from server.
InvalidResponseError :: String -> HttpError
httpErrorMessage :: HttpError -> String
-- | Unsupported HTTP version.
UnsupportedVersionError :: String -> HttpError
httpErrorMessage :: HttpError -> String
instance Typeable HttpError
instance Eq HttpError
instance Eq HttpMethod
instance Read HttpMethod
instance Show HttpMethod
instance Eq HttpVersion
instance Ord HttpVersion
instance Read HttpVersion
instance Show HttpVersion
instance Eq Request
instance Read Request
instance Show Request
instance Eq Response
instance Read Response
instance Show Response
instance Show HttpError
instance Exception HttpError
-- | HTTP parsers.
module Network.IHttp.Parsers
-- | Parse an HTTP status code.
httpCodeP :: Parser Int
-- | Parse first HTTP header line.
httpFirstHeaderP :: Parser (ByteString, ByteString)
-- | Parse a known HTTP method.
httpMethodP :: Parser HttpMethod
-- | Parse the given HTTP method.
httpMethodP' :: HttpMethod -> Parser HttpMethod
-- | Parse an HTTP version in the format HTTP/major.minor.
httpVersionP :: Parser HttpVersion
-- | Parse the rest of input as a status message.
messageP :: Parser ByteString
-- | Parse an HTTP request line.
requestLineP :: Parser Request
-- | Parse an HTTP response line.
responseLineP :: Parser Response
-- | Iteratees for header parsing.
module Network.IHttp.Header
-- | Get the next header from the netLinesEmpty-splitted stream.
-- The header's content is length-limited by the given argument. If it's
-- longer, it's safely truncated in constant space. This iteratee throws
-- an iteratee error, if the next lines are not a valid HTTP header or
-- the stream ends prematurely. If the next line is an empty line, this
-- iteratee returns Nothing.
httpHeader :: Monad m => Int -> Iteratee ByteString m (Maybe (ByteString, ByteString))
-- | Get the headers of an HTTP request from a
-- netLinesEmpty-splitted byte stream. The first Int
-- specifies the maximum length of individual headers. The second
-- Int specifies the maximum number of headers. This iteratee
-- throws an iteratee error on invalid input, of if the stream ends
-- prematurely.
--
-- Excess data is truncated safely in constant space.
httpHeaders :: Monad m => Int -> Int -> Iteratee ByteString m HeaderMap
-- | Iteratees for requests.
module Network.IHttp.Request
-- | Get the next full request from a netLinesEmpty-splitted byte
-- stream. If the request is invalid or the stream ends prematurely an
-- iteratee error is thrown. The first Int specifies the maximum
-- header content length. The second Int specifies the maximum
-- number of headers. Excess data is truncated safely in constant space.
request :: Monad m => Int -> Int -> Iteratee ByteString m Request
-- | Get the next request line from a netLinesEmpty-splitted byte
-- stream. If the request is invalid or the stream ends prematurely an
-- iteratee error is thrown.
requestLine :: Monad m => Iteratee ByteString m Request
-- | Iteratees for response.
module Network.IHttp.Response
-- | Get the next full response from a netLinesEmpty-splitted byte
-- stream. If the response is invalid or the stream ends prematurely an
-- iteratee error is thrown. The first Int specifies the maximum
-- header content length. The second Int specifies the maximum
-- number of headers. Excess data is truncated safely in constant space.
response :: Monad m => Int -> Int -> Iteratee ByteString m Response
-- | Get the next response line form netLinesEmpty-splitted
-- stream. If the response line is invalid or the stream ended
-- prematurely, then an iteratee error is thrown.
responseLine :: Monad m => Iteratee ByteString m Response
-- | Simple interface to the HTTP iteratees.
module Network.IHttp.Simple
-- | HTTP iteratees configuration.
data HttpConfig
HttpConfig :: Int -> Int -> Int -> HttpConfig
-- | Maximum protocol line length.
httpMaxLine :: HttpConfig -> Int
-- | Maximum header content length.
httpMaxHeaderContent :: HttpConfig -> Int
-- | Maximum number of headers.
httpMaxHeaders :: HttpConfig -> Int
-- | Default HTTP iteratee configuration. Other than in very special
-- applications you should never need to change these defaults.
defHttpConfig :: HttpConfig
-- | Get the next full request from the given raw byte stream.
getRequest :: Monad m => HttpConfig -> Iteratee ByteString m Request
-- | Get the next full response from the given raw byte stream.
getResponse :: Monad m => HttpConfig -> Iteratee ByteString m Response
-- | Convenience module for the ihttp library.
module Network.IHttp