From ab2aa5672b8edde45bd4af0da514fa2f12ba5af0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 17 Jan 2019 23:16:49 +0900 Subject: [PATCH] Fix test failure Now http_parser_parse_url returns nonzero if empty URI is given. --- src/http2.cc | 4 ++++ src/http2_test.cc | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) 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{};