Commit 109b8ced authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Fix compile error and test failures

parent e78a2100
...@@ -79,6 +79,7 @@ void test_nghttp2_frame_pack_headers() ...@@ -79,6 +79,7 @@ void test_nghttp2_frame_pack_headers()
nghttp2_nv *nva; nghttp2_nv *nva;
ssize_t nvlen; ssize_t nvlen;
nva_out out; nva_out out;
ssize_t nv_offset;
nva_out_init(&out); nva_out_init(&out);
nghttp2_hd_deflate_init(&deflater, NGHTTP2_HD_SIDE_REQUEST); nghttp2_hd_deflate_init(&deflater, NGHTTP2_HD_SIDE_REQUEST);
...@@ -102,9 +103,10 @@ void test_nghttp2_frame_pack_headers() ...@@ -102,9 +103,10 @@ void test_nghttp2_frame_pack_headers()
/* We didn't include PRIORITY flag so priority is not packed */ /* We didn't include PRIORITY flag so priority is not packed */
CU_ASSERT(1 << 30 == oframe.pri); CU_ASSERT(1 << 30 == oframe.pri);
CU_ASSERT(framelen - (ssize_t)bufoff - 8 == nv_offset = bufoff + NGHTTP2_FRAME_HEAD_LENGTH;
CU_ASSERT(framelen - nv_offset ==
inflate_hd(&inflater, &out, inflate_hd(&inflater, &out,
buf + bufoff + 8, framelen - bufoff - 8)); buf + nv_offset, framelen - nv_offset));
CU_ASSERT(7 == out.nvlen); CU_ASSERT(7 == out.nvlen);
CU_ASSERT(nvnameeq("method", &out.nva[0])); CU_ASSERT(nvnameeq("method", &out.nva[0]));
...@@ -128,8 +130,10 @@ void test_nghttp2_frame_pack_headers() ...@@ -128,8 +130,10 @@ void test_nghttp2_frame_pack_headers()
1000000007, &oframe.hd); 1000000007, &oframe.hd);
CU_ASSERT(1 << 20 == oframe.pri); CU_ASSERT(1 << 20 == oframe.pri);
CU_ASSERT(framelen - 12 == nv_offset = bufoff + NGHTTP2_FRAME_HEAD_LENGTH + 4;
inflate_hd(&inflater, &out, buf + 12, framelen - 12)); CU_ASSERT(framelen - nv_offset ==
inflate_hd(&inflater, &out,
buf + nv_offset, framelen - nv_offset));
nghttp2_nv_array_sort(out.nva, out.nvlen); nghttp2_nv_array_sort(out.nva, out.nvlen);
CU_ASSERT(nvnameeq("method", &out.nva[0])); CU_ASSERT(nvnameeq("method", &out.nva[0]));
......
...@@ -797,6 +797,7 @@ void test_nghttp2_session_recv_premature_headers(void) ...@@ -797,6 +797,7 @@ void test_nghttp2_session_recv_premature_headers(void)
my_user_data ud; my_user_data ud;
nghttp2_hd_deflater deflater; nghttp2_hd_deflater deflater;
nghttp2_outbound_item *item; nghttp2_outbound_item *item;
size_t bufoff = 0;
memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks));
...@@ -808,14 +809,16 @@ void test_nghttp2_session_recv_premature_headers(void) ...@@ -808,14 +809,16 @@ void test_nghttp2_session_recv_premature_headers(void)
nghttp2_frame_headers_init(&frame.headers, NGHTTP2_FLAG_END_HEADERS, nghttp2_frame_headers_init(&frame.headers, NGHTTP2_FLAG_END_HEADERS,
1, NGHTTP2_PRI_DEFAULT, nva, nvlen); 1, NGHTTP2_PRI_DEFAULT, nva, nvlen);
framedatalen = nghttp2_frame_pack_headers(&framedata, &framedatacap, framedatalen = nghttp2_frame_pack_headers(&framedata, &framedatacap,
&bufoff,
&frame.headers, &frame.headers,
&deflater); &deflater);
nghttp2_frame_headers_free(&frame.headers); nghttp2_frame_headers_free(&frame.headers);
/* Intentionally feed payload cutting last 1 byte off */ /* Intentionally feed payload cutting last 1 byte off */
nghttp2_put_uint16be(framedata, frame.hd.length - 1); nghttp2_put_uint16be(framedata + bufoff, frame.hd.length - 1);
rv = nghttp2_session_mem_recv(session, framedata, framedatalen - 1); rv = nghttp2_session_mem_recv(session, framedata + bufoff,
CU_ASSERT((ssize_t)framedatalen - 1 == rv); framedatalen - bufoff - 1);
CU_ASSERT((ssize_t)framedatalen - bufoff - 1 == rv);
item = nghttp2_session_get_next_ob_item(session); item = nghttp2_session_get_next_ob_item(session);
CU_ASSERT(NULL != item); CU_ASSERT(NULL != item);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment