diff --git a/cmd/subnet-utils.go b/cmd/subnet-utils.go index 618e2569..0dace216 100644 --- a/cmd/subnet-utils.go +++ b/cmd/subnet-utils.go @@ -175,7 +175,7 @@ func subnetAPIKeyAuthHeaders(apiKey string) subnetHeaders { } func getSubnetClient() *http.Client { - client := httpClient(10 * time.Second) + client := httpClient(0) if globalSubnetProxyURL != nil { client.Transport.(*http.Transport).Proxy = http.ProxyURL(globalSubnetProxyURL) } diff --git a/cmd/utils.go b/cmd/utils.go index d3dfdd9d..b5c106c2 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -24,6 +24,7 @@ import ( "fmt" "math" "math/rand" + "net" "net/http" "os" "path/filepath" @@ -425,10 +426,13 @@ func getClient(aliasURL string) *madmin.AdminClient { return client } -func httpClient(timeout time.Duration) *http.Client { +func httpClient(reqTimeout time.Duration) *http.Client { return &http.Client{ - Timeout: timeout, + Timeout: reqTimeout, Transport: &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: 10 * time.Second, + }).DialContext, Proxy: ieproxy.GetProxyFunc(), TLSClientConfig: &tls.Config{ RootCAs: globalRootCAs, @@ -437,6 +441,9 @@ func httpClient(timeout time.Duration) *http.Client { // Can't use TLSv1.1 because of RC4 cipher usage MinVersion: tls.VersionTLS12, }, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 10 * time.Second, }, } }