From 74afb82de9b93e6e9dc8637170123fdf1b3e1fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cruz?= Date: Mon, 13 Jul 2020 10:46:28 +0100 Subject: [PATCH] Remove brackets from IPv6 literals before passing to TLS connector (#115) --- src/stream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream.rs b/src/stream.rs index c5cda5d..fd3800c 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -316,7 +316,7 @@ pub(crate) fn connect_https(unit: &Unit) -> Result { let sock = connect_host(unit, hostname, port)?; let tls_connector = TlsConnector::new().map_err(|e| Error::TlsError(e))?; - let stream = tls_connector.connect(hostname, sock).map_err(|e| match e { + let stream = tls_connector.connect(&hostname.trim_matches(|c| c == '[' || c == ']'), sock).map_err(|e| match e { HandshakeError::Failure(err) => Error::TlsError(err), _ => Error::BadStatusRead, })?;