From 8901dcc53570a78ee1acfd81b351c2086e00bad5 Mon Sep 17 00:00:00 2001 From: "Mark T. B. Carroll" Date: Tue, 6 Jun 2023 13:47:09 +0100 Subject: [PATCH] remove [] enclosing IPv6 host address --- src/client.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client.rs b/src/client.rs index 9301939..9b30037 100644 --- a/src/client.rs +++ b/src/client.rs @@ -54,6 +54,7 @@ pub fn connect_with_config( let uri = request.uri(); let mode = uri_mode(uri)?; let host = request.uri().host().ok_or(Error::Url(UrlError::NoHostName))?; + let host = if host.starts_with('[') { &host[1..host.len() - 1] } else { host }; let port = uri.port_u16().unwrap_or(match mode { Mode::Plain => 80, Mode::Tls => 443,