MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetHttpClient

Function GetHttpClient

base/util.go:1573–1583  ·  view source on GitHub ↗

GetHttpClient returns a new HTTP client with TLS certificate verification disabled when insecureSkipVerify is true and enabled otherwise.

(insecureSkipVerify bool)

Source from the content-addressed store, hash-verified

1571// GetHttpClient returns a new HTTP client with TLS certificate verification
1572// disabled when insecureSkipVerify is true and enabled otherwise.
1573func 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

Calls 1

DefaultHTTPTransportFunction · 0.85