mirror of
https://github.com/kopia/kopia.git
synced 2026-03-25 09:31:12 -04:00
refactor(provider): always clone default HTTP transport in S3 provider (#4132)
The s3 storage provider had a different http transports for different cases:
- https without TLS verification: `&http.Transport{}` with default values;
- https with TLS verification: `http.DefaultTransport.Clone()`
This change uses `http.DefaultTransport` in all cases, instead of creating an
empty (zero-value) `http.Transport` for consistency.
Authored-by: aleksandr.samarin (@alexvbg)
This commit is contained in:
@@ -301,12 +301,14 @@ func (s *s3Storage) DisplayName() string {
|
||||
}
|
||||
|
||||
func getCustomTransport(opt *Options) (*http.Transport, error) {
|
||||
transport := http.DefaultTransport.(*http.Transport).Clone() //nolint:forcetypeassert
|
||||
|
||||
if opt.DoNotVerifyTLS {
|
||||
//nolint:gosec
|
||||
return &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, nil
|
||||
}
|
||||
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
|
||||
transport := http.DefaultTransport.(*http.Transport).Clone() //nolint:forcetypeassert
|
||||
return transport, nil
|
||||
}
|
||||
|
||||
if len(opt.RootCA) != 0 {
|
||||
rootcas := x509.NewCertPool()
|
||||
|
||||
Reference in New Issue
Block a user