multipart-0.2.0: Parsers for the HTTP multipart format
Copyright(c) Peter Thiemann 20012002
(c) Bjorn Bringert 2005-2006
LicenseBSD-style
MaintainerAnders Kaseorg <andersk@mit.edu>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Network.Multipart

Description

Parsing of the multipart format from RFC2046. Partly based on code from WASHMail.

Synopsis

Multi-part messages

data MultiPart Source #

Constructors

MultiPart [BodyPart] 

Instances

Instances details
Eq MultiPart Source # 
Instance details

Defined in Network.Multipart

Methods

(==) :: MultiPart -> MultiPart -> Bool

(/=) :: MultiPart -> MultiPart -> Bool

Ord MultiPart Source # 
Instance details

Defined in Network.Multipart

Methods

compare :: MultiPart -> MultiPart -> Ordering

(<) :: MultiPart -> MultiPart -> Bool

(<=) :: MultiPart -> MultiPart -> Bool

(>) :: MultiPart -> MultiPart -> Bool

(>=) :: MultiPart -> MultiPart -> Bool

max :: MultiPart -> MultiPart -> MultiPart

min :: MultiPart -> MultiPart -> MultiPart

Show MultiPart Source # 
Instance details

Defined in Network.Multipart

Methods

showsPrec :: Int -> MultiPart -> ShowS

show :: MultiPart -> String

showList :: [MultiPart] -> ShowS

data BodyPart Source #

Constructors

BodyPart Headers ByteString 

Instances

Instances details
Eq BodyPart Source # 
Instance details

Defined in Network.Multipart

Methods

(==) :: BodyPart -> BodyPart -> Bool

(/=) :: BodyPart -> BodyPart -> Bool

Ord BodyPart Source # 
Instance details

Defined in Network.Multipart

Methods

compare :: BodyPart -> BodyPart -> Ordering

(<) :: BodyPart -> BodyPart -> Bool

(<=) :: BodyPart -> BodyPart -> Bool

(>) :: BodyPart -> BodyPart -> Bool

(>=) :: BodyPart -> BodyPart -> Bool

max :: BodyPart -> BodyPart -> BodyPart

min :: BodyPart -> BodyPart -> BodyPart

Show BodyPart Source # 
Instance details

Defined in Network.Multipart

Methods

showsPrec :: Int -> BodyPart -> ShowS

show :: BodyPart -> String

showList :: [BodyPart] -> ShowS

parseMultipartBody Source #

Arguments

:: String

Boundary

-> ByteString 
-> MultiPart 

Read a multi-part message from a ByteString.

hGetMultipartBody Source #

Arguments

:: String

Boundary

-> Handle 
-> IO MultiPart 

Read a multi-part message from a Handle. Fails on parse errors.

showMultipartBody :: String -> MultiPart -> ByteString Source #

Headers

type Headers = [(HeaderName, String)] Source #

HTTP headers.

newtype HeaderName Source #

A string with case insensitive equality and comparisons.

Constructors

HeaderName String 

Instances

Instances details
Eq HeaderName Source # 
Instance details

Defined in Network.Multipart.Header

Methods

(==) :: HeaderName -> HeaderName -> Bool

(/=) :: HeaderName -> HeaderName -> Bool

Ord HeaderName Source # 
Instance details

Defined in Network.Multipart.Header

Show HeaderName Source # 
Instance details

Defined in Network.Multipart.Header

Methods

showsPrec :: Int -> HeaderName -> ShowS

show :: HeaderName -> String

showList :: [HeaderName] -> ShowS

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
Eq ContentType Source # 
Instance details

Defined in Network.Multipart.Header

Methods

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

(/=) :: ContentType -> ContentType -> Bool

Ord ContentType Source # 
Instance details

Defined in Network.Multipart.Header

Read ContentType Source # 
Instance details

Defined in Network.Multipart.Header

Methods

readsPrec :: Int -> ReadS ContentType

readList :: ReadS [ContentType]

readPrec :: ReadPrec ContentType

readListPrec :: ReadPrec [ContentType]

Show ContentType Source # 
Instance details

Defined in Network.Multipart.Header

Methods

showsPrec :: Int -> ContentType -> ShowS

show :: ContentType -> String

showList :: [ContentType] -> ShowS

HeaderValue ContentType Source # 
Instance details

Defined in Network.Multipart.Header

data ContentTransferEncoding Source #

Constructors

ContentTransferEncoding String 

Instances

Instances details
Eq ContentTransferEncoding Source # 
Instance details

Defined in Network.Multipart.Header

Ord ContentTransferEncoding Source # 
Instance details

Defined in Network.Multipart.Header

Read ContentTransferEncoding Source # 
Instance details

Defined in Network.Multipart.Header

Show ContentTransferEncoding Source # 
Instance details

Defined in Network.Multipart.Header

HeaderValue ContentTransferEncoding Source # 
Instance details

Defined in Network.Multipart.Header

data ContentDisposition Source #

Constructors

ContentDisposition String [(String, String)] 

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.

getContentType :: MonadFail m => Headers -> m ContentType Source #