Fix test failure

Now http_parser_parse_url returns nonzero if empty URI is given.
This commit is contained in:
Tatsuhiro Tsujikawa 2019-01-17 23:16:49 +09:00
parent ff87a54202
commit ab2aa5672b
2 changed files with 6 additions and 6 deletions

View File

@ -1581,6 +1581,10 @@ int construct_push_component(BlockAllocator &balloc, StringRef &scheme,
int rv; int rv;
StringRef rel, relq; StringRef rel, relq;
if (uri.size() == 0) {
return -1;
}
http_parser_url u{}; http_parser_url u{};
rv = http_parser_parse_url(uri.c_str(), uri.size(), 0, &u); rv = http_parser_parse_url(uri.c_str(), uri.size(), 0, &u);

View File

@ -995,12 +995,8 @@ void test_http2_construct_push_component(void) {
uri = StringRef{}; uri = StringRef{};
CU_ASSERT(0 == http2::construct_push_component(balloc, scheme, authority, CU_ASSERT(-1 == http2::construct_push_component(balloc, scheme, authority,
path, base, uri)); path, base, uri));
CU_ASSERT("" == scheme);
CU_ASSERT("" == authority);
CU_ASSERT("/" == path);
scheme = StringRef{}; scheme = StringRef{};
authority = StringRef{}; authority = StringRef{};
path = StringRef{}; path = StringRef{};