Top | ![]() |
![]() |
![]() |
![]() |
SoupMultipart * | soup_multipart_new () |
SoupMultipart * | soup_multipart_new_from_message () |
void | soup_multipart_free () |
int | soup_multipart_get_length () |
gboolean | soup_multipart_get_part () |
void | soup_multipart_append_part () |
void | soup_multipart_append_form_string () |
void | soup_multipart_append_form_file () |
void | soup_multipart_to_message () |
SoupMultipart *
soup_multipart_new (const char *mime_type
);
Creates a new empty SoupMultipart with a randomly-generated
boundary string. Note that mime_type
must be the full MIME type,
including "multipart/".
a new empty SoupMultipart of the given mime_type
See also: soup_message_new_from_multipart()
SoupMultipart * soup_multipart_new_from_message (SoupMessageHeaders *headers
,GBytes *body
);
Parses headers
and body
to form a new SoupMultipart
headers |
the headers of the HTTP message to parse |
|
body |
the body of the HTTP message to parse |
a new SoupMultipart (or NULL
if the
message couldn't be parsed or wasn't multipart).
[nullable]
int
soup_multipart_get_length (SoupMultipart *multipart
);
Gets the number of body parts in multipart
gboolean soup_multipart_get_part (SoupMultipart *multipart
,int part
,SoupMessageHeaders **headers
,GBytes **body
);
Gets the indicated body part from multipart
.
void soup_multipart_append_part (SoupMultipart *multipart
,SoupMessageHeaders *headers
,GBytes *body
);
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.)
void soup_multipart_append_form_string (SoupMultipart *multipart
,const char *control_name
,const char *data
);
Adds a new MIME part containing data
to multipart
, using
"Content-Disposition: form-data", as per the HTML forms
specification.
void soup_multipart_append_form_file (SoupMultipart *multipart
,const char *control_name
,const char *filename
,const char *content_type
,GBytes *body
);
Adds a new MIME part containing body
to multipart
, using
"Content-Disposition: form-data", as per the HTML forms
specification.
void soup_multipart_to_message (SoupMultipart *multipart
,SoupMessageHeaders *dest_headers
,GBytes **dest_body
);
Serializes multipart
to dest_headers
and dest_body
.
typedef struct _SoupMultipart SoupMultipart;
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 SoupMultipart 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 SoupMultipart for handling real MIME multiparts.