get_response


Description:

public unowned string get_response (out ssize_t length)

Returns the server's response to the upload operation performed by the UploadStream .

If the operation is still underway, or the server's response hasn't been received yet, null is returned and length is set to -1.

If there was an error during the upload operation (but it is complete), null is returned, and length is set to 0.

While it is safe to call this function from any thread at any time during the network operation, the only way to guarantee that the response has been set before calling this function is to have closed the UploadStream by calling close on it, without cancelling the close operation. Once the stream has been closed, all network communication is guaranteed to have finished. Note that if a call to close is cancelled, is_closed will immediately start to return true, even if the UploadStream is still attempting to flush the network buffers asynchronously — consequently, get_response may still return null and a length of -1. The only reliable way to determine if the stream has been fully closed in this situation is to check the results of get_response , rather than is_closed.

Parameters:

this

a UploadStream

length

return location for the length of the response, or null

Returns:

the server's response to the upload, or null