nghttp2_hpack_encoder_write

Synopsis

#include <nghttp2v2/nghttp2.h>

int nghttp2_hpack_encoder_write(nghttp2_hpack_encoder *enc, nghttp2_buf *buf, const nghttp2_nv *nva, size_t nvlen)

nghttp2_hpack_encoder_write() encodes the nva of nvlen elements into buf.

This function expands buf as necessary to store the result. buf->last will be adjusted when data is written. buf can be empty buffer, that is initialized by nghttp2_buf_init(). If buf->begin is not NULL, it must be allocated by the same memory allocator passed to nghttp2_hpack_encoder_new().

After this function returns, it is safe to delete the nva.

This function returns 0 if it succeeds, or one of the following negative error codes:

NGHTTP2_ERR_NOMEM

Out of memory.

NGHTTP2_ERR_HPACK_FATAL

Encoding process has failed.