core: Update go-cleanhttp vendored dependency

Updates go-cleanhttp vendored dependency
This commit is contained in:
Jake Champlin 2017-02-13 13:13:16 -05:00
parent 89e338f0bc
commit 804c1cdef7
No known key found for this signature in database
GPG Key ID: DC31F41958EF4AC2
2 changed files with 17 additions and 13 deletions

View File

@ -3,11 +3,12 @@ package cleanhttp
import ( import (
"net" "net"
"net/http" "net/http"
"runtime"
"time" "time"
) )
// DefaultTransport returns a new http.Transport with the same default values // DefaultTransport returns a new http.Transport with similar default values to
// as http.DefaultTransport, but with idle connections and keepalives disabled. // http.DefaultTransport, but with idle connections and keepalives disabled.
func DefaultTransport() *http.Transport { func DefaultTransport() *http.Transport {
transport := DefaultPooledTransport() transport := DefaultPooledTransport()
transport.DisableKeepAlives = true transport.DisableKeepAlives = true
@ -22,13 +23,15 @@ func DefaultTransport() *http.Transport {
func DefaultPooledTransport() *http.Transport { func DefaultPooledTransport() *http.Transport {
transport := &http.Transport{ transport := &http.Transport{
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{ DialContext: (&net.Dialer{
Timeout: 30 * time.Second, Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,
}).Dial, }).DialContext,
TLSHandshakeTimeout: 10 * time.Second, MaxIdleConns: 100,
DisableKeepAlives: false, IdleConnTimeout: 90 * time.Second,
MaxIdleConnsPerHost: 1, TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1,
} }
return transport return transport
} }
@ -42,10 +45,10 @@ func DefaultClient() *http.Client {
} }
} }
// DefaultPooledClient returns a new http.Client with the same default values // DefaultPooledClient returns a new http.Client with similar default values to
// as http.Client, but with a non-shared Transport. Do not use this function // http.Client, but with a shared Transport. Do not use this function for
// for transient clients as it can leak file descriptors over time. Only use // transient clients as it can leak file descriptors over time. Only use this
// this for clients that will be re-used for the same host(s). // for clients that will be re-used for the same host(s).
func DefaultPooledClient() *http.Client { func DefaultPooledClient() *http.Client {
return &http.Client{ return &http.Client{
Transport: DefaultPooledTransport(), Transport: DefaultPooledTransport(),

5
vendor/vendor.json vendored
View File

@ -1639,9 +1639,10 @@
"revision": "e4b2dc34c0f698ee04750bf2035d8b9384233e1b" "revision": "e4b2dc34c0f698ee04750bf2035d8b9384233e1b"
}, },
{ {
"checksumSHA1": "fSe5y1UgTDeYlnFfUcDA1zzcw+U=", "checksumSHA1": "b8F628srIitj5p7Y130xc9k0QWs=",
"path": "github.com/hashicorp/go-cleanhttp", "path": "github.com/hashicorp/go-cleanhttp",
"revision": "875fb671b3ddc66f8e2f0acc33829c8cb989a38d" "revision": "3573b8b52aa7b37b9358d966a898feb387f62437",
"revisionTime": "2017-02-11T01:34:15Z"
}, },
{ {
"checksumSHA1": "nsL2kI426RMuq1jw15e7igFqdIY=", "checksumSHA1": "nsL2kI426RMuq1jw15e7igFqdIY=",