From bf03b45abe0f848725062a2239d5b57198582b93 Mon Sep 17 00:00:00 2001 From: Jan Mazur Date: Thu, 17 Oct 2024 22:33:10 +0100 Subject: [PATCH] strip square brackets to parse ipv6 --- openssl/src/ssl/connector.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/openssl/src/ssl/connector.rs b/openssl/src/ssl/connector.rs index 66d1bd8939..d54729c667 100644 --- a/openssl/src/ssl/connector.rs +++ b/openssl/src/ssl/connector.rs @@ -395,6 +395,7 @@ cfg_if! { let param = ssl.param_mut(); param.set_hostflags(X509CheckFlags::NO_PARTIAL_WILDCARDS); + let domain = domain.strip_prefix("[").and_then(|x| x.strip_suffix("]")).unwrap_or(domain); match domain.parse() { Ok(ip) => param.set_ip(ip), Err(_) => param.set_host(domain),