mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-29 22:38:36 +08:00
Removed unneeded loop
This commit is contained in:
@@ -196,14 +196,12 @@ impl ProxyHttp for LB {
|
|||||||
|
|
||||||
if let Some(headers) = self.get_header(ctx.hostname.as_ref().unwrap_or(&Arc::from("localhost")), session.req_header().uri.path()) {
|
if let Some(headers) = self.get_header(ctx.hostname.as_ref().unwrap_or(&Arc::from("localhost")), session.req_header().uri.path()) {
|
||||||
if let Some(server_headers) = headers.server_headers {
|
if let Some(server_headers) = headers.server_headers {
|
||||||
for k in server_headers {
|
for (k, v) in server_headers.iter() {
|
||||||
upstream_request.insert_header(k.0.to_string(), k.1.as_ref())?;
|
upstream_request.insert_header(k.to_string(), v.as_ref())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(client_headers) = headers.client_headers {
|
if let Some(client_headers) = headers.client_headers {
|
||||||
let converted: Vec<(Arc<str>, Arc<str>)> = client_headers.into_iter().map(|(k, v)| (Arc::<str>::from(k), Arc::<str>::from(v))).collect();
|
ctx.client_headers = Arc::new(client_headers);
|
||||||
|
|
||||||
ctx.client_headers = Arc::new(converted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,8 +220,8 @@ impl ProxyHttp for LB {
|
|||||||
session.write_response_header(Box::new(redirect_response), false).await?;
|
session.write_response_header(Box::new(redirect_response), false).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (key, value) in ctx.client_headers.iter() {
|
for (k, v) in ctx.client_headers.iter() {
|
||||||
_upstream_response.insert_header(key.to_string(), value.as_ref()).unwrap();
|
_upstream_response.insert_header(k.to_string(), v.as_ref())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.set_keepalive(Some(300));
|
session.set_keepalive(Some(300));
|
||||||
|
|||||||
Reference in New Issue
Block a user