8 *#include <nghttp2/nghttp2.h>*
10 .. function:: ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, uint8_t *in, size_t inlen, int in_final)
13 Inflates name/value block stored in *in* with length *inlen*. This
14 function performs decompression. For each successful emission of
15 header name/value pair, :macro:`NGHTTP2_HD_INFLATE_EMIT` is set in
16 *\*inflate_flags* and name/value pair is assigned to the *nv_out*
17 and the function returns. The caller must not free the members of
20 The *nv_out* may include pointers to the memory region in the *in*.
21 The caller must retain the *in* while the *nv_out* is used.
23 The application should call this function repeatedly until the
24 ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and
25 return value is non-negative. This means the all input values are
26 processed successfully. Then the application must call
27 `nghttp2_hd_inflate_end_headers()` to prepare for the next header
30 The caller can feed complete compressed header block. It also can
31 feed it in several chunks. The caller must set *in_final* to
32 nonzero if the given input is the last block of the compressed
35 This function returns the number of bytes processed if it succeeds,
36 or one of the following negative error codes:
38 :macro:`NGHTTP2_ERR_NOMEM`
40 :macro:`NGHTTP2_ERR_HEADER_COMP`
41 Inflation process has failed.
42 :macro:`NGHTTP2_ERR_BUFFER_ERROR`
43 The heder field name or value is too large.
47 int inflate_header_block(nghttp2_hd_inflater *hd_inflater,
48 uint8_t *in, size_t inlen, int final)
54 int inflate_flags = 0;
56 rv = nghttp2_hd_inflate_hd(hd_inflater, &nv, &inflate_flags,
60 fprintf(stderr, "inflate failed with error code %zd", rv);
67 if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) {
68 fwrite(nv.name, nv.namelen, 1, stderr);
69 fprintf(stderr, ": ");
70 fwrite(nv.value, nv.valuelen, 1, stderr);
71 fprintf(stderr, "\n");
73 if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) {
74 nghttp2_hd_inflate_end_headers(hd_inflater);
77 if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 &&