|
|
@ -16,7 +16,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
package cmd |
|
|
|
package cmd |
|
|
|
|
|
|
|
|
|
|
|
import "net/http" |
|
|
|
import ( |
|
|
|
|
|
|
|
"crypto/tls" |
|
|
|
|
|
|
|
"net" |
|
|
|
|
|
|
|
"net/http" |
|
|
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func anonErrToObjectErr(statusCode int, params ...string) error { |
|
|
|
func anonErrToObjectErr(statusCode int, params ...string) error { |
|
|
|
bucket := "" |
|
|
|
bucket := "" |
|
|
@ -47,3 +52,23 @@ func anonErrToObjectErr(statusCode int, params ...string) error { |
|
|
|
|
|
|
|
|
|
|
|
return errUnexpected |
|
|
|
return errUnexpected |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// newCustomHTTPTransport returns a new http configuration
|
|
|
|
|
|
|
|
// used while communicating with the cloud backends.
|
|
|
|
|
|
|
|
// This sets the value for MaxIdleConns from 2 (go default) to
|
|
|
|
|
|
|
|
// 100.
|
|
|
|
|
|
|
|
func newCustomHTTPTransport() http.RoundTripper { |
|
|
|
|
|
|
|
return &http.Transport{ |
|
|
|
|
|
|
|
Proxy: http.ProxyFromEnvironment, |
|
|
|
|
|
|
|
DialContext: (&net.Dialer{ |
|
|
|
|
|
|
|
Timeout: 30 * time.Second, |
|
|
|
|
|
|
|
KeepAlive: 30 * time.Second, |
|
|
|
|
|
|
|
}).DialContext, |
|
|
|
|
|
|
|
MaxIdleConns: 100, |
|
|
|
|
|
|
|
IdleConnTimeout: 90 * time.Second, |
|
|
|
|
|
|
|
TLSHandshakeTimeout: 10 * time.Second, |
|
|
|
|
|
|
|
ExpectContinueTimeout: 1 * time.Second, |
|
|
|
|
|
|
|
TLSClientConfig: &tls.Config{RootCAs: globalRootCAs}, |
|
|
|
|
|
|
|
DisableCompression: true, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|