mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 02:28:53 +08:00
Added function to pack and unpack WINDOW_UPDATE frame.
This commit is contained in:
@@ -145,6 +145,8 @@ int main(int argc, char* argv[])
|
||||
test_spdylay_frame_pack_syn_reply) ||
|
||||
!CU_add_test(pSuite, "frame_pack_headers",
|
||||
test_spdylay_frame_pack_headers) ||
|
||||
!CU_add_test(pSuite, "frame_pack_window_update",
|
||||
test_spdylay_frame_pack_window_update) ||
|
||||
!CU_add_test(pSuite, "frame_pack_settings",
|
||||
test_spdylay_frame_pack_settings) ||
|
||||
!CU_add_test(pSuite, "frame_nv_sort", test_spdylay_frame_nv_sort) ||
|
||||
|
||||
@@ -384,6 +384,33 @@ void test_spdylay_frame_pack_headers()
|
||||
test_spdylay_frame_pack_headers_with(SPDYLAY_PROTO_SPDY3);
|
||||
}
|
||||
|
||||
void test_spdylay_frame_pack_window_update()
|
||||
{
|
||||
spdylay_frame frame, oframe;
|
||||
uint8_t *buf = NULL;
|
||||
size_t buflen = 0;
|
||||
ssize_t framelen;
|
||||
spdylay_frame_window_update_init(&frame.window_update, SPDYLAY_PROTO_SPDY3,
|
||||
1000000007, 4096);
|
||||
framelen = spdylay_frame_pack_window_update(&buf, &buflen,
|
||||
&frame.window_update);
|
||||
CU_ASSERT(0 == spdylay_frame_unpack_window_update
|
||||
(&oframe.window_update,
|
||||
&buf[0], SPDYLAY_FRAME_HEAD_LENGTH,
|
||||
&buf[SPDYLAY_FRAME_HEAD_LENGTH],
|
||||
framelen-SPDYLAY_FRAME_HEAD_LENGTH));
|
||||
CU_ASSERT(1000000007 == oframe.window_update.stream_id);
|
||||
CU_ASSERT(4096 == oframe.window_update.delta_window_size);
|
||||
CU_ASSERT(SPDYLAY_PROTO_SPDY3 == oframe.headers.hd.version);
|
||||
CU_ASSERT(SPDYLAY_WINDOW_UPDATE == oframe.headers.hd.type);
|
||||
CU_ASSERT(SPDYLAY_CTRL_FLAG_NONE == oframe.headers.hd.flags);
|
||||
CU_ASSERT(framelen-SPDYLAY_FRAME_HEAD_LENGTH == oframe.ping.hd.length);
|
||||
free(buf);
|
||||
spdylay_frame_window_update_free(&oframe.window_update);
|
||||
spdylay_frame_window_update_free(&frame.window_update);
|
||||
}
|
||||
|
||||
|
||||
void test_spdylay_frame_pack_settings()
|
||||
{
|
||||
spdylay_frame frame, oframe;
|
||||
|
||||
@@ -34,6 +34,7 @@ void test_spdylay_frame_pack_goaway();
|
||||
void test_spdylay_frame_pack_syn_stream();
|
||||
void test_spdylay_frame_pack_syn_reply();
|
||||
void test_spdylay_frame_pack_headers();
|
||||
void test_spdylay_frame_pack_window_update();
|
||||
void test_spdylay_frame_pack_settings();
|
||||
void test_spdylay_frame_nv_sort();
|
||||
void test_spdylay_frame_nv_downcase();
|
||||
|
||||
Reference in New Issue
Block a user