nghttp3_qpack_decoder_read_request
Synopsis
#include <nghttp3/nghttp3.h>
-
nghttp3_ssize nghttp3_qpack_decoder_read_request(nghttp3_qpack_decoder *decoder, nghttp3_qpack_stream_context *sctx, nghttp3_qpack_nv *nv, uint8_t *pflags, const uint8_t *src, size_t srclen, int fin)
nghttp3_qpack_decoder_read_request()reads request stream. The request stream is given as the buffer pointed by src of length srclen. sctx is the stream context, and it must be created bynghttp3_qpack_stream_context_new(). *pflags must be non-NULL pointer. nv must be non-NULL pointer.If this function succeeds, it assigns flags to *pflags. If *pflags has
NGHTTP3_QPACK_DECODE_FLAG_EMITset, a decoded HTTP field is assigned to nv. If *pflags hasNGHTTP3_QPACK_DECODE_FLAG_FINALset, an entire HTTP field section has been successfully decoded. If *pflags hasNGHTTP3_QPACK_DECODE_FLAG_BLOCKEDset, decoding is blocked due to required insert count.When an HTTP field is decoded, an application receives it in nv.
nv->nameandnv->valueare reference counted buffer, and their reference counts are already incremented for application use. Therefore, when application finishes processing nv, it must callnghttp3_rcbuf_decref(nv->name)andnghttp3_rcbuf_decref(nv->value), or memory leak might occur. Thesenghttp3_rcbufobjects hold the pointer tonghttp3_memthat is passed tonghttp3_qpack_decoder_new()(or eithernghttp3_conn_client_new()ornghttp3_conn_server_new()if it is used indirectly). As long as these objects are alive, the pointednghttp3_memobject must be available. Otherwise,nghttp3_rcbuf_decref()will cause undefined behavior.This function returns the number of bytes read, or one of the following negative error codes:
NGHTTP3_ERR_NOMEMOut of memory.
NGHTTP3_ERR_QPACK_FATALdecoder is in unrecoverable error state, and cannot be used anymore.
NGHTTP3_ERR_QPACK_DECOMPRESSION_FAILEDCould not interpret field line representations.
NGHTTP3_ERR_QPACK_HEADER_TOO_LARGEHTTP field is too large.