From 1143317fd19eddd4c386c75f413593e91c83e7fe Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 1 Oct 2026 20:37:43 +0000 Subject: [PATCH] feat: add context to HTTP(S) proxy connection errors We already have context for HTTP(S) "CONNECT" command failures, "Failed to connect to SOCKS5 proxy" and "Failed to connect to Shadowsocks proxy", but when TCP connection to HTTP(S) fails the error is bubbled up as is. This resulted in confusing "All connection attempts failed: Connection to host:port failed: ..." error when configuring a relay, without any indication that "host:port" is the proxy address. --- src/net/proxy.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/net/proxy.rs b/src/net/proxy.rs index 5c1b72e5b..4f07f05ab 100644 --- a/src/net/proxy.rs +++ b/src/net/proxy.rs @@ -410,7 +410,8 @@ impl ProxyConfig { }; let tcp_stream = crate::net::connect_tcp(context, &hostname, http_config.port, load_cache) - .await?; + .await + .context("Failed to connect to HTTP proxy")?; let auth = if let Some((username, password)) = &http_config.user_password { Some((username.as_str(), password.as_str())) } else { @@ -429,7 +430,8 @@ impl ProxyConfig { let tcp_stream = crate::net::connect_tcp(context, &hostname, https_config.port, load_cache) - .await?; + .await + .context("Failed to connect to HTTPS proxy")?; let use_sni = true; let tls_stream = wrap_rustls( &hostname,