From 910e02687df3245aae4bc519fb0bd7eb6a34db7d Mon Sep 17 00:00:00 2001 From: Ryan Goodfellow Date: Wed, 13 Oct 2021 05:32:37 +0000 Subject: [PATCH] fix(client): remove ipv6 square brackets before resolving --- src/client/connect/dns.rs | 1 - src/client/connect/http.rs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs index 0036fa2d8c..03f504291f 100644 --- a/src/client/connect/dns.rs +++ b/src/client/connect/dns.rs @@ -191,7 +191,6 @@ impl SocketAddrs { iter: vec![SocketAddr::V4(addr)].into_iter(), }); } - let host = host.trim_start_matches('[').trim_end_matches(']'); if let Ok(addr) = host.parse::() { let addr = SocketAddrV6::new(addr, port, 0, 0); return Some(SocketAddrs { diff --git a/src/client/connect/http.rs b/src/client/connect/http.rs index 50bb3309a0..8616c4a6ea 100644 --- a/src/client/connect/http.rs +++ b/src/client/connect/http.rs @@ -326,6 +326,7 @@ where let config = &self.config; let (host, port) = get_host_port(config, &dst)?; + let host = host.trim_start_matches('[').trim_end_matches(']'); // If the host is already an IP addr (v4 or v6), // skip resolving the dns and start connecting right away.