cgi-2006.9.6ContentsIndex
Network.CGI.Multipart
Portabilitynon-portable
Stabilityexperimental
Maintainerbjorn@bringert.net
Contents
Multi-part messages
Headers
Description
Parsing of the multipart format from RFC2046. Partly based on code from WASHMail.
Synopsis
data MultiPart = MultiPart [BodyPart]
data BodyPart = BodyPart [Header] ByteString
type Header = (String, String)
parseMultipartBody :: String -> ByteString -> Maybe MultiPart
hGetMultipartBody :: String -> Handle -> IO MultiPart
data ContentType = ContentType {
ctType :: String
ctSubtype :: String
ctParamaters :: [(String, String)]
}
data ContentTransferEncoding = ContentTransferEncoding String
data ContentDisposition = ContentDisposition String [(String, String)]
parseContentType :: Monad m => String -> m ContentType
parseContentTransferEncoding :: Monad m => String -> m ContentTransferEncoding
parseContentDisposition :: Monad m => String -> m ContentDisposition
getContentType :: Monad m => [Header] -> m ContentType
getContentTransferEncoding :: Monad m => [Header] -> m ContentTransferEncoding
getContentDisposition :: Monad m => [Header] -> m ContentDisposition
Multi-part messages
data MultiPart
Constructors
MultiPart [BodyPart]
show/hide Instances
data BodyPart
Constructors
BodyPart [Header] ByteString
show/hide Instances
type Header = (String, String)
parseMultipartBody
:: StringBoundary
-> ByteString
-> Maybe MultiPart
Read a multi-part message from a ByteString.
hGetMultipartBody
:: StringBoundary
-> Handle
-> IO MultiPart
Read a multi-part message from a Handle. Fails on parse errors.
Headers
data ContentType
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
ctType :: StringThe top-level media type, the general type of the data. Common examples are "text", "image", "audio", "video", "multipart", and "application".
ctSubtype :: StringThe media subtype, the specific data format. Examples include "plain", "html", "jpeg", "form-data", etc.
ctParamaters :: [(String, String)]Media type parameters. On common example is the charset parameter for the "text" top-level type, e.g. ("charset","ISO-8859-1").
show/hide Instances
data ContentTransferEncoding
Constructors
ContentTransferEncoding String
show/hide Instances
data ContentDisposition
Constructors
ContentDisposition String [(String, String)]
show/hide Instances
parseContentType :: Monad m => String -> m ContentType
Parse the standard representation of a content-type. If the input cannot be parsed, this function calls fail with a (hopefully) informative error message.
parseContentTransferEncoding :: Monad m => String -> m ContentTransferEncoding
parseContentDisposition :: Monad m => String -> m ContentDisposition
getContentType :: Monad m => [Header] -> m ContentType
getContentTransferEncoding :: Monad m => [Header] -> m ContentTransferEncoding
getContentDisposition :: Monad m => [Header] -> m ContentDisposition
Produced by Haddock version 0.7