YTSFlix_Go/vendor/github.com/anacrolix/missinggo/httptoo/client.go

20 lines
422 B
Go
Raw Normal View History

2018-11-04 14:58:15 +00:00
package httptoo
import (
"crypto/tls"
"net/http"
)
// Returns the http.Client's TLS Config, traversing and generating any
// defaults along the way to get it.
func ClientTLSConfig(cl *http.Client) *tls.Config {
if cl.Transport == nil {
cl.Transport = http.DefaultTransport
}
tr := cl.Transport.(*http.Transport)
if tr.TLSClientConfig == nil {
tr.TLSClientConfig = &tls.Config{}
}
return tr.TLSClientConfig
}