Skip to content

Commit 9b4c4b4

Browse files
committed
fix: resolve replicates ref fragment in all cases
fix #920
1 parent e9bec4c commit 9b4c4b4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/url_base.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,8 @@ resolve(
15801580
if(ref.has_fragment())
15811581
set_encoded_fragment(
15821582
ref.encoded_fragment());
1583+
else
1584+
remove_fragment();
15831585
return {};
15841586
}
15851587
if(ref.is_path_absolute())

test/unit/url.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,15 @@ struct url_test
10471047
BOOST_TEST_CSTR_EQ(u, "https:path2");
10481048
}
10491049
}
1050+
1051+
// issue #920
1052+
{
1053+
url u("https://www.example.org/path/index.html?a%20b=5%206&x%20y=34#frag");
1054+
url ref("?asdf%20qwer=1%202%20");
1055+
BOOST_TEST(u.resolve(ref));
1056+
BOOST_TEST_CSTR_EQ(u.buffer(), "https://www.example.org/path/index.html?asdf%20qwer=1%202%20");
1057+
BOOST_TEST(!u.has_fragment());
1058+
}
10501059
}
10511060

10521061
//--------------------------------------------

0 commit comments

Comments
 (0)