@ -52,22 +52,10 @@ type LoggingTransport struct {
// NewTransport creates and returns a new instance of LoggingTransport
// NewTransport creates and returns a new instance of LoggingTransport
func NewTransport ( debug bool ) * retry . Transport {
func NewTransport ( debug bool ) * retry . Transport {
type cloner [ T any ] interface {
// clone http.DefaultTransport so mutations (e.g. TLS config) are not
Clone ( ) T
// reflected globally
}
// try to copy (clone) the http.DefaultTransport so any mutations we
// perform on it (e.g. TLS config) are not reflected globally
// follow https://github.com/golang/go/issues/39299 for a more elegant
// solution in the future
transport := http . DefaultTransport
transport := http . DefaultTransport
if t , ok := transport . ( cloner [ * http . Transport ] ) ; ok {
if t , ok := transport . ( * http . Transport ) ; ok {
transport = t . Clone ( )
} else if t , ok := transport . ( cloner [ http . RoundTripper ] ) ; ok {
// this branch will not be used with go 1.20, it was added
// optimistically to try to clone if the http.DefaultTransport
// implementation changes, still the Clone method in that case
// might not return http.RoundTripper...
transport = t . Clone ( )
transport = t . Clone ( )
}
}
if debug {
if debug {