mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
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:
parent
1e8925cea0
commit
b10fa507b2
@ -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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -179,6 +179,7 @@ func newAzureLayer(host string) (GatewayLayer, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return &azureObjects{}, err
|
return &azureObjects{}, err
|
||||||
}
|
}
|
||||||
|
c.HTTPClient.Transport = newCustomHTTPTransport()
|
||||||
|
|
||||||
return &azureObjects{
|
return &azureObjects{
|
||||||
client: c.GetBlobService(),
|
client: c.GetBlobService(),
|
||||||
|
@ -277,6 +277,7 @@ func newGCSGateway(projectID string) (GatewayLayer, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
anonClient.SetCustomTransport(newCustomHTTPTransport())
|
||||||
|
|
||||||
gateway := &gcsGateway{
|
gateway := &gcsGateway{
|
||||||
client: client,
|
client: client,
|
||||||
|
@ -130,6 +130,7 @@ func newS3Gateway(host string) (GatewayLayer, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
anonClient.SetCustomTransport(newCustomHTTPTransport())
|
||||||
|
|
||||||
return &s3Objects{
|
return &s3Objects{
|
||||||
Client: client,
|
Client: client,
|
||||||
|
Loading…
Reference in New Issue
Block a user