diff --git a/Cargo.lock b/Cargo.lock index 3f1e7dc3..e4d68e59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "g3-http" -version = "0.4.0" +version = "0.5.0" dependencies = [ "atoi", "base64", diff --git a/Cargo.toml b/Cargo.toml index fe325a83..19422059 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -211,7 +211,7 @@ g3-geoip-types = { version = "0.2", path = "lib/g3-geoip-types" } g3-h2 = { version = "0.3", path = "lib/g3-h2" } g3-hickory-client = { version = "0.3", path = "lib/g3-hickory-client" } g3-histogram = { version = "0.2", path = "lib/g3-histogram" } -g3-http = { version = "0.4", path = "lib/g3-http" } +g3-http = { version = "0.5", path = "lib/g3-http" } g3-icap-client = { version = "0.3", path = "lib/g3-icap-client" } g3-imap-proto = { version = "0.2", path = "lib/g3-imap-proto" } g3-io-ext = { version = "0.8", path = "lib/g3-io-ext" } diff --git a/lib/g3-http/Cargo.toml b/lib/g3-http/Cargo.toml index a1d93623..533e7152 100644 --- a/lib/g3-http/Cargo.toml +++ b/lib/g3-http/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "g3-http" -version = "0.4.0" +version = "0.5.0" license.workspace = true edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/lib/g3-http/src/server/request.rs b/lib/g3-http/src/server/request.rs index aea5a701..b0a67d16 100644 --- a/lib/g3-http/src/server/request.rs +++ b/lib/g3-http/src/server/request.rs @@ -193,10 +193,10 @@ impl HttpProxyClientRequest { pub fn set_host(&mut self, host: &UpstreamAddr) { let mut new_v = unsafe { HttpHeaderValue::from_string_unchecked(host.to_string()) }; - if let Some(old_v) = self.end_to_end_headers.remove(header::HOST) { - if let Some(name) = old_v.original_name() { - new_v.set_original_name(name); - } + if let Some(old_v) = self.end_to_end_headers.remove(header::HOST) + && let Some(name) = old_v.original_name() + { + new_v.set_original_name(name); } self.end_to_end_headers.insert(header::HOST, new_v); self.host = Some(host.clone());