Skip to content

Commit ab379d4

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

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
@@ -98,9 +98,17 @@ func buildTransport(opts ClientOpts, flags *Flags) *http.Transport {
9898
}
9999

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

0 commit comments

Comments
 (0)