Merge pull request #3072 from hashicorp/api-httpclient

Tweaks to api's TLS logic in NewClient
pull/2784/head
Kyle Havlovitz 8 years ago committed by GitHub
commit c897d851aa

@ -369,10 +369,6 @@ func NewClient(config *Config) (*Client, error) {
config.Transport = defConfig.Transport
}
if config.HttpClient == nil {
config.HttpClient = defConfig.HttpClient
}
if config.TLSConfig.Address == "" {
config.TLSConfig.Address = defConfig.TLSConfig.Address
}
@ -434,6 +430,11 @@ func NewClient(config *Config) (*Client, error) {
// NewHttpClient returns an http client configured with the given Transport and TLS
// config.
func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client, error) {
client := &http.Client{
Transport: transport,
}
if transport.TLSClientConfig == nil {
tlsClientConfig, err := SetupTLSConfig(&tlsConf)
if err != nil {
@ -441,8 +442,6 @@ func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client,
}
transport.TLSClientConfig = tlsClientConfig
client := &http.Client{
Transport: transport,
}
return client, nil

Loading…
Cancel
Save