MCPcopy
hub / github.com/moby/moby / defaultHTTPClient

Function defaultHTTPClient

client/client.go:270–288  ·  view source on GitHub ↗
(hostURL *url.URL)

Source from the content-addressed store, hash-verified

268}
269
270func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) {
271 transport := &http.Transport{}
272 // Necessary to prevent long-lived processes using the
273 // client from leaking connections due to idle connections
274 // not being released.
275 // TODO: see if we can also address this from the server side,
276 // or in go-connections.
277 // see: https://github.com/moby/moby/issues/45539
278 transport.MaxIdleConns = 6
279 transport.IdleConnTimeout = 30 * time.Second
280 err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
281 if err != nil {
282 return nil, err
283 }
284 return &http.Client{
285 Transport: transport,
286 CheckRedirect: CheckRedirect,
287 }, nil
288}
289
290// Close the transport used by the client
291func (cli *Client) Close() error {

Callers 1

NewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…