Skip to content

Commit

Permalink
Merge pull request #345 from DopplerHQ/proxy
Browse files Browse the repository at this point in the history
chore: print proxy info
  • Loading branch information
Piccirello authored Nov 7, 2022
2 parents fb2df93 + af09cc5 commit ba95429
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ba95429

Please sign in to comment.