From af09cc5e52ee6665ecc773128626c5afb15a8cbf Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Fri, 4 Nov 2022 17:28:21 -0700 Subject: [PATCH] chore: print proxy info --- pkg/http/http.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/http/http.go b/pkg/http/http.go index f61c8e50..3b974109 100644 --- a/pkg/http/http.go +++ b/pkg/http/http.go @@ -188,13 +188,23 @@ func performRequest(req *http.Request, verifyTLS bool, params []queryParam) (int return dialer.DialContext(ctx, network, addr) } + proxyUrl, err := http.ProxyFromEnvironment(req) + if err != nil { + utils.LogDebug("Unable to read proxy from environment") + utils.LogDebugError(err) + proxyUrl = nil + } + if proxyUrl != nil { + utils.LogDebug(fmt.Sprintf("Using proxy %s", proxyUrl)) + } + client.Transport = &http.Transport{ // disable keep alives to prevent multiple CLI instances from exhausting the // OS's available network sockets. this adds a negligible performance penalty DisableKeepAlives: true, TLSClientConfig: tlsConfig, DialContext: dialContext, - Proxy: http.ProxyFromEnvironment, + Proxy: http.ProxyURL(proxyUrl), } startTime := time.Now()