libsoup Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
#include <libsoup/soup.h> struct SoupMultipartInputStream; SoupMultipartInputStream * soup_multipart_input_stream_new (SoupMessage *msg
,GInputStream *base_stream
); SoupMessageHeaders * soup_multipart_input_stream_get_headers (SoupMultipartInputStream *multipart
); GInputStream * soup_multipart_input_stream_next_part (SoupMultipartInputStream *multipart
,GCancellable *cancellable
,GError **error
); void soup_multipart_input_stream_next_part_async (SoupMultipartInputStream *multipart
,int io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer data
); GInputStream * soup_multipart_input_stream_next_part_finish (SoupMultipartInputStream *multipart
,GAsyncResult *result
,GError **error
);
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.
|
the SoupMessage the response is related to. |
|
the GInputStream returned by sending the request. |
Returns : |
a new SoupMultipartInputStream |
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 SoupMultipartInputStream. |
Returns : |
a SoupMessageHeaders containing the headers
for the part currently being processed or NULL if the headers failed to
parse. [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.
|
the SoupMultipartInputStream |
|
a GCancellable |
|
a GError |
Returns : |
a new GInputStream, or NULL if
there are no more parts. [transfer full]
|
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.
|
the SoupMultipartInputStream. |
|
the I/O priority for the request. |
|
a GCancellable. |
|
callback to call when request is satisfied. |
|
data for callback
|
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.
|
a SoupMultipartInputStream. |
|
a GAsyncResult. |
|
a GError location to store any error, or NULL to ignore. |
Returns : |
a newly created GInputStream for
reading the next part or NULL if there are no more parts. [transfer full]
|
Since 2.40