Fix multiple header occurences
This commit is contained in:
parent
207f467b87
commit
8153bdca46
1 changed files with 6 additions and 5 deletions
|
@ -48,7 +48,7 @@ fn remove_hop_headers(headers: &HeaderMap<HeaderValue>) -> HeaderMap<HeaderValue
|
||||||
let mut result = HeaderMap::new();
|
let mut result = HeaderMap::new();
|
||||||
for (k, v) in headers.iter() {
|
for (k, v) in headers.iter() {
|
||||||
if !is_hop_header(k.as_str()) {
|
if !is_hop_header(k.as_str()) {
|
||||||
result.insert(k.clone(), v.clone());
|
result.append(k.clone(), v.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
@ -81,10 +81,10 @@ fn create_proxied_request<B>(
|
||||||
|
|
||||||
// If request does not have host header, add it from original URI authority
|
// If request does not have host header, add it from original URI authority
|
||||||
let host_header_name = "host";
|
let host_header_name = "host";
|
||||||
if let Some(authority) = request.uri().authority() {
|
if let hyper::header::Entry::Vacant(entry) =
|
||||||
if let hyper::header::Entry::Vacant(entry) =
|
builder.headers_mut().unwrap().entry(host_header_name)
|
||||||
builder.headers_mut().unwrap().entry(host_header_name)
|
{
|
||||||
{
|
if let Some(authority) = request.uri().authority() {
|
||||||
entry.insert(authority.as_str().parse()?);
|
entry.insert(authority.as_str().parse()?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ fn create_proxied_request<B>(
|
||||||
"https".try_into()?,
|
"https".try_into()?,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Proxy upgrade requests properly
|
||||||
if let Some(conn) = request.headers().get("connection") {
|
if let Some(conn) = request.headers().get("connection") {
|
||||||
if conn.to_str()?.to_lowercase() == "upgrade" {
|
if conn.to_str()?.to_lowercase() == "upgrade" {
|
||||||
if let Some(upgrade) = request.headers().get("upgrade") {
|
if let Some(upgrade) = request.headers().get("upgrade") {
|
||||||
|
|
Loading…
Reference in a new issue