(isSslDisabled bool)
| 272 | } |
| 273 | |
| 274 | func newTransport(isSslDisabled bool) http.RoundTripper { |
| 275 | csrfx := csrf.CsrfTokenHelper{NonProtectedMethods: getNonProtectedMethods()} |
| 276 | httpTransport := http.DefaultTransport.(*http.Transport).Clone() |
| 277 | // Increase tls handshake timeout to cope with slow internet connections. 3 x default value =30s. |
| 278 | httpTransport.TLSHandshakeTimeout = 30 * time.Second |
| 279 | httpTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: isSslDisabled} |
| 280 | |
| 281 | // Wrap with User-Agent transport first |
| 282 | userAgentTransport := baseclient.NewUserAgentTransport(httpTransport) |
| 283 | |
| 284 | // Then wrap with CSRF transport |
| 285 | return &csrf.Transport{Delegate: userAgentTransport, Csrf: &csrfx} |
| 286 | } |
| 287 | |
| 288 | // NewTransportForTesting creates a transport for testing purposes |
| 289 | func NewTransportForTesting(isSslDisabled bool) http.RoundTripper { |
no test coverage detected