client.go 422 B

12345678910111213141516171819
  1. package httptoo
  2. import (
  3. "crypto/tls"
  4. "net/http"
  5. )
  6. // Returns the http.Client's TLS Config, traversing and generating any
  7. // defaults along the way to get it.
  8. func ClientTLSConfig(cl *http.Client) *tls.Config {
  9. if cl.Transport == nil {
  10. cl.Transport = http.DefaultTransport
  11. }
  12. tr := cl.Transport.(*http.Transport)
  13. if tr.TLSClientConfig == nil {
  14. tr.TLSClientConfig = &tls.Config{}
  15. }
  16. return tr.TLSClientConfig
  17. }