Skip to content

Commit c61adf4

Browse files
committed
go/libraries/doltcore/env: Do not copy the http.Transport value, which is not safe.
1 parent 8d174fa commit c61adf4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

go/libraries/doltcore/env/grpc_dial_provider.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,19 @@ func (p GRPCDialProvider) GetGRPCDialParams(config grpcendpoint.Config) (dbfacto
9494
tc := credentials.NewTLS(config.TLSConfig)
9595
opts = append(opts, grpc.WithTransportCredentials(tc))
9696

97-
transport := *defaultTransport
98-
transport.TLSClientConfig = config.TLSConfig
99-
transport.ForceAttemptHTTP2 = true
97+
transport := &http.Transport{
98+
Proxy: http.ProxyFromEnvironment,
99+
DialContext: defaultDialer.DialContext,
100+
ForceAttemptHTTP2: true,
101+
MaxIdleConns: 1024,
102+
MaxIdleConnsPerHost: 256,
103+
IdleConnTimeout: 90 * time.Second,
104+
TLSClientConfig: config.TLSConfig,
105+
TLSHandshakeTimeout: 10 * time.Second,
106+
ExpectContinueTimeout: 1 * time.Second,
107+
}
100108
httpfetcher = &http.Client{
101-
Transport: &transport,
109+
Transport: transport,
102110
}
103111
} else if config.Insecure {
104112
opts = append(opts, grpc.WithInsecure())

0 commit comments

Comments
 (0)