From a53e26a5dba813423ef1821aaf201dd866f40cf5 Mon Sep 17 00:00:00 2001 From: Ara Sadoyan Date: Wed, 7 May 2025 18:15:25 +0200 Subject: [PATCH] reStructurization of files --- src/web/proxyhttp.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index b49b208..4d72b50 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -19,15 +19,13 @@ pub struct LB { pub ump_full: Arc, pub ump_byid: Arc, pub headers: Arc, - // pub config: Arc>, pub config: Arc, pub local: Arc<(String, u16)>, pub proxyconf: Arc>>, - // pub extraparams: Arc>, pub extraparams: Arc>, } -pub struct MyCtx { +pub struct Context { backend_id: String, } @@ -35,9 +33,9 @@ pub struct MyCtx { impl ProxyHttp for LB { // type CTX = (); // fn new_ctx(&self) -> Self::CTX {} - type CTX = MyCtx; + type CTX = Context; fn new_ctx(&self) -> Self::CTX { - MyCtx { backend_id: String::new() } + Context { backend_id: String::new() } } async fn upstream_peer(&self, session: &mut Session, _ctx: &mut Self::CTX) -> Result> { let host_name = return_header_host(&session); @@ -46,14 +44,6 @@ impl ProxyHttp for LB { Some(host) => { // session.req_header_mut().headers.insert("X-Host-Name", host.to_string().parse().unwrap()); - // let mut backend_id = Option::<&str>::None; - // if let Some(_) = self.config.get("sticky_sessions") { - // if let Some(cookies) = session.req_header().headers.get("cookie") { - // let cookie_str = cookies.to_str().unwrap_or("").split(" ").collect::>()[1]; - // backend_id = Some(cookie_str); - // } - // } - let mut backend_id = None; { let read_guard = self.extraparams.read().await;