fix host header name

This commit is contained in:
Σrebe - Romain GERARD 2024-02-15 20:38:23 +01:00
parent a81573d02d
commit 6354d8dde1
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "wstunnel" name = "wstunnel"
version = "9.2.3" version = "9.2.2"
edition = "2021" edition = "2021"
repository = "https://github.com/erebe/wstunnel.git" repository = "https://github.com/erebe/wstunnel.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -113,7 +113,7 @@ pub async fn connect(
let headers = headers_from_file(headers_file_path); let headers = headers_from_file(headers_file_path);
let host = headers let host = headers
.iter() .iter()
.find(|(h, _)| h == HeaderName::from_static("HOST")) .find(|(h, _)| h == HeaderName::from_static("host"))
.and_then(|(_, v)| v.to_str().ok()) .and_then(|(_, v)| v.to_str().ok())
.map(|v| v.to_string()); .map(|v| v.to_string());
(Some(headers), host) (Some(headers), host)
@ -126,8 +126,8 @@ pub async fn connect(
.uri(format!( .uri(format!(
"{}://{}/{}/events", "{}://{}/{}/events",
client_cfg.remote_addr.scheme(), client_cfg.remote_addr.scheme(),
authority.as_deref() authority
.as_deref()
.unwrap_or(client_cfg.http_header_host.to_str().unwrap_or("")), .unwrap_or(client_cfg.http_header_host.to_str().unwrap_or("")),
&client_cfg.http_upgrade_path_prefix &client_cfg.http_upgrade_path_prefix
)) ))