Skip to content

Commit 8eb4219

Browse files
CB-28539: Clone the default http transport the https transport
We need to copy the Transport struct used in the default HTTP client, as the default Transport has several timeout values set, which we need to copy if we want to have the same behaviour as with HTTP disabled.
1 parent ebb617c commit 8eb4219

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

saltboot/distributor.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ func determineProtocol(httpsEnabled bool) string {
3030

3131
func getHttpClient(httpsEnabled bool) *http.Client {
3232
if httpsEnabled {
33+
transport := http.DefaultTransport.(*http.Transport).Clone()
34+
if transport.TLSClientConfig == nil {
35+
transport.TLSClientConfig = &tls.Config{}
36+
}
37+
transport.TLSClientConfig.InsecureSkipVerify = true
38+
3339
return &http.Client{
34-
Transport: &http.Transport{
35-
TLSClientConfig: &tls.Config{
36-
InsecureSkipVerify: true,
37-
},
38-
},
40+
Transport: transport,
3941
}
4042
} else {
4143
return &http.Client{}

0 commit comments

Comments
 (0)