From aa61fea7f0d5e4296e1d8558efd52d1571b079f5 Mon Sep 17 00:00:00 2001 From: Nianyu Shen Date: Sun, 12 Jan 2025 07:20:13 -0800 Subject: [PATCH] fix: set tls config while retaining other fields from default http transport Signed-off-by: Nianyu Shen --- cmd/cosign/cli/options/registry.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/cosign/cli/options/registry.go b/cmd/cosign/cli/options/registry.go index 2fd6312999b..9d22b4ea8b7 100644 --- a/cmd/cosign/cli/options/registry.go +++ b/cmd/cosign/cli/options/registry.go @@ -151,7 +151,9 @@ func (o *RegistryOptions) GetRegistryClientOpts(ctx context.Context) []remote.Op tlsConfig, err := o.getTLSConfig() if err == nil { - opts = append(opts, remote.WithTransport(&http.Transport{TLSClientConfig: tlsConfig})) + tr := http.DefaultTransport.(*http.Transport).Clone() + tr.TLSClientConfig = tlsConfig + opts = append(opts, remote.WithTransport(tr)) } // Reuse a remote.Pusher and a remote.Puller for all operations that use these opts.