From 0f34c50bd24c162534b8ba8a77ff6ee518b48d8e Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 30 Oct 2025 20:01:17 +0800 Subject: [PATCH] fix reqwest proxy auth (#13354) Signed-off-by: 21pages --- libs/hbb_common | 2 +- src/hbbs_http/http_client.rs | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libs/hbb_common b/libs/hbb_common index 0e3820209..d6dd7ae05 160000 --- a/libs/hbb_common +++ b/libs/hbb_common @@ -1 +1 @@ -Subproject commit 0e382020934f204a6a525a05c9b5ce9e96518025 +Subproject commit d6dd7ae052ac62f0f1538f1e056bce9429e28e33 diff --git a/src/hbbs_http/http_client.rs b/src/hbbs_http/http_client.rs index a9eb67c29..c96877dcb 100644 --- a/src/hbbs_http/http_client.rs +++ b/src/hbbs_http/http_client.rs @@ -36,19 +36,13 @@ macro_rules! configure_http_client { }; match proxy_setup { - Ok(p) => { - builder = builder.proxy(p); + Ok(mut p) => { if let Some(auth) = proxy.intercept.maybe_auth() { - let basic_auth = - format!("Basic {}", auth.get_basic_authorization()); - if let Ok(auth) = basic_auth.parse() { - builder = builder.default_headers( - vec![(reqwest::header::PROXY_AUTHORIZATION, auth)] - .into_iter() - .collect(), - ); + if !auth.username().is_empty() && !auth.password().is_empty() { + p = p.basic_auth(auth.username(), auth.password()); } } + builder = builder.proxy(p); builder.build().unwrap_or_else(|e| { info!("Failed to create a proxied client: {}", e); <$Client>::new()