Copyright | (c) Peter Thiemann 20012002 (c) Bjorn Bringert 2005-2006 |
---|---|
License | BSD-style |
Maintainer | Anders Kaseorg <andersk@mit.edu> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Network.Multipart
Contents
Description
Parsing of the multipart format from RFC2046. Partly based on code from WASHMail.
Synopsis
- data MultiPart = MultiPart [BodyPart]
- data BodyPart = BodyPart Headers ByteString
- parseMultipartBody :: String -> ByteString -> MultiPart
- hGetMultipartBody :: String -> Handle -> IO MultiPart
- showMultipartBody :: String -> MultiPart -> ByteString
- type Headers = [(HeaderName, String)]
- newtype HeaderName = HeaderName String
- data ContentType = ContentType {}
- data ContentTransferEncoding = ContentTransferEncoding String
- data ContentDisposition = ContentDisposition String [(String, String)]
- parseContentType :: Monad m => String -> m ContentType
- getContentType :: Monad m => Headers -> m ContentType
- getContentTransferEncoding :: Monad m => Headers -> m ContentTransferEncoding
- getContentDisposition :: Monad m => Headers -> m ContentDisposition
Multi-part messages
Instances
Eq MultiPart Source # | |
Ord MultiPart Source # | |
Defined in Network.Multipart | |
Show MultiPart Source # | |
Constructors
BodyPart Headers ByteString |
Instances
Eq BodyPart Source # | |
Ord BodyPart Source # | |
Defined in Network.Multipart | |
Show BodyPart Source # | |
Arguments
:: String | Boundary |
-> ByteString | |
-> MultiPart |
Read a multi-part message from a ByteString
.
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
Eq HeaderName Source # | |
Defined in Network.Multipart.Header Methods (==) :: HeaderName -> HeaderName -> Bool Source # (/=) :: HeaderName -> HeaderName -> Bool Source # | |
Ord HeaderName Source # | |
Defined in Network.Multipart.Header Methods compare :: HeaderName -> HeaderName -> Ordering Source # (<) :: HeaderName -> HeaderName -> Bool Source # (<=) :: HeaderName -> HeaderName -> Bool Source # (>) :: HeaderName -> HeaderName -> Bool Source # (>=) :: HeaderName -> HeaderName -> Bool Source # max :: HeaderName -> HeaderName -> HeaderName Source # min :: HeaderName -> HeaderName -> HeaderName Source # | |
Show HeaderName Source # | |
Defined in Network.Multipart.Header |
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
|
Instances
Eq ContentType Source # | |
Defined in Network.Multipart.Header Methods (==) :: ContentType -> ContentType -> Bool Source # (/=) :: ContentType -> ContentType -> Bool Source # | |
Ord ContentType Source # | |
Defined in Network.Multipart.Header 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 # | |
Read ContentType Source # | |
Defined in Network.Multipart.Header | |
Show ContentType Source # | |
Defined in Network.Multipart.Header | |
HeaderValue ContentType Source # | |
Defined in Network.Multipart.Header Methods |
data ContentTransferEncoding Source #
Constructors
ContentTransferEncoding String |
Instances
data ContentDisposition Source #
Constructors
ContentDisposition String [(String, String)] |
Instances
Eq ContentDisposition Source # | |
Defined in Network.Multipart.Header Methods (==) :: ContentDisposition -> ContentDisposition -> Bool Source # (/=) :: ContentDisposition -> ContentDisposition -> Bool Source # | |
Ord ContentDisposition Source # | |
Defined in Network.Multipart.Header 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 # | |
Read ContentDisposition Source # | |
Defined in Network.Multipart.Header | |
Show ContentDisposition Source # | |
Defined in Network.Multipart.Header | |
HeaderValue ContentDisposition Source # | |
Defined in Network.Multipart.Header Methods |
parseContentType :: Monad 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 :: Monad m => Headers -> m ContentType Source #
getContentTransferEncoding :: Monad m => Headers -> m ContentTransferEncoding Source #
getContentDisposition :: Monad m => Headers -> m ContentDisposition Source #