Skip to content

Commit 86d0020

Browse files
committed
fix port parsing for odd # of digits
1 parent 2d01cfa commit 86d0020

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/detail/uri_parse.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ bool parse(string_view::const_iterator &it, string_view::const_iterator last,
316316
else if (!isdigit(it, last)) {
317317
return false;
318318
}
319+
continue;
319320
}
320321
else if (hp_state == hier_part_state::path) {
321322
if (*it == '?') {

test/uri_parse_test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ TEST(uri_parse_test, test_hierarchical_part_valid_host_valid_port_empty_path) {
125125
ASSERT_TRUE(uri.path().empty());
126126
}
127127

128+
TEST(uri_parse_test, test_hierarchical_part_valid_user_odd_digits_port) {
129+
test::uri uri("http://user@www.example.com:12345/foo");
130+
EXPECT_TRUE(uri.parse_uri());
131+
ASSERT_TRUE(uri.has_port());
132+
EXPECT_EQ("12345", uri.port());
133+
}
134+
128135
TEST(uri_parse_test, test_hierarchical_part_valid_host_port_path) {
129136
test::uri uri("http://www.example.com:80/path");
130137
EXPECT_TRUE(uri.parse_uri());

0 commit comments

Comments
 (0)