From bb58c6caa750f2e7cbb0cb82a98eb45a0647b5f5 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Wed, 11 Nov 2026 08:17:53 +0800 Subject: [PATCH 1/2] fix(proxy): redact sensitive headers in request logs The dfdaemon proxy Debug-printed the full http::Request at its routing log sites (rule config match, X-Dragonfly-Use-P2P header, direct HTTP/HTTPS proxy, and non-GET bypasses), which leaked the complete authorization, cookie, proxy-authorization, and www-authenticate header values, e.g. 'authorization: Bearer eyJ...', into the logs. Add a RedactedRequest Debug wrapper to the existing redaction helpers in dragonfly-client-util. It prints the method, uri, and version, keeps the non-sensitive headers for request correlation, and replaces the sensitive header values with [REDACTED]; the body is never printed. Switch all Request-dumping log sites in proxy/mod.rs to the wrapper and cover it with unit tests. Signed-off-by: yxxhero --- dragonfly-client-util/src/types/redacted.rs | 147 +++++++++++++++++++- dragonfly-client/src/proxy/mod.rs | 27 ++-- 2 files changed, 160 insertions(+), 14 deletions(-) diff --git a/dragonfly-client-util/src/types/redacted.rs b/dragonfly-client-util/src/types/redacted.rs index be07bab8e..1dcbbbb77 100644 --- a/dragonfly-client-util/src/types/redacted.rs +++ b/dragonfly-client-util/src/types/redacted.rs @@ -16,7 +16,10 @@ use dragonfly_api::common::v2::{Download, Hdfs, HuggingFace, ModelScope, ObjectStorage, OpenCsg}; use dragonfly_api::dfdaemon::v2::DownloadPersistentTaskRequest; -use http::header::{HOST, RANGE, USER_AGENT}; +use http::header::{ + AUTHORIZATION, COOKIE, HOST, PROXY_AUTHORIZATION, RANGE, USER_AGENT, WWW_AUTHENTICATE, +}; +use http::{HeaderMap, Request}; use std::collections::HashMap; use std::fmt; @@ -217,6 +220,74 @@ impl fmt::Debug for RedactedDownloadPersistentTaskRequest<'_> { } } +/// Debug-safe wrapper around [`http::Request`]. +/// +/// Use at log sites that would otherwise Debug-print the full request +/// (e.g. `info!("proxy HTTP request: {:?}", request)`): +/// +/// ```ignore +/// use dragonfly_client_util::types::redacted::RedactedRequest; +/// info!("proxy HTTP request: {:?}", RedactedRequest(&request)); +/// ``` +/// +/// The `method`, `uri`, and `version` are printed as-is, and the values of +/// the sensitive headers are replaced with [`REDACTED`]: +/// +/// - `authorization` +/// - `cookie` +/// - `proxy-authorization` +/// - `www-authenticate` +/// +/// Other headers are left intact for request correlation. The body is +/// never printed because it is not inspectable without consuming it and +/// may be arbitrarily large on the per-request log path. +pub struct RedactedRequest<'a, B>(pub &'a Request); + +/// Debug implementation that prints the request line and headers without +/// the body, since it runs on the per-request log path. +impl fmt::Debug for RedactedRequest<'_, B> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Request") + .field("method", self.0.method()) + .field("uri", self.0.uri()) + .field("version", &self.0.version()) + .field("headers", &RedactedHeaderMap(self.0.headers())) + .finish_non_exhaustive() + } +} + +/// Debug wrapper over the request headers that replaces the values of the +/// sensitive headers with [`REDACTED`]. +struct RedactedHeaderMap<'a>(&'a HeaderMap); + +/// Debug implementation that redacts the sensitive header values. +impl fmt::Debug for RedactedHeaderMap<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_map() + .entries(self.0.iter().map(|(name, value)| { + if is_sensitive_header(name.as_str()) { + (name, &REDACTED as &dyn fmt::Debug) + } else { + (name, value as &dyn fmt::Debug) + } + })) + .finish() + } +} + +/// Returns whether the header value is secret material that must not reach +/// the logs, matched case-insensitively without allocating. +fn is_sensitive_header(name: &str) -> bool { + [ + AUTHORIZATION.as_str(), + COOKIE.as_str(), + PROXY_AUTHORIZATION.as_str(), + WWW_AUTHENTICATE.as_str(), + ] + .iter() + .any(|sensitive_header| name.eq_ignore_ascii_case(sensitive_header)) +} + /// Mutates the given `ObjectStorage` by replacing any present secrets with [`REDACTED`]. fn scrub_object_storage(os: &mut Option) { if let Some(os) = os.as_mut() { @@ -584,4 +655,78 @@ mod tests { Some(ACCESS_KEY_SECRET) ); } + + #[test] + fn is_sensitive_header_matches_case_insensitively() { + let test_cases = vec![ + ("authorization", true), + ("Authorization", true), + ("AUTHORIZATION", true), + ("cookie", true), + ("Cookie", true), + ("proxy-authorization", true), + ("Proxy-Authorization", true), + ("www-authenticate", true), + ("WWW-Authenticate", true), + ("host", false), + ("range", false), + ("user-agent", false), + ("x-request-id", false), + ("", false), + ]; + + for (name, expected) in test_cases { + assert_eq!(is_sensitive_header(name), expected); + } + } + + #[test] + fn redacted_request_debug_redacts_sensitive_headers() { + let bearer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.SECRET.SIGNATURE"; + let request = Request::builder() + .method("GET") + .uri("http://example.com/path?range=0-1023") + .header("Authorization", format!("Bearer {bearer_token}")) + .header("Cookie", "session=SECRET_SESSION") + // Header values with the same name are appended, so both must be + // redacted. + .header("cookie", "other=SECRET_OTHER") + .header("Proxy-Authorization", "Basic c2VjcmV0LXNlY3JldA==") + .header("WWW-Authenticate", "Bearer realm=\"example\"") + .header("X-Request-Id", "req-42") + .body(()) + .unwrap(); + + let output = format!("{:?}", RedactedRequest(&request)); + for secret in [ + bearer_token, + "SECRET_SESSION", + "SECRET_OTHER", + "c2VjcmV0LXNlY3JldA==", + "realm=\"example\"", + ] { + assert!(!output.contains(secret), "leaked secret: {secret}"); + } + + assert!(output.contains(REDACTED)); + assert!(output.contains("GET")); + assert!(output.contains("http://example.com/path?range=0-1023")); + assert!(output.contains("req-42")); + } + + #[test] + fn redacted_request_debug_does_not_mutate_the_original() { + let request = Request::builder() + .method("GET") + .uri("http://example.com/path") + .header("Authorization", "Bearer SECRET_BEARER") + .body(()) + .unwrap(); + let _ = format!("{:?}", RedactedRequest(&request)); + + assert_eq!( + request.headers().get(AUTHORIZATION).unwrap(), + "Bearer SECRET_BEARER" + ); + } } diff --git a/dragonfly-client/src/proxy/mod.rs b/dragonfly-client/src/proxy/mod.rs index 10de10dd1..ce0ce7c27 100644 --- a/dragonfly-client/src/proxy/mod.rs +++ b/dragonfly-client/src/proxy/mod.rs @@ -34,6 +34,7 @@ use dragonfly_client_util::{ http::{hashmap_to_headermap, headermap_to_hashmap}, shutdown, tls::{generate_self_signed_certs_by_ca_cert, generate_simple_self_signed_certs, NoVerifier}, + types::redacted::RedactedRequest, }; use futures::TryStreamExt; use http_body_util::{combinators::BoxBody, BodyExt, Empty, StreamBody}; @@ -479,7 +480,7 @@ pub async fn http_handler( if request.method() == Method::GET { info!( "proxy HTTP request via dfdaemon by rule config: {:?}", - request + RedactedRequest(&request) ); return proxy_via_dfdaemon(config.clone(), task, dynconfig, rule, request, remote_ip) @@ -488,7 +489,7 @@ pub async fn http_handler( debug!( "proxy HTTP request bypassing dfdaemon for non-GET method: {:?}", - request + RedactedRequest(&request) ); } @@ -497,7 +498,7 @@ pub async fn http_handler( if header::get_use_p2p(request.headers()) { info!( "proxy HTTP request via dfdaemon by X-Dragonfly-Use-P2P header: {:?}", - request + RedactedRequest(&request) ); if request.method() == Method::GET { @@ -514,14 +515,14 @@ pub async fn http_handler( debug!( "proxy HTTP request bypassing dfdaemon for non-GET method: {:?}", - request + RedactedRequest(&request) ); } if request.uri().scheme().cloned() == Some(http::uri::Scheme::HTTPS) { info!( "proxy HTTPS request directly to remote server: {:?}", - request + RedactedRequest(&request) ); return proxy_via_https(request, https_client).await; @@ -529,7 +530,7 @@ pub async fn http_handler( info!( "proxy HTTP request directly to remote server: {:?}", - request + RedactedRequest(&request) ); return proxy_via_http(request, http_client).await; @@ -549,7 +550,7 @@ pub async fn https_handler( request_rate_limiter: Arc, dynconfig: Arc, ) -> ClientResult { - debug!("handle HTTPS request: {:?}", request); + debug!("handle HTTPS request: {:?}", RedactedRequest(&request)); // Proxy the request directly to the remote server. if let Some(host) = request.uri().host() { @@ -763,7 +764,7 @@ pub async fn upgraded_handler( if request.method() == Method::GET { info!( "proxy HTTPS request via dfdaemon by rule config: {:?}", - request, + RedactedRequest(&request), ); return proxy_via_dfdaemon(config.clone(), task, dynconfig, rule, request, remote_ip) @@ -772,7 +773,7 @@ pub async fn upgraded_handler( debug!( "proxy HTTPS request bypassing dfdaemon for non-GET method: {:?}", - request, + RedactedRequest(&request), ); } @@ -782,7 +783,7 @@ pub async fn upgraded_handler( if request.method() == Method::GET { info!( "proxy HTTP request via dfdaemon by X-Dragonfly-Use-P2P header: {:?}", - request, + RedactedRequest(&request), ); return proxy_via_dfdaemon( @@ -798,14 +799,14 @@ pub async fn upgraded_handler( debug!( "proxy HTTPS request bypassing dfdaemon for non-GET method: {:?}", - request, + RedactedRequest(&request), ); } if request.uri().scheme().cloned() == Some(http::uri::Scheme::HTTPS) { info!( "proxy HTTPS request directly to remote server: {:?}", - request, + RedactedRequest(&request), ); return proxy_via_https(request, https_client).await; @@ -813,7 +814,7 @@ pub async fn upgraded_handler( info!( "proxy HTTP request directly to remote server: {:?}", - request, + RedactedRequest(&request), ); return proxy_via_http(request, http_client).await; From 3d65d65d6f5bbafbb950c79ecfda485c90213496 Mon Sep 17 00:00:00 2001 From: Gaius Date: Wed, 18 Nov 2026 16:41:03 +0800 Subject: [PATCH 2/2] refactor(proxy): log only key headers in redacted proxy request Debug Rename `RedactedRequest` to `RedactedHTTPProxyRequest` and switch its header output from a deny-list (redacting authorization, cookie, etc.) to an allow-list that prints only `range`, `user-agent`, `host` and `x-request-id`. This keeps the per-request log line small and ensures any unexpected sensitive header never reaches the logs. Generalize `KeyRequestHeader` over any `(K, V)` iterable so the same filter serves both `HeaderMap` and `HashMap` headers, drop the now unused sensitive-header helpers, and update tests and proxy call sites accordingly. Signed-off-by: Gaius --- dragonfly-client-util/src/types/redacted.rs | 215 +++++++------------- dragonfly-client/src/proxy/mod.rs | 31 +-- 2 files changed, 91 insertions(+), 155 deletions(-) diff --git a/dragonfly-client-util/src/types/redacted.rs b/dragonfly-client-util/src/types/redacted.rs index 1dcbbbb77..dfe9f24fe 100644 --- a/dragonfly-client-util/src/types/redacted.rs +++ b/dragonfly-client-util/src/types/redacted.rs @@ -16,11 +16,8 @@ use dragonfly_api::common::v2::{Download, Hdfs, HuggingFace, ModelScope, ObjectStorage, OpenCsg}; use dragonfly_api::dfdaemon::v2::DownloadPersistentTaskRequest; -use http::header::{ - AUTHORIZATION, COOKIE, HOST, PROXY_AUTHORIZATION, RANGE, USER_AGENT, WWW_AUTHENTICATE, -}; -use http::{HeaderMap, Request}; -use std::collections::HashMap; +use http::header::{HOST, RANGE, USER_AGENT}; +use http::Request; use std::fmt; /// Placeholder inserted in place of redacted secret material. @@ -123,41 +120,6 @@ impl fmt::Debug for RedactedDownload<'_> { } } -/// Clones the optional sub-message only when present and scrubs its secrets, -/// so the common absent case costs nothing. -fn scrubbed(value: &Option, scrub: fn(&mut Option)) -> Option { - let mut value = value.clone(); - scrub(&mut value); - value -} - -/// Debug wrapper over the request header map that prints only the key -/// headers, so the hot log line stays small and the sensitive headers never -/// reach the logs. -struct KeyRequestHeader<'a>(&'a HashMap); - -/// Debug implementation that filters the headers by the key header names. -impl fmt::Debug for KeyRequestHeader<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_map() - .entries(self.0.iter().filter(|(key, _)| is_key_request_header(key))) - .finish() - } -} - -/// Returns whether the header is worth printing on the per-request log path, -/// matched case-insensitively without allocating. -fn is_key_request_header(key: &str) -> bool { - [ - RANGE.as_str(), - USER_AGENT.as_str(), - HOST.as_str(), - "x-request-id", - ] - .iter() - .any(|key_header| key.eq_ignore_ascii_case(key_header)) -} - /// Debug-safe wrapper around [`DownloadPersistentTaskRequest`]. /// /// Use at log sites that would otherwise Debug-print the full @@ -220,72 +182,75 @@ impl fmt::Debug for RedactedDownloadPersistentTaskRequest<'_> { } } -/// Debug-safe wrapper around [`http::Request`]. +/// Debug-safe wrapper around [`http::Request`] received by the proxy. /// /// Use at log sites that would otherwise Debug-print the full request /// (e.g. `info!("proxy HTTP request: {:?}", request)`): /// /// ```ignore -/// use dragonfly_client_util::types::redacted::RedactedRequest; -/// info!("proxy HTTP request: {:?}", RedactedRequest(&request)); +/// use crate::types::redacted::RedactedHTTPProxyRequest; +/// info!("proxy HTTP request: {:?}", RedactedHTTPProxyRequest(&request)); /// ``` /// -/// The `method`, `uri`, and `version` are printed as-is, and the values of -/// the sensitive headers are replaced with [`REDACTED`]: -/// -/// - `authorization` -/// - `cookie` -/// - `proxy-authorization` -/// - `www-authenticate` -/// -/// Other headers are left intact for request correlation. The body is -/// never printed because it is not inspectable without consuming it and -/// may be arbitrarily large on the per-request log path. -pub struct RedactedRequest<'a, B>(pub &'a Request); - -/// Debug implementation that prints the request line and headers without -/// the body, since it runs on the per-request log path. -impl fmt::Debug for RedactedRequest<'_, B> { +/// Only the `method`, `uri`, `version` and the key headers are printed, so +/// the sensitive headers and the body never reach the logs. +pub struct RedactedHTTPProxyRequest<'a, B>(pub &'a Request); + +/// Debug implementation that prints the request line and the key headers +/// without the body, since it runs on the per-request log path. +impl fmt::Debug for RedactedHTTPProxyRequest<'_, B> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Request") .field("method", self.0.method()) .field("uri", self.0.uri()) .field("version", &self.0.version()) - .field("headers", &RedactedHeaderMap(self.0.headers())) + .field("headers", &KeyRequestHeader(self.0.headers())) .finish_non_exhaustive() } } -/// Debug wrapper over the request headers that replaces the values of the -/// sensitive headers with [`REDACTED`]. -struct RedactedHeaderMap<'a>(&'a HeaderMap); +/// Debug wrapper over the request header map that prints only the key +/// headers, so the hot log line stays small and the sensitive headers never +/// reach the logs. +struct KeyRequestHeader<'a, T>(&'a T); -/// Debug implementation that redacts the sensitive header values. -impl fmt::Debug for RedactedHeaderMap<'_> { +/// Debug implementation that filters the headers by the key header names. +impl<'a, T, K, V> fmt::Debug for KeyRequestHeader<'a, T> +where + &'a T: IntoIterator, + K: AsRef + fmt::Debug, + V: fmt::Debug, +{ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_map() - .entries(self.0.iter().map(|(name, value)| { - if is_sensitive_header(name.as_str()) { - (name, &REDACTED as &dyn fmt::Debug) - } else { - (name, value as &dyn fmt::Debug) - } - })) + .entries( + self.0 + .into_iter() + .filter(|(key, _)| is_key_request_header(key.as_ref())), + ) .finish() } } -/// Returns whether the header value is secret material that must not reach -/// the logs, matched case-insensitively without allocating. -fn is_sensitive_header(name: &str) -> bool { +/// Returns whether the header is worth printing on the per-request log path, +/// matched case-insensitively without allocating. +fn is_key_request_header(key: &str) -> bool { [ - AUTHORIZATION.as_str(), - COOKIE.as_str(), - PROXY_AUTHORIZATION.as_str(), - WWW_AUTHENTICATE.as_str(), + RANGE.as_str(), + USER_AGENT.as_str(), + HOST.as_str(), + "x-request-id", ] .iter() - .any(|sensitive_header| name.eq_ignore_ascii_case(sensitive_header)) + .any(|key_header| key.eq_ignore_ascii_case(key_header)) +} + +/// Clones the optional sub-message only when present and scrubs its secrets, +/// so the common absent case costs nothing. +fn scrubbed(value: &Option, scrub: fn(&mut Option)) -> Option { + let mut value = value.clone(); + scrub(&mut value); + value } /// Mutates the given `ObjectStorage` by replacing any present secrets with [`REDACTED`]. @@ -294,12 +259,15 @@ fn scrub_object_storage(os: &mut Option) { if os.access_key_secret.is_some() { os.access_key_secret = Some(REDACTED.to_string()); } + if os.session_token.is_some() { os.session_token = Some(REDACTED.to_string()); } + if os.security_token.is_some() { os.security_token = Some(REDACTED.to_string()); } + if os.credential_path.is_some() { os.credential_path = Some(REDACTED.to_string()); } @@ -347,6 +315,7 @@ mod tests { #![allow(clippy::type_complexity)] use super::*; + use std::collections::HashMap; const ACCESS_KEY_SECRET: &str = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"; @@ -657,76 +626,40 @@ mod tests { } #[test] - fn is_sensitive_header_matches_case_insensitively() { - let test_cases = vec![ - ("authorization", true), - ("Authorization", true), - ("AUTHORIZATION", true), - ("cookie", true), - ("Cookie", true), - ("proxy-authorization", true), - ("Proxy-Authorization", true), - ("www-authenticate", true), - ("WWW-Authenticate", true), - ("host", false), - ("range", false), - ("user-agent", false), - ("x-request-id", false), - ("", false), - ]; - - for (name, expected) in test_cases { - assert_eq!(is_sensitive_header(name), expected); - } - } - - #[test] - fn redacted_request_debug_redacts_sensitive_headers() { - let bearer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.SECRET.SIGNATURE"; + fn redacted_http_proxy_request_debug_prints_the_request_line() { let request = Request::builder() .method("GET") - .uri("http://example.com/path?range=0-1023") - .header("Authorization", format!("Bearer {bearer_token}")) - .header("Cookie", "session=SECRET_SESSION") - // Header values with the same name are appended, so both must be - // redacted. - .header("cookie", "other=SECRET_OTHER") - .header("Proxy-Authorization", "Basic c2VjcmV0LXNlY3JldA==") - .header("WWW-Authenticate", "Bearer realm=\"example\"") - .header("X-Request-Id", "req-42") + .uri("http://example.com/path") .body(()) .unwrap(); - let output = format!("{:?}", RedactedRequest(&request)); - for secret in [ - bearer_token, - "SECRET_SESSION", - "SECRET_OTHER", - "c2VjcmV0LXNlY3JldA==", - "realm=\"example\"", - ] { - assert!(!output.contains(secret), "leaked secret: {secret}"); - } - - assert!(output.contains(REDACTED)); + let output = format!("{:?}", RedactedHTTPProxyRequest(&request)); assert!(output.contains("GET")); - assert!(output.contains("http://example.com/path?range=0-1023")); - assert!(output.contains("req-42")); + assert!(output.contains("http://example.com/path")); + assert!(output.contains("HTTP/1.1")); } #[test] - fn redacted_request_debug_does_not_mutate_the_original() { - let request = Request::builder() - .method("GET") - .uri("http://example.com/path") - .header("Authorization", "Bearer SECRET_BEARER") - .body(()) - .unwrap(); - let _ = format!("{:?}", RedactedRequest(&request)); + fn redacted_http_proxy_request_debug_prints_only_key_request_headers() { + let test_cases = vec![ + ("range", "bytes=0-1023", true), + ("user-agent", "dfget/2.3", true), + ("host", "registry.example.com", true), + ("x-request-id", "req-42", true), + ("accept", "application/octet-stream", false), + ("authorization", "Bearer SECRET_BEARER", false), + ]; - assert_eq!( - request.headers().get(AUTHORIZATION).unwrap(), - "Bearer SECRET_BEARER" - ); + for (name, value, expected) in test_cases { + let request = Request::builder() + .uri("http://example.com/path") + .header(name, value) + .body(()) + .unwrap(); + + let output = format!("{:?}", RedactedHTTPProxyRequest(&request)); + assert_eq!(output.contains(name), expected); + assert_eq!(output.contains(value), expected); + } } } diff --git a/dragonfly-client/src/proxy/mod.rs b/dragonfly-client/src/proxy/mod.rs index ce0ce7c27..68c189809 100644 --- a/dragonfly-client/src/proxy/mod.rs +++ b/dragonfly-client/src/proxy/mod.rs @@ -34,7 +34,7 @@ use dragonfly_client_util::{ http::{hashmap_to_headermap, headermap_to_hashmap}, shutdown, tls::{generate_self_signed_certs_by_ca_cert, generate_simple_self_signed_certs, NoVerifier}, - types::redacted::RedactedRequest, + types::redacted::RedactedHTTPProxyRequest, }; use futures::TryStreamExt; use http_body_util::{combinators::BoxBody, BodyExt, Empty, StreamBody}; @@ -480,7 +480,7 @@ pub async fn http_handler( if request.method() == Method::GET { info!( "proxy HTTP request via dfdaemon by rule config: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); return proxy_via_dfdaemon(config.clone(), task, dynconfig, rule, request, remote_ip) @@ -489,7 +489,7 @@ pub async fn http_handler( debug!( "proxy HTTP request bypassing dfdaemon for non-GET method: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); } @@ -498,7 +498,7 @@ pub async fn http_handler( if header::get_use_p2p(request.headers()) { info!( "proxy HTTP request via dfdaemon by X-Dragonfly-Use-P2P header: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); if request.method() == Method::GET { @@ -515,14 +515,14 @@ pub async fn http_handler( debug!( "proxy HTTP request bypassing dfdaemon for non-GET method: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); } if request.uri().scheme().cloned() == Some(http::uri::Scheme::HTTPS) { info!( "proxy HTTPS request directly to remote server: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); return proxy_via_https(request, https_client).await; @@ -530,7 +530,7 @@ pub async fn http_handler( info!( "proxy HTTP request directly to remote server: {:?}", - RedactedRequest(&request) + RedactedHTTPProxyRequest(&request) ); return proxy_via_http(request, http_client).await; @@ -550,7 +550,10 @@ pub async fn https_handler( request_rate_limiter: Arc, dynconfig: Arc, ) -> ClientResult { - debug!("handle HTTPS request: {:?}", RedactedRequest(&request)); + debug!( + "handle HTTPS request: {:?}", + RedactedHTTPProxyRequest(&request) + ); // Proxy the request directly to the remote server. if let Some(host) = request.uri().host() { @@ -764,7 +767,7 @@ pub async fn upgraded_handler( if request.method() == Method::GET { info!( "proxy HTTPS request via dfdaemon by rule config: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); return proxy_via_dfdaemon(config.clone(), task, dynconfig, rule, request, remote_ip) @@ -773,7 +776,7 @@ pub async fn upgraded_handler( debug!( "proxy HTTPS request bypassing dfdaemon for non-GET method: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); } @@ -783,7 +786,7 @@ pub async fn upgraded_handler( if request.method() == Method::GET { info!( "proxy HTTP request via dfdaemon by X-Dragonfly-Use-P2P header: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); return proxy_via_dfdaemon( @@ -799,14 +802,14 @@ pub async fn upgraded_handler( debug!( "proxy HTTPS request bypassing dfdaemon for non-GET method: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); } if request.uri().scheme().cloned() == Some(http::uri::Scheme::HTTPS) { info!( "proxy HTTPS request directly to remote server: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); return proxy_via_https(request, https_client).await; @@ -814,7 +817,7 @@ pub async fn upgraded_handler( info!( "proxy HTTP request directly to remote server: {:?}", - RedactedRequest(&request), + RedactedHTTPProxyRequest(&request), ); return proxy_via_http(request, http_client).await;