From 09b8018bb3e1264b10898ef04b2e8eca8db73b8b Mon Sep 17 00:00:00 2001 From: enty Date: Tue, 1 Oct 2024 21:38:41 +0200 Subject: [PATCH] Refactor TCP stream connection in https.rs --- src/https.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/https.rs b/src/https.rs index 290f971..c11be4c 100644 --- a/src/https.rs +++ b/src/https.rs @@ -9,13 +9,7 @@ pub fn get(url: &str) -> Result> { let port = parsed_url.port.unwrap_or(443); let path = &parsed_url.path; - let address = if host.contains(':') { - format!("[{}]:{}", host, port) - } else { - format!("{}:{}", host, port) - }; - - let stream = TcpStream::connect(address)?; + let stream = TcpStream::connect((host.as_str(), port))?; let connector = TlsConnector::new()?; let mut ssl_stream = connector.connect(host, stream)?;