Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.Soup.Structs.Multipart
Description
Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046.
Of particular interest to HTTP are multipart/byte-ranges
and
multipart/form-data
,
Although the headers of a Multipart
body part will contain the
full headers from that body part, libsoup does not interpret them
according to MIME rules. For example, each body part is assumed to
have "binary" Content-Transfer-Encoding, even if its headers
explicitly state otherwise. In other words, don't try to use
Multipart
for handling real MIME multiparts.
Synopsis
- newtype Multipart = Multipart (ManagedPtr Multipart)
- multipartAppendFormFile :: (HasCallStack, MonadIO m) => Multipart -> Text -> Maybe Text -> Maybe Text -> Bytes -> m ()
- multipartAppendFormString :: (HasCallStack, MonadIO m) => Multipart -> Text -> Text -> m ()
- multipartAppendPart :: (HasCallStack, MonadIO m) => Multipart -> MessageHeaders -> Bytes -> m ()
- multipartFree :: (HasCallStack, MonadIO m) => Multipart -> m ()
- multipartGetLength :: (HasCallStack, MonadIO m) => Multipart -> m Int32
- multipartGetPart :: (HasCallStack, MonadIO m) => Multipart -> Int32 -> m (Bool, MessageHeaders, Bytes)
- multipartNew :: (HasCallStack, MonadIO m) => Text -> m Multipart
- multipartNewFromMessage :: (HasCallStack, MonadIO m) => MessageHeaders -> Bytes -> m (Maybe Multipart)
- multipartToMessage :: (HasCallStack, MonadIO m) => Multipart -> MessageHeaders -> m Bytes
Exported types
Memory-managed wrapper type.
Instances
Eq Multipart Source # | |
GBoxed Multipart Source # | |
Defined in GI.Soup.Structs.Multipart | |
ManagedPtrNewtype Multipart Source # | |
Defined in GI.Soup.Structs.Multipart Methods toManagedPtr :: Multipart -> ManagedPtr Multipart | |
TypedObject Multipart Source # | |
Defined in GI.Soup.Structs.Multipart | |
HasParentTypes Multipart Source # | |
Defined in GI.Soup.Structs.Multipart | |
IsGValue (Maybe Multipart) Source # | Convert |
Defined in GI.Soup.Structs.Multipart Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Multipart -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Multipart) | |
type ParentTypes Multipart Source # | |
Defined in GI.Soup.Structs.Multipart |
Methods
Click to display all available methods, including inherited ones
appendFormFile
multipartAppendFormFile Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Bytes |
|
-> m () |
Adds a new MIME part containing body
to multipart
Uses "Content-Disposition: form-data", as per the HTML forms specification.
appendFormString
multipartAppendFormString Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> Text |
|
-> Text |
|
-> m () |
Adds a new MIME part containing data
to multipart
.
Uses "Content-Disposition: form-data", as per the HTML forms specification.
appendPart
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> MessageHeaders |
|
-> Bytes |
|
-> m () |
Adds a new MIME part to multipart
with the given headers and body.
(The multipart will make its own copies of headers
and body
, so
you should free your copies if you are not using them for anything
else.)
free
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> m () |
Frees multipart
.
getLength
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> m Int32 | Returns: the number of body parts in |
Gets the number of body parts in multipart
.
getPart
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> Int32 |
|
-> m (Bool, MessageHeaders, Bytes) | Returns: |
Gets the indicated body part from multipart
.
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Multipart | Returns: a new empty |
Creates a new empty Multipart
with a randomly-generated
boundary string.
Note that mimeType
must be the full MIME type, including "multipart/".
See also: [ctormessage
.new_from_multipart].
newFromMessage
multipartNewFromMessage Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> MessageHeaders |
|
-> Bytes |
|
-> m (Maybe Multipart) | Returns: a new |
Parses headers
and body
to form a new Multipart
toMessage
Arguments
:: (HasCallStack, MonadIO m) | |
=> Multipart |
|
-> MessageHeaders |
|
-> m Bytes |
Serializes multipart
to destHeaders
and destBody
.