Skip to content

Commit

Permalink
Refactor TCP stream connection in https.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Entytaiment25 committed Oct 1, 2024
1 parent 48fe585 commit 09b8018
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ pub fn get(url: &str) -> Result<String, Box<dyn std::error::Error>> {
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)?;

Expand Down

0 comments on commit 09b8018

Please sign in to comment.