Top |
SoupMultipartInputStream * | soup_multipart_input_stream_new () |
SoupMessageHeaders * | soup_multipart_input_stream_get_headers () |
GInputStream * | soup_multipart_input_stream_next_part () |
void | soup_multipart_input_stream_next_part_async () |
GInputStream * | soup_multipart_input_stream_next_part_finish () |
This adds support for the multipart responses. For handling the
multiple parts the user needs to wrap the GInputStream obtained by
sending the request with a SoupMultipartInputStream and use
soup_multipart_input_stream_next_part()
before reading. Responses
which are not wrapped will be treated like non-multipart responses.
Note that although SoupMultipartInputStream is a GInputStream, you should not read directly from it, and the results are undefined if you do.
SoupMultipartInputStream * soup_multipart_input_stream_new (SoupMessage *msg
,GInputStream *base_stream
);
Creates a new SoupMultipartInputStream that wraps the
GInputStream obtained by sending the SoupRequest. Reads should
not be done directly through this object, use the input streams
returned by soup_multipart_input_stream_next_part()
or its async
counterpart instead.
msg |
the SoupMessage the response is related to. |
|
base_stream |
the GInputStream returned by sending the request. |
Since: 2.40
SoupMessageHeaders *
soup_multipart_input_stream_get_headers
(SoupMultipartInputStream *multipart
);
Obtains the headers for the part currently being processed. Note
that the SoupMessageHeaders that are returned are owned by the
SoupMultipartInputStream and will be replaced when a call is made
to soup_multipart_input_stream_next_part()
or its async
counterpart, so if keeping the headers is required, a copy must be
made.
Note that if a part had no headers at all an empty SoupMessageHeaders will be returned.
a SoupMessageHeaders
containing the headers for the part currently being processed or
NULL
if the headers failed to parse.
[nullable][transfer none]
Since: 2.40
GInputStream * soup_multipart_input_stream_next_part (SoupMultipartInputStream *multipart
,GCancellable *cancellable
,GError **error
);
Obtains an input stream for the next part. When dealing with a multipart response the input stream needs to be wrapped in a SoupMultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.
After calling this function,
soup_multipart_input_stream_get_headers()
can be used to obtain the
headers for the first part. A read of 0 bytes indicates the end of
the part; a new call to this function should be done at that point,
to obtain the next part.
Since: 2.40
void soup_multipart_input_stream_next_part_async (SoupMultipartInputStream *multipart
,int io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer data
);
Obtains a GInputStream for the next request. See
soup_multipart_input_stream_next_part()
for details on the
workflow.
multipart |
||
io_priority |
the I/O priority for the request. |
|
cancellable |
a GCancellable. |
|
callback |
callback to call when request is satisfied. |
|
data |
data for |
Since: 2.40
GInputStream * soup_multipart_input_stream_next_part_finish (SoupMultipartInputStream *multipart
,GAsyncResult *result
,GError **error
);
Finishes an asynchronous request for the next part.
multipart |
||
result |
a GAsyncResult. |
|
error |
a GError location to store any error, or |
a newly created
GInputStream for reading the next part or NULL
if there are no
more parts.
[nullable][transfer full]
Since: 2.40
“message”
property“message” SoupMessage *
The SoupMessage.
Flags: Read / Write / Construct Only