Skip to content

Commit

Permalink
fix URIParser bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim committed Dec 3, 2021
1 parent 802c224 commit a13d5d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/URIParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ int URIParser::parse(const char *str, ParsedURI& uri)
break;

case URI_PATH:
if (skip_path)
continue;

start_idx[URI_PATH] = i;
break;

Expand Down
4 changes: 4 additions & 0 deletions test/uriparser_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,9 @@ TEST(uriparser_unittest, parse)
EXPECT_EQ(uri.path, nullptr);
EXPECT_EQ(uri.query, nullptr);
EXPECT_EQ(uri.fragment, nullptr);

EXPECT_EQ(URIParser::parse("http://www.sogou.com?aaa/=bbb", uri), 0);
EXPECT_EQ(uri.path, nullptr);
EXPECT_EQ(strcmp(uri.query, "aaa/=bbb"), 0);
}

0 comments on commit a13d5d5

Please sign in to comment.