salvia-protocol-1.0.1: Salvia webserver protocol suite supporting URI, HTTP, Cookie and MIME.

Network.Protocol.Http.Parser

Contents

Synopsis

Top level message parsers.

parseRequest :: String -> Either String (Http Request)Source

Parse a string as an HTTP request message. This parser is very forgiving.

parseResponse :: String -> Either String (Http Response)Source

Parse a string as an HTTP request message. This parser is very forgiving.

parseHeaders :: String -> Either String HeadersSource

Parse a string as a list of HTTP headers.

Exposure of internal parsec parsers.

pRequest :: GenParser Char st (Http Request)Source

Parsec parser to parse the header part of an HTTP request.

pResponse :: GenParser Char st (Http Response)Source

Parsec parser to parse the header part of an HTTP response.

pHeaders :: GenParser Char st HeadersSource

Parsec parser to parse one or more, possibly multiline, HTTP header lines.

pVersion :: GenParser Char st VersionSource

Parsec parser to parse HTTP versions. Recognizes X.X versions only.

pMethod :: GenParser Char st MethodSource

Parsec parser to parse an HTTP method. Parses arbitrary method but actually recognizes the ones listed as a constructor for Method.

Helper methods.

versionFromString :: String -> VersionSource

Recognizes HTTP protocol version 1.0 and 1.1, all other string will produce version 1.1.

methodFromString :: String -> MethodSource

Helper to turn fully capitalized string into request method.