nghttp3_conn_read_stream

Synopsis

#include <nghttp3/nghttp3.h>

nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn, int64_t stream_id, const uint8_t *src, size_t srclen, int fin)

nghttp3_conn_read_stream() reads data src of length srclen on stream identified by stream_id. It returns the number of bytes consumed. The “consumed” means that application can increase flow control credit (both stream and connection) of underlying QUIC connection by that amount. It does not include the amount of data carried by DATA frame which contains application data (excluding any control or QPACK unidirectional streams) . See nghttp3_recv_data to handle those bytes. If fin is nonzero, this is the last data from remote endpoint in this stream.

This function returns the number of bytes consumed, or one of the following negative error codes:

NGHTTP3_ERR_NOMEM

Out of memory.

NGHTTP3_ERR_CALLBACK_FAILURE

User callback failed.

It may return the other error codes. The negative error code means that conn encountered a connection error, and the connection must be closed. Calling nghttp3 API other than nghttp3_conn_del() causes undefined behavior.