#include <nng/nng.h> #include <nng/supplemental/http/http.h> void nng_http_conn_write_res(nng_http_conn *conn, nng_http_res *res, nng_aio *aio);
nng_http_conn_write_res - write HTTP response
nng_http_conn_write_res() function starts an asynchronous write of
the HTTP response res to the connection conn.
The entire response is sent,
including headers, and if present, the response body data.
(The response body can be set with
This function returns immediately, with no return value.
Completion of the operation is signaled via the aio, and the final result
may be obtained via
That result will either be zero or an error code.
By default, for
HTTP/1.1 connections, the connection is kept open, and
will be reused to receive new requests.
If however the res contains a header of
Connection: with a value
Close (case-insensitive) or the response corresponds to
then the connection is immediately after sending the response.
The operation was canceled.
The connection was closed.
The peer closed the connection.
Insufficient free memory to perform the operation.
HTTP operations are not supported.
Timeout waiting for data from the connection.