diff --git a/src/http2_test.cc b/src/http2_test.cc index 35dbe93f..13c927ef 100644 --- a/src/http2_test.cc +++ b/src/http2_test.cc @@ -270,4 +270,16 @@ void test_http2_parse_http_status_code(void) { CU_ASSERT(-1 == http2::parse_http_status_code("")); } +void test_http2_index_header(void) { + int hdidx[http2::HD_MAXIDX]; + http2::init_hdidx(hdidx); + + http2::index_header(hdidx, reinterpret_cast(":authority"), + 10, 0); + http2::index_header(hdidx, reinterpret_cast("hos"), 3, 1); + + CU_ASSERT(0 == hdidx[http2::HD_AUTHORITY]); + CU_ASSERT(-1 == hdidx[http2::HD_HOST]); +} + } // namespace shrpx diff --git a/src/http2_test.h b/src/http2_test.h index 9e1e2fc0..2cb8e69b 100644 --- a/src/http2_test.h +++ b/src/http2_test.h @@ -36,6 +36,7 @@ void test_http2_build_http1_headers_from_norm_headers(void); void test_http2_lws(void); void test_http2_rewrite_location_uri(void); void test_http2_parse_http_status_code(void); +void test_http2_index_header(void); } // namespace shrpx diff --git a/src/shrpx-unittest.cc b/src/shrpx-unittest.cc index 1e4e2041..f1eb2d83 100644 --- a/src/shrpx-unittest.cc +++ b/src/shrpx-unittest.cc @@ -86,6 +86,8 @@ int main(int argc, char *argv[]) { shrpx::test_http2_rewrite_location_uri) || !CU_add_test(pSuite, "http2_parse_http_status_code", shrpx::test_http2_parse_http_status_code) || + !CU_add_test(pSuite, "http2_index_header", + shrpx::test_http2_index_header) || !CU_add_test(pSuite, "downstream_normalize_request_headers", shrpx::test_downstream_normalize_request_headers) || !CU_add_test(pSuite, "downstream_normalize_response_headers",