happstack-server-7.9.3: Web related tools and services.

Copyright | (c) Peter Thiemann 20012002 (c) Bjorn Bringert 2005-2006 (c) Lemmih 2007
License | BSD-style
Maintainer | lemmih@vo.com
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Happstack.Server.Internal.RFC822Headers

Contents

- Headers
- Content-type
- Content-transfer-encoding
- Content-disposition
- Utilities

Description

Parsing of RFC822-style headers (name, value pairs) Partly based on code from WASHMail.

Synopsis

- type Header = (String, String)
- pHeader :: Parser Header
- pHeaders :: Parser [Header]
- parseHeaders :: MonadFail m => SourceName -> String -> m [Header]
- data ContentType = ContentType {
  - ctType :: String
  - ctSubtype :: String
  - ctParameters :: [(String, String)]
  }
- getContentType :: MonadFail m => [Header] -> m ContentType
- parseContentType :: MonadFail m => String -> m ContentType
- showContentType :: ContentType -> String
- data ContentTransferEncoding = ContentTransferEncoding String
- getContentTransferEncoding :: MonadFail m => [Header] -> m ContentTransferEncoding
- parseContentTransferEncoding :: MonadFail m => String -> m ContentTransferEncoding
- data ContentDisposition = ContentDisposition String [(String, String)]
- getContentDisposition :: MonadFail m => [Header] -> m ContentDisposition
- parseContentDisposition :: MonadFail m => String -> m ContentDisposition
- parseM :: MonadFail m => Parser a -> SourceName -> String -> m a

# Headers

type Header = (String, String) Source #

pHeader :: Parser Header Source #

pHeaders :: Parser [Header] Source #

parseHeaders :: MonadFail m => SourceName -> String -> m [Header] Source #

# Content-type

data ContentType Source #

A MIME media type value. The `Show` instance is derived automatically. Use `showContentType` to obtain the standard string representation. See http://www.ietf.org/rfc/rfc2046.txt for more information about MIME media types.

Constructors

ContentType |

Fields

- ctType :: String

  The top-level media type, the general type of the data. Common examples are "text", "image", "audio", "video", "multipart", and "application".

- ctSubtype :: String

  The media subtype, the specific data format. Examples include "plain", "html", "jpeg", "form-data", etc.

- ctParameters :: [(String, String)]

  Media type parameters. On common example is the charset parameter for the "text" top-level type, e.g. `("charset","ISO-8859-1")`.

#### Instances

Instances details

Read ContentType Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods readsPrec :: Int -> ReadS ContentType Source # readList :: ReadS [ContentType] Source # readPrec :: ReadPrec ContentType Source # readListPrec :: ReadPrec [ContentType] Source #
Show ContentType Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods showsPrec :: Int -> ContentType -> ShowS Source # show :: ContentType -> String Source # showList :: [ContentType] -> ShowS Source #
Eq ContentType Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods (==) :: ContentType -> ContentType -> Bool Source # (/=) :: ContentType -> ContentType -> Bool Source #
Ord ContentType Source # |

Instance details

Defined in Happstack.Server.Internal.RFC822Headers

Methods

compare :: ContentType -> ContentType -> Ordering Source #

(<) :: ContentType -> ContentType -> Bool Source #

(<=) :: ContentType -> ContentType -> Bool Source #

(>) :: ContentType -> ContentType -> Bool Source #

(>=) :: ContentType -> ContentType -> Bool Source #

max :: ContentType -> ContentType -> ContentType Source #

min :: ContentType -> ContentType -> ContentType Source #

getContentType :: MonadFail m => [Header] -> m ContentType Source #

parseContentType :: MonadFail m => String -> m ContentType Source #

Parse the standard representation of a content-type. If the input cannot be parsed, this function calls `fail` with a (hopefully) informative error message.

showContentType :: ContentType -> String Source #

Produce the standard string representation of a content-type, e.g. "text/html; charset=ISO-8859-1".

# Content-transfer-encoding

data ContentTransferEncoding Source #

Constructors

ContentTransferEncoding String |

#### Instances

Instances details

Read ContentTransferEncoding Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods readsPrec :: Int -> ReadS ContentTransferEncoding Source # readList :: ReadS [ContentTransferEncoding] Source # readPrec :: ReadPrec ContentTransferEncoding Source # readListPrec :: ReadPrec [ContentTransferEncoding] Source #
Show ContentTransferEncoding Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods showsPrec :: Int -> ContentTransferEncoding -> ShowS Source # show :: ContentTransferEncoding -> String Source # showList :: [ContentTransferEncoding] -> ShowS Source #
Eq ContentTransferEncoding Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods (==) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source # (/=) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source #
Ord ContentTransferEncoding Source # |

Instance details

Defined in Happstack.Server.Internal.RFC822Headers

Methods

compare :: ContentTransferEncoding -> ContentTransferEncoding -> Ordering Source #

(<) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source #

(<=) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source #

(>) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source #

(>=) :: ContentTransferEncoding -> ContentTransferEncoding -> Bool Source #

max :: ContentTransferEncoding -> ContentTransferEncoding -> ContentTransferEncoding Source #

min :: ContentTransferEncoding -> ContentTransferEncoding -> ContentTransferEncoding Source #

getContentTransferEncoding :: MonadFail m => [Header] -> m ContentTransferEncoding Source #

parseContentTransferEncoding :: MonadFail m => String -> m ContentTransferEncoding Source #

# Content-disposition

data ContentDisposition Source #

Constructors

ContentDisposition String [(String, String)] |

#### Instances

Instances details

Read ContentDisposition Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods readsPrec :: Int -> ReadS ContentDisposition Source # readList :: ReadS [ContentDisposition] Source # readPrec :: ReadPrec ContentDisposition Source # readListPrec :: ReadPrec [ContentDisposition] Source #
Show ContentDisposition Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods showsPrec :: Int -> ContentDisposition -> ShowS Source # show :: ContentDisposition -> String Source # showList :: [ContentDisposition] -> ShowS Source #
Eq ContentDisposition Source # |
Instance details Defined in Happstack.Server.Internal.RFC822Headers Methods (==) :: ContentDisposition -> ContentDisposition -> Bool Source # (/=) :: ContentDisposition -> ContentDisposition -> Bool Source #
Ord ContentDisposition Source # |

Instance details

Defined in Happstack.Server.Internal.RFC822Headers

Methods

compare :: ContentDisposition -> ContentDisposition -> Ordering Source #

(<) :: ContentDisposition -> ContentDisposition -> Bool Source #

(<=) :: ContentDisposition -> ContentDisposition -> Bool Source #

(>) :: ContentDisposition -> ContentDisposition -> Bool Source #

(>=) :: ContentDisposition -> ContentDisposition -> Bool Source #

max :: ContentDisposition -> ContentDisposition -> ContentDisposition Source #

min :: ContentDisposition -> ContentDisposition -> ContentDisposition Source #

getContentDisposition :: MonadFail m => [Header] -> m ContentDisposition Source #

parseContentDisposition :: MonadFail m => String -> m ContentDisposition Source #

# Utilities

parseM :: MonadFail m => Parser a -> SourceName -> String -> m a Source #