Upgrade to 1.46.0
[platform/upstream/nghttp2.git] / doc / nghttp2_hd_deflate_hd_vec.rst
1
2 nghttp2_hd_deflate_hd_vec
3 =========================
4
5 Synopsis
6 --------
7
8 *#include <nghttp2/nghttp2.h>*
9
10 .. function:: ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, const nghttp2_vec *vec, size_t veclen, const nghttp2_nv *nva, size_t nvlen)
11
12     
13     Deflates the *nva*, which has the *nvlen* name/value pairs, into
14     the *veclen* size of buf vector *vec*.  The each size of buffer
15     must be set in len field of :type:`nghttp2_vec`.  If and only if
16     one chunk is filled up completely, next chunk will be used.  If
17     *vec* is not large enough to store the deflated header block, this
18     function fails with
19     :macro:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`.  The caller
20     should use `nghttp2_hd_deflate_bound()` to know the upper bound of
21     buffer size required to deflate given header name/value pairs.
22     
23     Once this function fails, subsequent call of this function always
24     returns :macro:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`.
25     
26     After this function returns, it is safe to delete the *nva*.
27     
28     This function returns the number of bytes written to *vec* if it
29     succeeds, or one of the following negative error codes:
30     
31     :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM`
32         Out of memory.
33     :macro:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`
34         Deflation process has failed.
35     :macro:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`
36         The provided *buflen* size is too small to hold the output.