Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
Add port to host header when not default
  • Loading branch information
erebe committed Nov 16, 2023
1 parent 71a937e commit 9e0fd6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,11 @@ async fn main() {
let host_header = if let Some((_, host_val)) = args.http_headers.iter().find(|(h, _)| *h == HOST) {
host_val.clone()
} else {
HeaderValue::from_str(&args.remote_addr.host().unwrap().to_string()).unwrap()
let host = match args.remote_addr.port_or_known_default() {
None | Some(80) | Some(443) => args.remote_addr.host().unwrap().to_string(),
Some(port) => format!("{}:{}", args.remote_addr.host().unwrap(), port),
};
HeaderValue::from_str(&host).unwrap()
};
let mut client_config = WsClientConfig {
remote_addr: (
Expand Down

0 comments on commit 9e0fd6b

Please sign in to comment.