2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2013 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include "nghttp2_hd_test.h"
30 #include <CUnit/CUnit.h>
32 #include "nghttp2_hd.h"
33 #include "nghttp2_frame.h"
34 #include "nghttp2_test_helper.h"
36 #define GET_TABLE_ENT(context, index) nghttp2_hd_table_get(context, index)
38 void test_nghttp2_hd_deflate(void) {
39 nghttp2_hd_deflater deflater;
40 nghttp2_hd_inflater inflater;
41 nghttp2_nv nva1[] = {MAKE_NV(":path", "/my-example/index.html"),
42 MAKE_NV(":scheme", "https"), MAKE_NV("hello", "world")};
43 nghttp2_nv nva2[] = {MAKE_NV(":path", "/script.js"),
44 MAKE_NV(":scheme", "https")};
45 nghttp2_nv nva3[] = {MAKE_NV("cookie", "k1=v1"), MAKE_NV("cookie", "k2=v2"),
46 MAKE_NV("via", "proxy")};
47 nghttp2_nv nva4[] = {MAKE_NV(":path", "/style.css"),
48 MAKE_NV("cookie", "k1=v1"), MAKE_NV("cookie", "k1=v1")};
49 nghttp2_nv nva5[] = {MAKE_NV(":path", "/style.css"),
50 MAKE_NV("x-nghttp2", "")};
57 mem = nghttp2_mem_default();
58 frame_pack_bufs_init(&bufs);
61 CU_ASSERT(0 == nghttp2_hd_deflate_init(&deflater, mem));
62 CU_ASSERT(0 == nghttp2_hd_inflate_init(&inflater, mem));
64 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva1, ARRLEN(nva1));
65 blocklen = nghttp2_bufs_len(&bufs);
68 CU_ASSERT(blocklen > 0);
69 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
71 CU_ASSERT(3 == out.nvlen);
72 assert_nv_equal(nva1, out.nva, 3);
75 nghttp2_bufs_reset(&bufs);
78 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, ARRLEN(nva2));
79 blocklen = nghttp2_bufs_len(&bufs);
82 CU_ASSERT(blocklen > 0);
83 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
85 CU_ASSERT(2 == out.nvlen);
86 assert_nv_equal(nva2, out.nva, 2);
89 nghttp2_bufs_reset(&bufs);
91 /* Third headers, including same header field name, but value is not
93 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva3, ARRLEN(nva3));
94 blocklen = nghttp2_bufs_len(&bufs);
97 CU_ASSERT(blocklen > 0);
98 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
100 CU_ASSERT(3 == out.nvlen);
101 assert_nv_equal(nva3, out.nva, 3);
104 nghttp2_bufs_reset(&bufs);
106 /* Fourth headers, including duplicate header fields. */
107 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva4, ARRLEN(nva4));
108 blocklen = nghttp2_bufs_len(&bufs);
111 CU_ASSERT(blocklen > 0);
112 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
114 CU_ASSERT(3 == out.nvlen);
115 assert_nv_equal(nva4, out.nva, 3);
118 nghttp2_bufs_reset(&bufs);
120 /* Fifth headers includes empty value */
121 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva5, ARRLEN(nva5));
122 blocklen = nghttp2_bufs_len(&bufs);
125 CU_ASSERT(blocklen > 0);
126 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
128 CU_ASSERT(2 == out.nvlen);
129 assert_nv_equal(nva5, out.nva, 2);
132 nghttp2_bufs_reset(&bufs);
135 nghttp2_bufs_free(&bufs);
136 nghttp2_hd_inflate_free(&inflater);
137 nghttp2_hd_deflate_free(&deflater);
140 void test_nghttp2_hd_deflate_same_indexed_repr(void) {
141 nghttp2_hd_deflater deflater;
142 nghttp2_hd_inflater inflater;
143 nghttp2_nv nva1[] = {MAKE_NV("cookie", "alpha"), MAKE_NV("cookie", "alpha")};
144 nghttp2_nv nva2[] = {MAKE_NV("cookie", "alpha"), MAKE_NV("cookie", "alpha"),
145 MAKE_NV("cookie", "alpha")};
152 mem = nghttp2_mem_default();
153 frame_pack_bufs_init(&bufs);
156 CU_ASSERT(0 == nghttp2_hd_deflate_init(&deflater, mem));
157 CU_ASSERT(0 == nghttp2_hd_inflate_init(&inflater, mem));
159 /* Encode 2 same headers. Emit 1 literal reprs and 1 index repr. */
160 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva1, ARRLEN(nva1));
161 blocklen = nghttp2_bufs_len(&bufs);
164 CU_ASSERT(blocklen > 0);
165 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
167 CU_ASSERT(2 == out.nvlen);
168 assert_nv_equal(nva1, out.nva, 2);
171 nghttp2_bufs_reset(&bufs);
173 /* Encode 3 same headers. This time, emits 3 index reprs. */
174 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, ARRLEN(nva2));
175 blocklen = nghttp2_bufs_len(&bufs);
178 CU_ASSERT(blocklen == 3);
179 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
181 CU_ASSERT(3 == out.nvlen);
182 assert_nv_equal(nva2, out.nva, 3);
185 nghttp2_bufs_reset(&bufs);
188 nghttp2_bufs_free(&bufs);
189 nghttp2_hd_inflate_free(&inflater);
190 nghttp2_hd_deflate_free(&deflater);
193 void test_nghttp2_hd_inflate_indexed(void) {
194 nghttp2_hd_inflater inflater;
197 nghttp2_nv nv = MAKE_NV(":path", "/");
201 mem = nghttp2_mem_default();
202 frame_pack_bufs_init(&bufs);
205 nghttp2_hd_inflate_init(&inflater, mem);
207 nghttp2_bufs_addb(&bufs, (1 << 7) | 4);
209 blocklen = nghttp2_bufs_len(&bufs);
211 CU_ASSERT(1 == blocklen);
212 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
214 CU_ASSERT(1 == out.nvlen);
216 assert_nv_equal(&nv, out.nva, 1);
219 nghttp2_bufs_reset(&bufs);
221 /* index = 0 is error */
222 nghttp2_bufs_addb(&bufs, 1 << 7);
224 blocklen = nghttp2_bufs_len(&bufs);
226 CU_ASSERT(1 == blocklen);
227 CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == inflate_hd(&inflater, &out, &bufs, 0));
229 nghttp2_bufs_free(&bufs);
230 nghttp2_hd_inflate_free(&inflater);
233 void test_nghttp2_hd_inflate_indname_noinc(void) {
234 nghttp2_hd_inflater inflater;
237 nghttp2_nv nv[] = {/* Huffman */
238 MAKE_NV("user-agent", "nghttp2"),
239 /* Expecting no huffman */
240 MAKE_NV("user-agent", "x")};
245 mem = nghttp2_mem_default();
246 frame_pack_bufs_init(&bufs);
249 nghttp2_hd_inflate_init(&inflater, mem);
251 for (i = 0; i < ARRLEN(nv); ++i) {
252 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 57, &nv[i], 0));
254 blocklen = nghttp2_bufs_len(&bufs);
256 CU_ASSERT(blocklen > 0);
257 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
259 CU_ASSERT(1 == out.nvlen);
260 assert_nv_equal(&nv[i], out.nva, 1);
261 CU_ASSERT(0 == inflater.ctx.hd_table.len);
264 nghttp2_bufs_reset(&bufs);
267 nghttp2_bufs_free(&bufs);
268 nghttp2_hd_inflate_free(&inflater);
271 void test_nghttp2_hd_inflate_indname_inc(void) {
272 nghttp2_hd_inflater inflater;
275 nghttp2_nv nv = MAKE_NV("user-agent", "nghttp2");
279 mem = nghttp2_mem_default();
280 frame_pack_bufs_init(&bufs);
283 nghttp2_hd_inflate_init(&inflater, mem);
285 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 57, &nv, 1));
287 blocklen = nghttp2_bufs_len(&bufs);
289 CU_ASSERT(blocklen > 0);
290 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
292 CU_ASSERT(1 == out.nvlen);
293 assert_nv_equal(&nv, out.nva, 1);
294 CU_ASSERT(1 == inflater.ctx.hd_table.len);
296 &nv, &GET_TABLE_ENT(&inflater.ctx, NGHTTP2_STATIC_TABLE_LENGTH +
297 inflater.ctx.hd_table.len - 1)->nv,
301 nghttp2_bufs_free(&bufs);
302 nghttp2_hd_inflate_free(&inflater);
305 void test_nghttp2_hd_inflate_indname_inc_eviction(void) {
306 nghttp2_hd_inflater inflater;
314 mem = nghttp2_mem_default();
315 frame_pack_bufs_init(&bufs);
318 nghttp2_hd_inflate_init(&inflater, mem);
320 memset(value, '0', sizeof(value));
322 nv.valuelen = sizeof(value);
324 nv.flags = NGHTTP2_NV_FLAG_NONE;
326 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 14, &nv, 1));
327 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 15, &nv, 1));
328 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 16, &nv, 1));
329 CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 17, &nv, 1));
331 blocklen = nghttp2_bufs_len(&bufs);
333 CU_ASSERT(blocklen > 0);
335 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
337 CU_ASSERT(4 == out.nvlen);
338 CU_ASSERT(14 == out.nva[0].namelen);
339 CU_ASSERT(0 == memcmp("accept-charset", out.nva[0].name, out.nva[0].namelen));
340 CU_ASSERT(sizeof(value) == out.nva[0].valuelen);
343 nghttp2_bufs_reset(&bufs);
345 CU_ASSERT(3 == inflater.ctx.hd_table.len);
347 nghttp2_bufs_free(&bufs);
348 nghttp2_hd_inflate_free(&inflater);
351 void test_nghttp2_hd_inflate_newname_noinc(void) {
352 nghttp2_hd_inflater inflater;
355 nghttp2_nv nv[] = {/* Expecting huffman for both */
356 MAKE_NV("my-long-content-length", "nghttp2"),
357 /* Expecting no huffman for both */
359 /* Huffman for key only */
360 MAKE_NV("my-long-content-length", "y"),
361 /* Huffman for value only */
362 MAKE_NV("x", "nghttp2")};
367 mem = nghttp2_mem_default();
368 frame_pack_bufs_init(&bufs);
371 nghttp2_hd_inflate_init(&inflater, mem);
372 for (i = 0; i < ARRLEN(nv); ++i) {
373 CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&bufs, &nv[i], 0));
375 blocklen = nghttp2_bufs_len(&bufs);
377 CU_ASSERT(blocklen > 0);
378 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
380 CU_ASSERT(1 == out.nvlen);
381 assert_nv_equal(&nv[i], out.nva, 1);
382 CU_ASSERT(0 == inflater.ctx.hd_table.len);
385 nghttp2_bufs_reset(&bufs);
388 nghttp2_bufs_free(&bufs);
389 nghttp2_hd_inflate_free(&inflater);
392 void test_nghttp2_hd_inflate_newname_inc(void) {
393 nghttp2_hd_inflater inflater;
396 nghttp2_nv nv = MAKE_NV("x-rel", "nghttp2");
400 mem = nghttp2_mem_default();
401 frame_pack_bufs_init(&bufs);
404 nghttp2_hd_inflate_init(&inflater, mem);
406 CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&bufs, &nv, 1));
408 blocklen = nghttp2_bufs_len(&bufs);
410 CU_ASSERT(blocklen > 0);
411 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
413 CU_ASSERT(1 == out.nvlen);
414 assert_nv_equal(&nv, out.nva, 1);
415 CU_ASSERT(1 == inflater.ctx.hd_table.len);
417 &nv, &GET_TABLE_ENT(&inflater.ctx, NGHTTP2_STATIC_TABLE_LENGTH +
418 inflater.ctx.hd_table.len - 1)->nv,
422 nghttp2_bufs_free(&bufs);
423 nghttp2_hd_inflate_free(&inflater);
426 void test_nghttp2_hd_inflate_clearall_inc(void) {
427 nghttp2_hd_inflater inflater;
435 mem = nghttp2_mem_default();
436 bufs_large_init(&bufs, 8192);
439 /* Total 4097 bytes space required to hold this entry */
440 nv.name = (uint8_t *)"alpha";
441 nv.namelen = strlen((char *)nv.name);
442 memset(value, '0', sizeof(value));
444 nv.valuelen = sizeof(value);
446 nv.flags = NGHTTP2_NV_FLAG_NONE;
448 nghttp2_hd_inflate_init(&inflater, mem);
450 CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&bufs, &nv, 1));
452 blocklen = nghttp2_bufs_len(&bufs);
454 CU_ASSERT(blocklen > 0);
455 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
457 CU_ASSERT(1 == out.nvlen);
458 assert_nv_equal(&nv, out.nva, 1);
459 CU_ASSERT(0 == inflater.ctx.hd_table.len);
464 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
466 CU_ASSERT(1 == out.nvlen);
467 assert_nv_equal(&nv, out.nva, 1);
468 CU_ASSERT(0 == inflater.ctx.hd_table.len);
471 nghttp2_bufs_reset(&bufs);
473 /* This time, 4096 bytes space required, which is just fits in the
475 nv.valuelen = sizeof(value) - 1;
477 CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&bufs, &nv, 1));
479 blocklen = nghttp2_bufs_len(&bufs);
481 CU_ASSERT(blocklen > 0);
482 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
484 CU_ASSERT(1 == out.nvlen);
485 assert_nv_equal(&nv, out.nva, 1);
486 CU_ASSERT(1 == inflater.ctx.hd_table.len);
489 nghttp2_bufs_reset(&bufs);
491 nghttp2_bufs_free(&bufs);
492 nghttp2_hd_inflate_free(&inflater);
495 void test_nghttp2_hd_inflate_zero_length_huffman(void) {
496 nghttp2_hd_inflater inflater;
498 /* Literal header without indexing - new name */
499 uint8_t data[] = {0x40, 0x01, 0x78 /* 'x' */, 0x80};
503 mem = nghttp2_mem_default();
504 frame_pack_bufs_init(&bufs);
508 nghttp2_bufs_add(&bufs, data, sizeof(data));
510 /* /\* Literal header without indexing - new name *\/ */
516 nghttp2_hd_inflate_init(&inflater, mem);
517 CU_ASSERT(4 == inflate_hd(&inflater, &out, &bufs, 0));
519 CU_ASSERT(1 == out.nvlen);
520 CU_ASSERT(1 == out.nva[0].namelen);
521 CU_ASSERT('x' == out.nva[0].name[0]);
522 CU_ASSERT(NULL == out.nva[0].value);
523 CU_ASSERT(0 == out.nva[0].valuelen);
526 nghttp2_bufs_free(&bufs);
527 nghttp2_hd_inflate_free(&inflater);
530 void test_nghttp2_hd_ringbuf_reserve(void) {
531 nghttp2_hd_deflater deflater;
532 nghttp2_hd_inflater inflater;
541 mem = nghttp2_mem_default();
542 frame_pack_bufs_init(&bufs);
545 nv.flags = NGHTTP2_NV_FLAG_NONE;
546 nv.name = (uint8_t *)"a";
547 nv.namelen = strlen((const char *)nv.name);
549 nv.value = malloc(nv.valuelen);
550 memset(nv.value, 0, nv.valuelen);
552 nghttp2_hd_deflate_init2(&deflater, 8000, mem);
553 nghttp2_hd_inflate_init(&inflater, mem);
555 nghttp2_hd_inflate_change_table_size(&inflater, 8000);
556 nghttp2_hd_deflate_change_table_size(&deflater, 8000);
558 for (i = 0; i < 150; ++i) {
559 memcpy(nv.value, &i, sizeof(i));
560 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, &nv, 1);
561 blocklen = nghttp2_bufs_len(&bufs);
564 CU_ASSERT(blocklen > 0);
566 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
568 CU_ASSERT(1 == out.nvlen);
569 assert_nv_equal(&nv, out.nva, 1);
572 nghttp2_bufs_reset(&bufs);
575 nghttp2_bufs_free(&bufs);
576 nghttp2_hd_inflate_free(&inflater);
577 nghttp2_hd_deflate_free(&deflater);
582 void test_nghttp2_hd_change_table_size(void) {
583 nghttp2_hd_deflater deflater;
584 nghttp2_hd_inflater inflater;
585 nghttp2_nv nva[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")};
586 nghttp2_nv nva2[] = {MAKE_NV(":path", "/")};
593 mem = nghttp2_mem_default();
594 frame_pack_bufs_init(&bufs);
598 nghttp2_hd_deflate_init(&deflater, mem);
599 nghttp2_hd_inflate_init(&inflater, mem);
601 /* inflater changes notifies 8000 max header table size */
602 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 8000));
603 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 8000));
605 CU_ASSERT(4096 == deflater.ctx.hd_table_bufsize_max);
607 CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
608 CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
610 /* This will emit encoding context update with header table size 4096 */
611 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
612 blocklen = nghttp2_bufs_len(&bufs);
615 CU_ASSERT(blocklen > 0);
616 CU_ASSERT(2 == deflater.ctx.hd_table.len);
617 CU_ASSERT(4096 == deflater.ctx.hd_table_bufsize_max);
619 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
620 CU_ASSERT(2 == inflater.ctx.hd_table.len);
621 CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max);
622 CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
625 nghttp2_bufs_reset(&bufs);
627 /* inflater changes header table size to 1024 */
628 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 1024));
629 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 1024));
631 CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max);
633 CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max);
634 CU_ASSERT(1024 == inflater.settings_hd_table_bufsize_max);
636 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
637 blocklen = nghttp2_bufs_len(&bufs);
640 CU_ASSERT(blocklen > 0);
641 CU_ASSERT(2 == deflater.ctx.hd_table.len);
642 CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max);
644 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
645 CU_ASSERT(2 == inflater.ctx.hd_table.len);
646 CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max);
647 CU_ASSERT(1024 == inflater.settings_hd_table_bufsize_max);
650 nghttp2_bufs_reset(&bufs);
652 /* inflater changes header table size to 0 */
653 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 0));
654 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 0));
656 CU_ASSERT(0 == deflater.ctx.hd_table.len);
657 CU_ASSERT(0 == deflater.ctx.hd_table_bufsize_max);
659 CU_ASSERT(0 == inflater.ctx.hd_table.len);
660 CU_ASSERT(0 == inflater.ctx.hd_table_bufsize_max);
661 CU_ASSERT(0 == inflater.settings_hd_table_bufsize_max);
663 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
664 blocklen = nghttp2_bufs_len(&bufs);
667 CU_ASSERT(blocklen > 0);
668 CU_ASSERT(0 == deflater.ctx.hd_table.len);
669 CU_ASSERT(0 == deflater.ctx.hd_table_bufsize_max);
671 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
672 CU_ASSERT(0 == inflater.ctx.hd_table.len);
673 CU_ASSERT(0 == inflater.ctx.hd_table_bufsize_max);
674 CU_ASSERT(0 == inflater.settings_hd_table_bufsize_max);
677 nghttp2_bufs_reset(&bufs);
679 nghttp2_bufs_free(&bufs);
680 nghttp2_hd_inflate_free(&inflater);
681 nghttp2_hd_deflate_free(&deflater);
683 /* Check table buffer is expanded */
684 frame_pack_bufs_init(&bufs);
686 nghttp2_hd_deflate_init2(&deflater, 8192, mem);
687 nghttp2_hd_inflate_init(&inflater, mem);
689 /* First inflater changes header table size to 8000 */
690 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 8000));
691 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 8000));
693 CU_ASSERT(8000 == deflater.ctx.hd_table_bufsize_max);
695 CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
696 CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
698 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
699 blocklen = nghttp2_bufs_len(&bufs);
702 CU_ASSERT(blocklen > 0);
703 CU_ASSERT(2 == deflater.ctx.hd_table.len);
704 CU_ASSERT(8000 == deflater.ctx.hd_table_bufsize_max);
706 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
707 CU_ASSERT(2 == inflater.ctx.hd_table.len);
708 CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
709 CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
712 nghttp2_bufs_reset(&bufs);
714 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 16383));
715 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 16383));
717 CU_ASSERT(8192 == deflater.ctx.hd_table_bufsize_max);
719 CU_ASSERT(16383 == inflater.ctx.hd_table_bufsize_max);
720 CU_ASSERT(16383 == inflater.settings_hd_table_bufsize_max);
722 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
723 blocklen = nghttp2_bufs_len(&bufs);
726 CU_ASSERT(blocklen > 0);
727 CU_ASSERT(2 == deflater.ctx.hd_table.len);
728 CU_ASSERT(8192 == deflater.ctx.hd_table_bufsize_max);
730 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
731 CU_ASSERT(2 == inflater.ctx.hd_table.len);
732 CU_ASSERT(8192 == inflater.ctx.hd_table_bufsize_max);
733 CU_ASSERT(16383 == inflater.settings_hd_table_bufsize_max);
736 nghttp2_bufs_reset(&bufs);
738 /* Lastly, check the error condition */
740 rv = nghttp2_hd_emit_table_size(&bufs, 25600);
742 CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == inflate_hd(&inflater, &out, &bufs, 0));
745 nghttp2_bufs_reset(&bufs);
747 nghttp2_hd_inflate_free(&inflater);
748 nghttp2_hd_deflate_free(&deflater);
750 /* Check that encoder can handle the case where its allowable buffer
751 size is less than default size, 4096 */
752 nghttp2_hd_deflate_init2(&deflater, 1024, mem);
753 nghttp2_hd_inflate_init(&inflater, mem);
755 CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max);
757 /* This emits context update with buffer size 1024 */
758 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
759 blocklen = nghttp2_bufs_len(&bufs);
762 CU_ASSERT(blocklen > 0);
763 CU_ASSERT(2 == deflater.ctx.hd_table.len);
764 CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max);
766 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
767 CU_ASSERT(2 == inflater.ctx.hd_table.len);
768 CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max);
769 CU_ASSERT(4096 == inflater.settings_hd_table_bufsize_max);
772 nghttp2_bufs_reset(&bufs);
774 nghttp2_hd_inflate_free(&inflater);
775 nghttp2_hd_deflate_free(&deflater);
777 /* Check that table size UINT32_MAX can be received */
778 nghttp2_hd_deflate_init2(&deflater, UINT32_MAX, mem);
779 nghttp2_hd_inflate_init(&inflater, mem);
781 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, UINT32_MAX));
782 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, UINT32_MAX));
784 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
785 blocklen = nghttp2_bufs_len(&bufs);
788 CU_ASSERT(UINT32_MAX == deflater.ctx.hd_table_bufsize_max);
790 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
791 CU_ASSERT(UINT32_MAX == inflater.ctx.hd_table_bufsize_max);
792 CU_ASSERT(UINT32_MAX == inflater.settings_hd_table_bufsize_max);
795 nghttp2_bufs_reset(&bufs);
797 nghttp2_hd_inflate_free(&inflater);
798 nghttp2_hd_deflate_free(&deflater);
800 /* Check that context update emitted twice */
801 nghttp2_hd_deflate_init2(&deflater, 4096, mem);
802 nghttp2_hd_inflate_init(&inflater, mem);
804 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 0));
805 CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 3000));
806 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 0));
807 CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 3000));
809 CU_ASSERT(0 == deflater.min_hd_table_bufsize_max);
810 CU_ASSERT(3000 == deflater.ctx.hd_table_bufsize_max);
812 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, 1);
813 blocklen = nghttp2_bufs_len(&bufs);
816 CU_ASSERT(3 < blocklen);
817 CU_ASSERT(3000 == deflater.ctx.hd_table_bufsize_max);
818 CU_ASSERT(UINT32_MAX == deflater.min_hd_table_bufsize_max);
820 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
821 CU_ASSERT(3000 == inflater.ctx.hd_table_bufsize_max);
822 CU_ASSERT(3000 == inflater.settings_hd_table_bufsize_max);
825 nghttp2_bufs_reset(&bufs);
827 nghttp2_hd_inflate_free(&inflater);
828 nghttp2_hd_deflate_free(&deflater);
830 nghttp2_bufs_free(&bufs);
833 static void check_deflate_inflate(nghttp2_hd_deflater *deflater,
834 nghttp2_hd_inflater *inflater,
835 nghttp2_nv *nva, size_t nvlen) {
841 frame_pack_bufs_init(&bufs);
844 rv = nghttp2_hd_deflate_hd_bufs(deflater, &bufs, nva, nvlen);
845 blocklen = nghttp2_bufs_len(&bufs);
848 CU_ASSERT(blocklen >= 0);
850 CU_ASSERT(blocklen == inflate_hd(inflater, &out, &bufs, 0));
852 CU_ASSERT(nvlen == out.nvlen);
853 assert_nv_equal(nva, out.nva, nvlen);
856 nghttp2_bufs_free(&bufs);
859 void test_nghttp2_hd_deflate_inflate(void) {
860 nghttp2_hd_deflater deflater;
861 nghttp2_hd_inflater inflater;
863 MAKE_NV(":status", "200 OK"),
864 MAKE_NV("access-control-allow-origin", "*"),
865 MAKE_NV("cache-control", "private, max-age=0, must-revalidate"),
866 MAKE_NV("content-length", "76073"),
867 MAKE_NV("content-type", "text/html"),
868 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
869 MAKE_NV("expires", "Sat, 27 Jul 2013 06:22:12 GMT"),
870 MAKE_NV("server", "Apache"),
871 MAKE_NV("vary", "foobar"),
872 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
873 MAKE_NV("x-cache", "MISS from alphabravo"),
874 MAKE_NV("x-cache-action", "MISS"),
875 MAKE_NV("x-cache-age", "0"),
876 MAKE_NV("x-cache-lookup", "MISS from alphabravo:3128"),
877 MAKE_NV("x-lb-nocache", "true"),
880 MAKE_NV(":status", "304 Not Modified"),
882 MAKE_NV("cache-control", "max-age=56682045"),
883 MAKE_NV("content-type", "text/css"),
884 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
885 MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"),
886 MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:15 GMT"),
887 MAKE_NV("vary", "Accept-Encoding"),
888 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
889 MAKE_NV("x-cache", "HIT from alphabravo"),
890 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128")};
892 MAKE_NV(":status", "304 Not Modified"),
894 MAKE_NV("cache-control", "max-age=56682072"),
895 MAKE_NV("content-type", "text/css"),
896 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
897 MAKE_NV("expires", "Thu, 14 May 2015 07:23:24 GMT"),
898 MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:13 GMT"),
899 MAKE_NV("vary", "Accept-Encoding"),
900 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
901 MAKE_NV("x-cache", "HIT from alphabravo"),
902 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
905 MAKE_NV(":status", "304 Not Modified"),
907 MAKE_NV("cache-control", "max-age=56682022"),
908 MAKE_NV("content-type", "text/css"),
909 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
910 MAKE_NV("expires", "Thu, 14 May 2015 07:22:34 GMT"),
911 MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:14 GMT"),
912 MAKE_NV("vary", "Accept-Encoding"),
913 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
914 MAKE_NV("x-cache", "HIT from alphabravo"),
915 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
918 MAKE_NV(":status", "304 Not Modified"),
920 MAKE_NV("cache-control", "max-age=4461139"),
921 MAKE_NV("content-type", "application/x-javascript"),
922 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
923 MAKE_NV("expires", "Mon, 16 Sep 2013 21:34:31 GMT"),
924 MAKE_NV("last-modified", "Thu, 05 May 2011 09:15:59 GMT"),
925 MAKE_NV("vary", "Accept-Encoding"),
926 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
927 MAKE_NV("x-cache", "HIT from alphabravo"),
928 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
931 MAKE_NV(":status", "304 Not Modified"),
933 MAKE_NV("cache-control", "max-age=18645951"),
934 MAKE_NV("content-type", "application/x-javascript"),
935 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
936 MAKE_NV("expires", "Fri, 28 Feb 2014 01:48:03 GMT"),
937 MAKE_NV("last-modified", "Tue, 12 Jul 2011 16:02:59 GMT"),
938 MAKE_NV("vary", "Accept-Encoding"),
939 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
940 MAKE_NV("x-cache", "HIT from alphabravo"),
941 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
944 MAKE_NV(":status", "304 Not Modified"),
946 MAKE_NV("cache-control", "max-age=31536000"),
947 MAKE_NV("content-type", "application/javascript"),
948 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
949 MAKE_NV("etag", "\"6807-4dc5b54e0dcc0\""),
950 MAKE_NV("expires", "Wed, 21 May 2014 08:32:17 GMT"),
951 MAKE_NV("last-modified", "Fri, 10 May 2013 11:18:51 GMT"),
952 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
953 MAKE_NV("x-cache", "HIT from alphabravo"),
954 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
957 MAKE_NV(":status", "304 Not Modified"),
959 MAKE_NV("cache-control", "max-age=31536000"),
960 MAKE_NV("content-type", "application/javascript"),
961 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
962 MAKE_NV("etag", "\"41c6-4de7d28585b00\""),
963 MAKE_NV("expires", "Thu, 12 Jun 2014 10:00:58 GMT"),
964 MAKE_NV("last-modified", "Thu, 06 Jun 2013 14:30:36 GMT"),
965 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
966 MAKE_NV("x-cache", "HIT from alphabravo"),
967 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
970 MAKE_NV(":status", "304 Not Modified"),
972 MAKE_NV("cache-control", "max-age=31536000"),
973 MAKE_NV("content-type", "application/javascript"),
974 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
975 MAKE_NV("etag", "\"19d6e-4dc5b35a541c0\""),
976 MAKE_NV("expires", "Wed, 21 May 2014 08:32:18 GMT"),
977 MAKE_NV("last-modified", "Fri, 10 May 2013 11:10:07 GMT"),
978 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
979 MAKE_NV("x-cache", "HIT from alphabravo"),
980 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
982 nghttp2_nv nv10[] = {
983 MAKE_NV(":status", "304 Not Modified"),
985 MAKE_NV("cache-control", "max-age=56682045"),
986 MAKE_NV("content-type", "text/css"),
987 MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
988 MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"),
989 MAKE_NV("last-modified", "Tue, 14 May 2013 07:21:53 GMT"),
990 MAKE_NV("vary", "Accept-Encoding"),
991 MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
992 MAKE_NV("x-cache", "HIT from alphabravo"),
993 MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
997 mem = nghttp2_mem_default();
999 nghttp2_hd_deflate_init(&deflater, mem);
1000 nghttp2_hd_inflate_init(&inflater, mem);
1002 check_deflate_inflate(&deflater, &inflater, nv1, ARRLEN(nv1));
1003 check_deflate_inflate(&deflater, &inflater, nv2, ARRLEN(nv2));
1004 check_deflate_inflate(&deflater, &inflater, nv3, ARRLEN(nv3));
1005 check_deflate_inflate(&deflater, &inflater, nv4, ARRLEN(nv4));
1006 check_deflate_inflate(&deflater, &inflater, nv5, ARRLEN(nv5));
1007 check_deflate_inflate(&deflater, &inflater, nv6, ARRLEN(nv6));
1008 check_deflate_inflate(&deflater, &inflater, nv7, ARRLEN(nv7));
1009 check_deflate_inflate(&deflater, &inflater, nv8, ARRLEN(nv8));
1010 check_deflate_inflate(&deflater, &inflater, nv9, ARRLEN(nv9));
1011 check_deflate_inflate(&deflater, &inflater, nv10, ARRLEN(nv10));
1013 nghttp2_hd_inflate_free(&inflater);
1014 nghttp2_hd_deflate_free(&deflater);
1017 void test_nghttp2_hd_no_index(void) {
1018 nghttp2_hd_deflater deflater;
1019 nghttp2_hd_inflater inflater;
1022 nghttp2_nv nva[] = {
1023 MAKE_NV(":method", "GET"), MAKE_NV(":method", "POST"),
1024 MAKE_NV(":path", "/foo"), MAKE_NV("version", "HTTP/1.1"),
1025 MAKE_NV(":method", "GET"),
1032 mem = nghttp2_mem_default();
1034 /* 1st :method: GET can be indexable, last one is not */
1035 for (i = 1; i < ARRLEN(nva); ++i) {
1036 nva[i].flags = NGHTTP2_NV_FLAG_NO_INDEX;
1039 frame_pack_bufs_init(&bufs);
1043 nghttp2_hd_deflate_init(&deflater, mem);
1044 nghttp2_hd_inflate_init(&inflater, mem);
1046 rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva));
1047 blocklen = nghttp2_bufs_len(&bufs);
1050 CU_ASSERT(blocklen > 0);
1051 CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0));
1053 CU_ASSERT(ARRLEN(nva) == out.nvlen);
1054 assert_nv_equal(nva, out.nva, ARRLEN(nva));
1056 CU_ASSERT(out.nva[0].flags == NGHTTP2_NV_FLAG_NONE);
1057 for (i = 1; i < ARRLEN(nva); ++i) {
1058 CU_ASSERT(out.nva[i].flags == NGHTTP2_NV_FLAG_NO_INDEX);
1061 nva_out_reset(&out);
1063 nghttp2_bufs_free(&bufs);
1064 nghttp2_hd_inflate_free(&inflater);
1065 nghttp2_hd_deflate_free(&deflater);
1068 void test_nghttp2_hd_deflate_bound(void) {
1069 nghttp2_hd_deflater deflater;
1070 nghttp2_nv nva[] = {MAKE_NV(":method", "GET"), MAKE_NV("alpha", "bravo")};
1072 size_t bound, bound2;
1075 mem = nghttp2_mem_default();
1076 frame_pack_bufs_init(&bufs);
1078 nghttp2_hd_deflate_init(&deflater, mem);
1080 bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva));
1082 CU_ASSERT(12 + 6 * 2 * 2 + nva[0].namelen + nva[0].valuelen + nva[1].namelen +
1086 nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva));
1088 CU_ASSERT(bound > (size_t)nghttp2_bufs_len(&bufs));
1090 bound2 = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva));
1092 CU_ASSERT(bound == bound2);
1094 nghttp2_bufs_free(&bufs);
1095 nghttp2_hd_deflate_free(&deflater);
1098 void test_nghttp2_hd_public_api(void) {
1099 nghttp2_hd_deflater *deflater;
1100 nghttp2_hd_inflater *inflater;
1101 nghttp2_nv nva[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")};
1108 mem = nghttp2_mem_default();
1110 CU_ASSERT(0 == nghttp2_hd_deflate_new(&deflater, 4096));
1111 CU_ASSERT(0 == nghttp2_hd_inflate_new(&inflater));
1113 buflen = nghttp2_hd_deflate_bound(deflater, nva, ARRLEN(nva));
1115 blocklen = nghttp2_hd_deflate_hd(deflater, buf, buflen, nva, ARRLEN(nva));
1117 CU_ASSERT(blocklen > 0);
1119 nghttp2_bufs_wrap_init(&bufs, buf, blocklen, mem);
1120 bufs.head->buf.last += blocklen;
1122 CU_ASSERT(blocklen == inflate_hd(inflater, NULL, &bufs, 0));
1124 nghttp2_bufs_wrap_free(&bufs);
1126 nghttp2_hd_inflate_del(inflater);
1127 nghttp2_hd_deflate_del(deflater);
1129 /* See NGHTTP2_ERR_INSUFF_BUFSIZE */
1130 CU_ASSERT(0 == nghttp2_hd_deflate_new(&deflater, 4096));
1133 nghttp2_hd_deflate_hd(deflater, buf, blocklen - 1, nva, ARRLEN(nva));
1135 CU_ASSERT(NGHTTP2_ERR_INSUFF_BUFSIZE == blocklen);
1137 nghttp2_hd_deflate_del(deflater);
1140 static size_t encode_length(uint8_t *buf, uint64_t n, size_t prefix) {
1141 size_t k = (1 << prefix) - 1;
1155 *buf++ = (1 << 7) | (n & 0x7f);
1158 *buf++ = (uint8_t)n;
1165 void test_nghttp2_hd_decode_length(void) {
1175 memset(buf, 0, sizeof(buf));
1176 len = encode_length(buf, UINT32_MAX, 7);
1178 rv = nghttp2_hd_decode_length(&out, &shift, &final, 0, 0, buf, buf + len, 7);
1180 CU_ASSERT((ssize_t)len == rv);
1181 CU_ASSERT(0 != final);
1182 CU_ASSERT(UINT32_MAX == out);
1184 /* Make sure that we can decode integer if we feed 1 byte at a
1191 for (i = 0; i < len; ++i, ++bufp) {
1192 rv = nghttp2_hd_decode_length(&out, &shift, &final, out, shift, bufp,
1202 CU_ASSERT(i == len - 1);
1203 CU_ASSERT(0 != final);
1204 CU_ASSERT(UINT32_MAX == out);
1206 /* Check overflow case */
1207 memset(buf, 0, sizeof(buf));
1208 len = encode_length(buf, 1ll << 32, 7);
1210 rv = nghttp2_hd_decode_length(&out, &shift, &final, 0, 0, buf, buf + len, 7);
1212 CU_ASSERT(-1 == rv);
1215 void test_nghttp2_hd_huff_encode(void) {
1218 nghttp2_bufs bufs, outbufs;
1219 nghttp2_hd_huff_decode_context ctx;
1220 const uint8_t t1[] = {22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11,
1221 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
1223 frame_pack_bufs_init(&bufs);
1224 frame_pack_bufs_init(&outbufs);
1226 rv = nghttp2_hd_huff_encode(&bufs, t1, sizeof(t1));
1230 nghttp2_hd_huff_decode_context_init(&ctx);
1232 len = nghttp2_hd_huff_decode(&ctx, &outbufs, bufs.cur->buf.pos,
1233 nghttp2_bufs_len(&bufs), 1);
1235 CU_ASSERT(nghttp2_bufs_len(&bufs) == len);
1236 CU_ASSERT((ssize_t)sizeof(t1) == nghttp2_bufs_len(&outbufs));
1238 CU_ASSERT(0 == memcmp(t1, outbufs.cur->buf.pos, sizeof(t1)));
1240 nghttp2_bufs_free(&bufs);
1241 nghttp2_bufs_free(&outbufs);