set http transport config for gateway (#4765)

This change sets the http config for the minio client used by the
minio server in gateway mode.

Fixes #4765
This commit is contained in:
Andreas Auernhammer
2017-08-03 18:38:27 -07:00
committed by Harshavardhana
parent 1e8925cea0
commit b10fa507b2
4 changed files with 29 additions and 1 deletions
+26 -1
View File
@@ -16,7 +16,12 @@
package cmd
import "net/http"
import (
"crypto/tls"
"net"
"net/http"
"time"
)
func anonErrToObjectErr(statusCode int, params ...string) error {
bucket := ""
@@ -47,3 +52,23 @@ func anonErrToObjectErr(statusCode int, params ...string) error {
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,
}
}