write_head


Description:

[ Version ( since = "0.2" ) ]
public bool write_head (out size_t bytes_written, Cancellable? cancellable = null) throws IOError

Write status line and headers into the connection stream, emitting 'wrote-status-line' and 'wrote-headers' signals in the process.

This is invoked automatically when accessing the response body for the first time and when the response is disposed.

Once the 'wrote-status-line' has been emmitted, its handler is free to modify the response headers accordingly.

Once the 'wrote-headers' has been emmited, its handler may still apply converter on the body.

GLib.Once is used to ensure that this is called only once: additionnal calls will be simply ignored and 'true' will be returned.

Even if the write process fails or is cancelled, the head will be marked as written since further calls cannot save the response.

Note that even if the head has been written into the connection stream, it has not been flushed. This is designed to avoid the number of I/O operations necessary to send the response.

Parameters:

bytes_written

number of bytes written in the stream see GLib.OutputStream.write_all

Returns:

wether the head was effectively written