send_message_sync


Description:

public InputStream send_message_sync (Message message, Cancellable? cancellable = null) throws Error

Synchronously sends prepared message and returns InputStream that can be used to read its contents.

This calls send internally, but it also setups the message according to source authentication settings. It also extracts information about used certificate, in case of G_TLS_ERROR_BAD_CERTIFICATE error and keeps it for later use by get_ssl_error_details.

Use send_message_simple_sync to read whole content into a ByteArray.

Note that SoupSession doesn't log content read from GInputStream, thus the caller may print the read content on its own when needed.

Note the message is fully filled only after there is anything read from the resulting InputStream, thus use check_result to verify that the receive had been finished properly.

Make sure the InputStream is read and freed from the same thread, and with the same thread default main context, which this function was called from, otherwise it can break libsoup3.

Parameters:

this

an SoupSession

message

a Message to send

cancellable

optional Cancellable object, or null

Returns:

A newly allocated InputStream, that can be used to read from the URI pointed to by message. Free it with unref, when no longer needed.