http-types-0.3.1: Generic HTTP types for Haskell (for both client and server code).

Network.HTTP.Types

Contents

Synopsis

Case insensitive HTTP ByteStrings

data CIByteString Source

Case-insensitive HTTP ByteStrings, mostly for use in Header names.

mkCIByteString :: ByteString -> CIByteStringSource

Make a case-insensitive ByteString from a normal ByteString.

Methods

type Method = ByteStringSource

HTTP method (flat string type).

methodPost :: MethodSource

HTTP Method constants.

data StdMethod Source

HTTP standard method (as defined by RFC 2616).

Constructors

GET 
POST 
HEAD 
PUT 
DELETE 
TRACE 
CONNECT 
OPTIONS 

parseMethod :: Method -> Either ByteString StdMethodSource

Convert a method ByteString to a StdMethod if possible.

renderMethod :: Either ByteString StdMethod -> MethodSource

Convert an algebraic method to a ByteString.

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.

Constructors

HttpVersion 

Fields

httpMajor :: !Int
 
httpMinor :: !Int
 

Status

data Status Source

HTTP Status.

Only the statusCode is used for comparisons.

Note that the Show instance is only for debugging.

Constructors

Status 

Instances

statusNotAllowed :: StatusSource

Method Not Allowed

statusServerError :: StatusSource

Internal Server Error

Headers

type RequestHeaders = [Header]Source

Request Headers

type ResponseHeaders = [Header]Source

Response Headers

Query string

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.

renderQuery :: Bool -> Query -> ByteStringSource

Convert Query to ByteString.

parseQuery :: ByteString -> QuerySource

Parse Query from a ByteString.

URL encoding / decoding

urlEncode :: ByteString -> ByteStringSource

Percent-encoding for URLs.

urlDecode :: ByteString -> ByteStringSource

Percent-decoding.