case insensitive hostname validation (fix #2333) (#2337)

* Add Tests for case sensitive hostname verfication

* Modify check_host_name to perform case insensitive comparisons during ssl hostname validation

---------

Co-authored-by: Tabor, Chris <chris.tabor@commscope.com>
This commit is contained in:
ctabor-itracs
2026-01-23 14:58:47 -05:00
committed by GitHub
co-authored by Tabor, Chris
parent c3fa06112b
commit fbec2a3466
2 changed files with 45 additions and 4 deletions
+25
View File
@@ -8717,6 +8717,31 @@ TEST(SSLClientTest, WildcardHostNameMatch_Online) {
ASSERT_EQ(StatusCode::OK_200, res->status);
}
TEST(SSLClientTest, WildcardHostNameMatchCase_Online) {
SSLClient cli("wWw.YouTube.Com");
cli.set_ca_cert_path(CA_CERT_FILE);
cli.enable_server_certificate_verification(true);
cli.enable_server_hostname_verification(true);
cli.set_follow_location(true);
auto res = cli.Get("/");
ASSERT_TRUE(res);
ASSERT_EQ(StatusCode::OK_200, res->status);
}
TEST(SSLClientTest, HostNameMatchCase_Online) {
SSLClient cli("gOoGlE.COm");
cli.enable_server_certificate_verification(true);
cli.enable_server_hostname_verification(true);
cli.set_follow_location(true);
auto res = cli.Get("/");
ASSERT_TRUE(res);
ASSERT_EQ(StatusCode::OK_200, res->status);
}
TEST(SSLClientTest, Issue2004_Online) {
Client client("https://google.com");
client.set_follow_location(true);