Skip to content

Commit b32da9e

Browse files
committed
use new function to read proxy settings from environment, preferring SRC_PROXY if present
1 parent d9286f3 commit b32da9e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/api/api.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,17 @@ func buildTransport(opts ClientOpts, flags *Flags) *http.Transport {
9999
}
100100

101101
if opts.ProxyURL != nil || opts.ProxyPath != "" {
102+
// Explicit SRC_PROXY configuration takes precedence.
102103
transport = withProxyTransport(transport, opts.ProxyURL, opts.ProxyPath)
104+
} else if proxyURL := envProxyURL(opts.Endpoint); proxyURL != nil && proxyURL.Scheme == "https" {
105+
// For HTTPS proxies discovered via standard env vars, use our custom
106+
// dialer to force HTTP/1.1 for the CONNECT tunnel. Many proxy servers
107+
// don't support HTTP/2 CONNECT, which Go may negotiate via ALPN when
108+
// TLS-connecting to an https:// proxy.
109+
transport = withProxyTransport(transport, proxyURL, "")
103110
}
104-
111+
// For http:// and socks5:// proxies from standard env vars, the cloned
112+
// transport's default Proxy handles them correctly without intervention.
105113
return transport
106114
}
107115

0 commit comments

Comments
 (0)