From 8eb42193f9a4ac064cd58ccb3904e296fc657cc3 Mon Sep 17 00:00:00 2001 From: Szabolcs Horvath Date: Tue, 11 Feb 2025 09:20:25 +0100 Subject: [PATCH] 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. --- saltboot/distributor.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/saltboot/distributor.go b/saltboot/distributor.go index 0433a58..e57559d 100644 --- a/saltboot/distributor.go +++ b/saltboot/distributor.go @@ -30,12 +30,14 @@ func determineProtocol(httpsEnabled bool) string { func getHttpClient(httpsEnabled bool) *http.Client { if httpsEnabled { + transport := http.DefaultTransport.(*http.Transport).Clone() + if transport.TLSClientConfig == nil { + transport.TLSClientConfig = &tls.Config{} + } + transport.TLSClientConfig.InsecureSkipVerify = true + return &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - }, + Transport: transport, } } else { return &http.Client{}