diff --git a/src/http2.cc b/src/http2.cc index 74360a50..7299d070 100644 --- a/src/http2.cc +++ b/src/http2.cc @@ -1581,6 +1581,10 @@ int construct_push_component(BlockAllocator &balloc, StringRef &scheme, int rv; StringRef rel, relq; + if (uri.size() == 0) { + return -1; + } + http_parser_url u{}; rv = http_parser_parse_url(uri.c_str(), uri.size(), 0, &u); diff --git a/src/http2_test.cc b/src/http2_test.cc index 04c26110..114c6151 100644 --- a/src/http2_test.cc +++ b/src/http2_test.cc @@ -995,12 +995,8 @@ void test_http2_construct_push_component(void) { uri = StringRef{}; - CU_ASSERT(0 == http2::construct_push_component(balloc, scheme, authority, - path, base, uri)); - CU_ASSERT("" == scheme); - CU_ASSERT("" == authority); - CU_ASSERT("/" == path); - + CU_ASSERT(-1 == http2::construct_push_component(balloc, scheme, authority, + path, base, uri)); scheme = StringRef{}; authority = StringRef{}; path = StringRef{};