1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibURL: Convert ASCII only URLs to lowercase during parsing

This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.
This commit is contained in:
Tim Ledbetter 2024-06-10 09:22:56 +01:00 committed by Tim Flynn
parent fd98076aca
commit 1a4b042664
Notes: sideshowbarker 2024-07-17 06:40:35 +09:00
2 changed files with 24 additions and 1 deletions

View file

@ -489,3 +489,24 @@ TEST_CASE(username_and_password)
EXPECT_EQ(MUST(url.password()), password);
}
}
TEST_CASE(ascii_only_url)
{
{
constexpr auto upper_case_url = "HTTP://EXAMPLE.COM:80/INDEX.HTML#FRAGMENT"sv;
URL::URL url(upper_case_url);
EXPECT(url.is_valid());
EXPECT_EQ(url.scheme(), "http");
EXPECT_EQ(MUST(url.serialized_host()), "example.com"sv);
EXPECT_EQ(url.to_byte_string(), "http://example.com/INDEX.HTML#FRAGMENT");
}
{
constexpr auto mixed_case_url = "hTtP://eXaMpLe.CoM:80/iNdEx.HtMl#fRaGmEnT"sv;
URL::URL url(mixed_case_url);
EXPECT(url.is_valid());
EXPECT_EQ(url.scheme(), "http");
EXPECT_EQ(MUST(url.serialized_host()), "example.com"sv);
EXPECT_EQ(url.to_byte_string(), "http://example.com/iNdEx.HtMl#fRaGmEnT");
}
}