GetHttpClient returns a new HTTP client with TLS certificate verification disabled when insecureSkipVerify is true and enabled otherwise.
(insecureSkipVerify bool)
| 1571 | // GetHttpClient returns a new HTTP client with TLS certificate verification |
| 1572 | // disabled when insecureSkipVerify is true and enabled otherwise. |
| 1573 | func GetHttpClient(insecureSkipVerify bool) *http.Client { |
| 1574 | if insecureSkipVerify { |
| 1575 | transport := DefaultHTTPTransport() |
| 1576 | if transport.TLSClientConfig == nil { |
| 1577 | transport.TLSClientConfig = new(tls.Config) |
| 1578 | } |
| 1579 | transport.TLSClientConfig.InsecureSkipVerify = true |
| 1580 | return &http.Client{Transport: transport} |
| 1581 | } |
| 1582 | return &http.Client{} |
| 1583 | } |
| 1584 | |
| 1585 | // Like GetHttpClient, and also turns off the NODELAY option on the underlying TCP socket. |
| 1586 | // This is better for WebSockets and BLIP, as it allows multiple small messages to be combined in |