gi-soup-2.4.24: Libsoup bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 <literal>multipart/byte-ranges</literal> and <literal>multipart/form-data</literal>.

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.

Since: 2.26

Synopsis

Exported types

newtype Multipart Source #

Memory-managed wrapper type.

Constructors

Multipart (ManagedPtr Multipart) 

Instances

Instances details
Eq Multipart Source # 
Instance details

Defined in GI.Soup.Structs.Multipart

GBoxed Multipart Source # 
Instance details

Defined in GI.Soup.Structs.Multipart

ManagedPtrNewtype Multipart Source # 
Instance details

Defined in GI.Soup.Structs.Multipart

Methods

toManagedPtr :: Multipart -> ManagedPtr Multipart

TypedObject Multipart Source # 
Instance details

Defined in GI.Soup.Structs.Multipart

Methods

glibType :: IO GType

HasParentTypes Multipart Source # 
Instance details

Defined in GI.Soup.Structs.Multipart

IsGValue (Maybe Multipart) Source #

Convert Multipart to and from GValue. See toGValue and fromGValue.

Instance details

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 # 
Instance details

Defined in GI.Soup.Structs.Multipart

type ParentTypes Multipart = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

appendFormFile, appendFormString, appendPart, free, toMessage.

Getters

getLength, getPart.

Setters

None.

appendFormFile

multipartAppendFormFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a multipart (presumably of type "multipart/form-data")

-> Text

controlName: the name of the control associated with this file

-> Text

filename: the name of the file, or Nothing if not known

-> Text

contentType: the MIME type of the file, or Nothing if not known

-> Buffer

body: the file data

-> m () 

Adds a new MIME part containing body to multipart, using "Content-Disposition: form-data", as per the HTML forms specification. See formRequestNewFromMultipart for more details.

Since: 2.26

appendFormString

multipartAppendFormString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a multipart (presumably of type "multipart/form-data")

-> Text

controlName: the name of the control associated with data

-> Text

data: the body data

-> m () 

Adds a new MIME part containing data to multipart, using "Content-Disposition: form-data", as per the HTML forms specification. See formRequestNewFromMultipart for more details.

Since: 2.26

appendPart

multipartAppendPart Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a Multipart

-> MessageHeaders

headers: the MIME part headers

-> Buffer

body: the MIME part body

-> 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.)

Since: 2.26

free

multipartFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a Multipart

-> m () 

Frees multipart

Since: 2.26

getLength

multipartGetLength Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a Multipart

-> m Int32

Returns: the number of body parts in multipart

Gets the number of body parts in multipart

Since: 2.26

getPart

multipartGetPart Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a Multipart

-> Int32

part: the part number to get (counting from 0)

-> m (Bool, MessageHeaders, Buffer)

Returns: True on success, False if part is out of range (in which case headers and body won't be set)

Gets the indicated body part from multipart.

Since: 2.26

new

multipartNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

mimeType: the MIME type of the multipart to create.

-> m Multipart

Returns: a new empty Multipart of the given mimeType

Creates a new empty Multipart with a randomly-generated boundary string. Note that mimeType must be the full MIME type, including "multipart/".

Since: 2.26

newFromMessage

multipartNewFromMessage Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MessageHeaders

headers: the headers of the HTTP message to parse

-> MessageBody

body: the body of the HTTP message to parse

-> m (Maybe Multipart)

Returns: a new Multipart (or Nothing if the message couldn't be parsed or wasn't multipart).

Parses headers and body to form a new Multipart

Since: 2.26

toMessage

multipartToMessage Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Multipart

multipart: a Multipart

-> MessageHeaders

destHeaders: the headers of the HTTP message to serialize multipart to

-> MessageBody

destBody: the body of the HTTP message to serialize multipart to

-> m () 

Serializes multipart to destHeaders and destBody.

Since: 2.26