MCPcopy
hub / github.com/cloudfoundry/cli / makeHTTPTransport

Function makeHTTPTransport

cf/net/gateway.go:440–460  ·  view source on GitHub ↗
(gateway *Gateway)

Source from the content-addressed store, hash-verified

438}
439
440func makeHTTPTransport(gateway *Gateway) {
441
442 var x509TrustedCerts []*x509.Certificate
443
444 if len(gateway.trustedCerts) > 0 {
445 for _, tlsCert := range gateway.trustedCerts {
446 x509Cert, _ := x509.ParseCertificate(tlsCert.Certificate[0])
447 x509TrustedCerts = append(x509TrustedCerts, x509Cert)
448 }
449 }
450
451 gateway.transport = &http.Transport{
452 DisableKeepAlives: true,
453 Dial: (&net.Dialer{
454 KeepAlive: 30 * time.Second,
455 Timeout: gateway.DialTimeout,
456 }).Dial,
457 TLSClientConfig: util.NewTLSConfig(x509TrustedCerts, gateway.config.IsSSLDisabled()),
458 Proxy: http.ProxyFromEnvironment,
459 }
460}
461
462func dialTimeout(envDialTimeout string) time.Duration {
463 dialTimeout := DefaultDialTimeout

Callers 2

doRequestMethod · 0.85
SetTrustedCertsMethod · 0.85

Calls 2

NewTLSConfigFunction · 0.92
IsSSLDisabledMethod · 0.65

Tested by

no test coverage detected