feat(local-http): HTTP basic auth optimize log (#1994)

This commit is contained in:
zonyitoo
2025-12-19 03:36:27 +08:00
parent 1008eeec1d
commit b28fbf51f4
2 changed files with 11 additions and 5 deletions

View File

@@ -326,7 +326,7 @@ struct SSLocalExtConfig {
socks5_auth_config_path: Option<String>, socks5_auth_config_path: Option<String>,
/// HTTP /// HTTP
#[cfg(feature = "local")] #[cfg(feature = "local-http")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
http_auth_config_path: Option<String>, http_auth_config_path: Option<String>,

View File

@@ -63,20 +63,26 @@ impl HttpService {
Some(header_value) => { Some(header_value) => {
if let Ok(header_str) = header_value.to_str() { if let Ok(header_str) = header_value.to_str() {
if !self.http_auth.verify_basic_auth(header_str) { if !self.http_auth.verify_basic_auth(header_str) {
debug!("HTTP {} invalid proxy authorization: {}", req.method(), header_str); error!(
"HTTP {} URI {} invalid proxy-authorization: {}",
req.method(),
req.uri(),
header_str
);
return make_proxy_authentication_required(); return make_proxy_authentication_required();
} }
} else { } else {
debug!( error!(
"HTTP {} invalid proxy authorization header encoding: {:?}", "HTTP {} URI {} invalid proxy-authorization header encoding: {:?}",
req.method(), req.method(),
req.uri(),
header_value header_value
); );
return make_proxy_authentication_required(); return make_proxy_authentication_required();
} }
} }
None => { None => {
debug!("HTTP {} missing proxy authorization", req.method()); error!("HTTP {} URI {} missing proxy-authorization", req.method(), req.uri());
return make_proxy_authentication_required(); return make_proxy_authentication_required();
} }
} }