diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index b1b22e20..b8379118 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -31,67 +31,61 @@ #include "nghttp2_helper.h" static const char *static_table[] = { - ":scheme", "http", - ":scheme", "https", - ":host", "", - ":path", "/", - ":method", "GET", - "accept", "", - "accept-charset", "", - "accept-encoding", "", - "accept-language", "", - "cookie", "", - "if-modified-since", "", - "user-agent", "", - "referer", "", - "authorization", "", - "allow", "", - "cache-control", "", - "connection", "", - "content-length", "", - "content-type", "", - "date", "", - "expect", "", - "from", "", - "if-match", "", - "if-none-match", "", - "if-range", "", - "if-unmodified-since", "", - "max-forwards", "", - "proxy-authorization", "", - "range", "", - "via", "", - - ":status", "200", - "age", "", - "cache-control", "", - "content-length", "", - "content-type", "", - "date", "", - "etag", "", - "expires", "", - "last-modified", "", - "server", "", - "set-cookie", "", - "vary", "", - "via", "", - "access-control-allow-origin", "", - "accept-ranges", "", - "allow", "", - "connection", "", - "content-disposition", "", - "content-encoding", "", - "content-language", "", - "content-location", "", - "content-range", "", - "link", "", - "location", "", - "proxy-authenticate", "", - "refresh", "", - "retry-after", "", - "strict-transport-security", "", - "transfer-encoding", "", - "www-authenticate", "", + /* 0 */ ":method", "GET", + /* 1 */ ":method", "POST", + /* 2 */ ":scheme", "http", + /* 3 */ ":scheme", "https", + /* 4 */ ":path", "/", + /* 5 */ ":status", "200", + /* 6 */ ":authority", "", + /* 7 */ "accept-charset", "", + /* 8 */ "accept-encoding", "", + /* 9 */ "accept-language", "", + /* 10 */ "accept-ranges", "", + /* 11 */ "accept", "", + /* 12 */ "access-control-allow-origin", "", + /* 13 */ "age", "", + /* 14 */ "allow", "", + /* 15 */ "authorization", "", + /* 16 */ "cache-control", "", + /* 17 */ "connection", "", + /* 18 */ "content-disposition", "", + /* 19 */ "content-encoding", "", + /* 20 */ "content-language", "", + /* 21 */ "content-length", "", + /* 22 */ "content-location", "", + /* 23 */ "content-range", "", + /* 24 */ "content-type", "", + /* 25 */ "cookie", "", + /* 26 */ "date", "", + /* 27 */ "etag", "", + /* 28 */ "expect", "", + /* 29 */ "expires", "", + /* 30 */ "from", "", + /* 31 */ "host", "", + /* 32 */ "if-match", "", + /* 33 */ "if-modified-since", "", + /* 34 */ "if-none-match", "", + /* 35 */ "if-range", "", + /* 36 */ "if-unmodified-since", "", + /* 37 */ "last-modified", "", + /* 38 */ "link", "", + /* 39 */ "location", "", + /* 40 */ "max-forwards", "", + /* 41 */ "proxy-authenticate", "", + /* 42 */ "proxy-authorization", "", + /* 43 */ "range", "", + /* 44 */ "referer", "", + /* 45 */ "refresh", "", + /* 46 */ "retry-after", "", + /* 47 */ "server", "", + /* 48 */ "set-cookie", "", + /* 49 */ "strict-transport-security", "", + /* 50 */ "transfer-encoding", "", + /* 51 */ "user-agent", "", + /* 52 */ "vary", "", + /* 53 */ "via", "", + /* 54 */ "www-authenticate", "", NULL }; diff --git a/tests/nghttp2_hd_test.c b/tests/nghttp2_hd_test.c index a7671810..216866b4 100644 --- a/tests/nghttp2_hd_test.c +++ b/tests/nghttp2_hd_test.c @@ -245,7 +245,7 @@ void test_nghttp2_hd_inflate_indname_inc(void) nghttp2_nv *resnva; nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 11, + CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 51, nv.value, nv.valuelen, 1, NGHTTP2_HD_SIDE_CLIENT)); CU_ASSERT(1 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset)); @@ -270,22 +270,22 @@ void test_nghttp2_hd_inflate_indname_inc_eviction(void) nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER); memset(value, '0', sizeof(value)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 2, + CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 7, value, sizeof(value), 1, NGHTTP2_HD_SIDE_CLIENT)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 3, + CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 8, value, sizeof(value), 1, NGHTTP2_HD_SIDE_CLIENT)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 4, + CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 9, value, sizeof(value), 1, NGHTTP2_HD_SIDE_CLIENT)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 5, + CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&buf, &buflen, &offset, 10, value, sizeof(value), 1, NGHTTP2_HD_SIDE_CLIENT)); CU_ASSERT(4 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset)); - CU_ASSERT(5 == resnva[0].namelen); - CU_ASSERT(0 == memcmp(":host", resnva[0].name, resnva[0].namelen)); + CU_ASSERT(14 == resnva[0].namelen); + CU_ASSERT(0 == memcmp("accept-charset", resnva[0].name, resnva[0].namelen)); CU_ASSERT(sizeof(value) == resnva[0].valuelen); nghttp2_nv_array_del(resnva);