Skip to content

Commit

Permalink
Merge #34067
Browse files Browse the repository at this point in the history
34067: ccl/storageccl: support HTTP_PROXY env vars r=mjibson a=mjibson

HTTP and S3 storage both used a wrapped http.Client, but it didn't copy
and modify http.DefaultTransport, instead making one from scratch. This
meant that the normally supported settings like proxy and timeouts
were zero'd.

Fixes #32803

Release note (enterprise change): Support standard HTTP proxy environment
variables in HTTP and S3 storage.

Co-authored-by: Matt Jibson <[email protected]>
  • Loading branch information
craig[bot] and maddyblue committed Feb 4, 2019
2 parents aace456 + 44e96dc commit abc20a7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/ccl/storageccl/export_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,22 @@ func makeHTTPClient(settings *cluster.Settings) (*http.Client, error) {
}
tlsConf = &tls.Config{RootCAs: roots}
}
return &http.Client{Transport: &http.Transport{TLSClientConfig: tlsConf}}, nil
// Copy the defaults from http.DefaultTransport. We cannot just copy the
// entire struct because it has a sync Mutex. This has the unfortunate problem
// that if Go adds fields to DefaultTransport they won't be copied here,
// but this is ok for now.
t := http.DefaultTransport.(*http.Transport)
return &http.Client{Transport: &http.Transport{
Proxy: t.Proxy,
DialContext: t.DialContext,
MaxIdleConns: t.MaxIdleConns,
IdleConnTimeout: t.IdleConnTimeout,
TLSHandshakeTimeout: t.TLSHandshakeTimeout,
ExpectContinueTimeout: t.ExpectContinueTimeout,

// Add our custom CA.
TLSClientConfig: tlsConf,
}}, nil
}

func makeHTTPStorage(base string, settings *cluster.Settings) (ExportStorage, error) {
Expand Down

0 comments on commit abc20a7

Please sign in to comment.