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();
|
||||
for (k, v) in headers.iter() {
|
||||
if !is_hop_header(k.as_str()) {
|
||||
result.insert(k.clone(), v.clone());
|
||||
result.append(k.clone(), v.clone());
|
||||
}
|
||||
}
|
||||
result
|
||||
|
@ -81,10 +81,10 @@ fn create_proxied_request<B>(
|
|||
|
||||
// If request does not have host header, add it from original URI authority
|
||||
let host_header_name = "host";
|
||||
if let Some(authority) = request.uri().authority() {
|
||||
if let hyper::header::Entry::Vacant(entry) =
|
||||
builder.headers_mut().unwrap().entry(host_header_name)
|
||||
{
|
||||
if let Some(authority) = request.uri().authority() {
|
||||
entry.insert(authority.as_str().parse()?);
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ fn create_proxied_request<B>(
|
|||
"https".try_into()?,
|
||||
);
|
||||
|
||||
// Proxy upgrade requests properly
|
||||
if let Some(conn) = request.headers().get("connection") {
|
||||
if conn.to_str()?.to_lowercase() == "upgrade" {
|
||||
if let Some(upgrade) = request.headers().get("upgrade") {
|
||||
|
|
Loading…
Reference in a new issue