## SoupMultipartInputStream

SoupMultipartInputStream — Multipart input handling stream

## Functions

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

## Properties

SoupMessage * | message | Read / Write / Construct Only

## Types and Values

| SoupMultipartInputStream

## Object Hierarchy

        GObject
        ╰── GInputStream
            ╰── GFilterInputStream
                ╰── SoupMultipartInputStream

## Implemented Interfaces

SoupMultipartInputStream implements GPollableInputStream.

## Includes

    #include <libsoup/soup.h>

## Description

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.

## Functions

### soup_multipart_input_stream_new ()

    SoupMultipartInputStream *
    soup_multipart_input_stream_new (SoupMessage *msg,
                                     GInputStream *base_stream);

Creates a new SoupMultipartInputStream that wraps the GInputStream obtained by sending the SoupMessage. 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.

#### Parameters

msg | the SoupMessage the response is related to. |
base_stream | the GInputStream returned by sending the request. |

#### Returns

a new SoupMultipartInputStream

### soup_multipart_input_stream_get_headers ()

    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.

#### Parameters

multipart | a SoupMultipartInputStream. |

#### Returns

a SoupMessageHeaders containing the headers for the part currently being processed or `NULL` if the headers failed to parse.

[nullable][transfer none]

### soup_multipart_input_stream_next_part ()

    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.

#### Parameters

multipart | the SoupMultipartInputStream |
cancellable | a GCancellable |
error | a GError |

#### Returns

a new GInputStream, or `NULL` if there are no more parts.

[nullable][transfer full]

### soup_multipart_input_stream_next_part_async ()

    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.

#### Parameters

multipart | the SoupMultipartInputStream. |
io_priority | the I/O priority for the request. |
cancellable | a GCancellable. |
callback | callback to call when request is satisfied. |
data | data for `callback` |

### soup_multipart_input_stream_next_part_finish ()

    GInputStream *
    soup_multipart_input_stream_next_part_finish
                                   (SoupMultipartInputStream *multipart,
                                    GAsyncResult *result,
                                    GError **error);

Finishes an asynchronous request for the next part.

#### Parameters

multipart | a SoupMultipartInputStream. |
result | a GAsyncResult. |
error | 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.

[nullable][transfer full]

## Types and Values

### SoupMultipartInputStream

    typedef struct _SoupMultipartInputStream SoupMultipartInputStream;

Class for handling streams of multipart messages.

## Property Details

### The `“message”` property

      “message”                  SoupMessage *

The SoupMessage.

Owner: SoupMultipartInputStream

Flags: Read / Write / Construct Only