1.20 <SoupMultipartInputStream>

Class: <SoupMultipartInputStream>

It derives from <GFilterInputStream>.

Handles streams of multipart messages.

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 MultipartInputStream and use MultipartInputStream.next_part before reading. Responses which are not wrapped will be treated like non-multipart responses.

Note that although MultipartInputStream is a <GInputStream>, you should not read directly from it, and the results are undefined if you do.

Properties

Property: multipart-input-stream:message self

The Message.

Its value is a <SoupMessage>, or #f.

It can only be set when the object is made, with #:message.

Procedures

Method: multipart-input-stream:get-headers self ⇒ %return
Method: get-headers self ⇒ %return

Obtains the headers for the part currently being processed.

Note that the MessageHeaders that are returned are owned by the MultipartInputStream and will be replaced when a call is made to MultipartInputStream.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 MessageHeaders will be returned.

self

Passed: a <SoupMultipartInputStream>.

a <SoupMultipartInputStream>.

%return

Returned: a <SoupMessageHeaders>, or #f.

a <SoupMessageHeaders> containing the headers for the part currently being processed or #f if the headers failed to parse.

Procedure: multipart-input-stream:new msg base-stream ⇒ %return

Creates a new MultipartInputStream that wraps the <GInputStream> obtained by sending the Message.

Reads should not be done directly through this object, use the input streams returned by MultipartInputStream.next_part or its async counterpart instead.

msg

Passed: a <SoupMessage>.

the <SoupMessage> the response is related to.

base-stream

Passed: a <GInputStream>.

the <GInputStream> returned by sending the request.

%return

Returned: a <SoupMultipartInputStream>.

a new <SoupMultipartInputStream>

Method: multipart-input-stream:next-part self [cancellable] ⇒ %return
Method: next-part self [cancellable] ⇒ %return

Obtains an input stream for the next part.

When dealing with a multipart response the input stream needs to be wrapped in a MultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.

After calling this function, MultipartInputStream.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.

error will only be set if an error happens during a read, #f is a valid return value otherwise.

self

Passed: a <SoupMultipartInputStream>.

the <SoupMultipartInputStream>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

%return

Returned: a <GInputStream>, or #f.

a new <GInputStream>, or #f if there are no more parts

Method: multipart-input-stream:next-part-async self io-priority [cancellable] [callback]
Method: next-part-async self io-priority [cancellable] [callback]

Obtains a <GInputStream> for the next request.

See MultipartInputStream.next_part for details on the workflow.

self

Passed: a <SoupMultipartInputStream>.

the <SoupMultipartInputStream>.

io-priority

Passed: a 32-bit integer.

the I/O priority for the request.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>.

callback

Passed, or left out: a procedure, or #f.

callback to call when request is satisfied.

See GAsyncReadyCallback for how it is called.

data

Not passed: guile-gi supplies it.

data for callback

Method: multipart-input-stream:next-part-finish self result ⇒ %return
Method: next-part-finish self result ⇒ %return

Finishes an asynchronous request for the next part.

self

Passed: a <SoupMultipartInputStream>.

a <SoupMultipartInputStream>.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GInputStream>, or #f.

a newly created <GInputStream> for reading the next part or #f if there are no more parts.