mirror of
https://github.com/chatmail/core.git
synced 2026-10-26 06:48:01 +03:00
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.
This commit is contained in:
+4
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user