summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2023-01-01 13:39:21 +0100
committerSebastiaan van Stijn <github@gone.nl>2023-01-01 13:39:21 +0100
commit722d477bc6bc3a8e032c44c63a962d79b5c948d3 (patch)
tree4ac9843d310c22542efd115948a68d65f950a1e5 /client
parent31ee1583941fedf1a9883426637517abf07eb2fc (diff)
downloaddocker-722d477bc6bc3a8e032c44c63a962d79b5c948d3.tar.gz
client: defaultHTTPClient(): don't ignore transport errors
This function was suppressing errors coming from ConfigureTransport, with the assumption that it will only be used with the Default configuration, and only return errors for invalid / unsupported schemes (e.g., using "npipe" on a Linux environment); https://github.com/moby/moby/blob/d109e429dd69bbfc2b575c11e66cbd98364a860b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go#L27-L29 Those errors won't happen when the default is passed, so this is mostly theoretical. Let's return the error instead (which should always be nil), just to be on the save side, and to make sure that any other use of this function will return errors that occurred, which may also be when parsing proxy environment variables; https://github.com/moby/moby/blob/d109e429dd69bbfc2b575c11e66cbd98364a860b/vendor/github.com/docker/go-connections/sockets/sockets.go#L29 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'client')
-rw-r--r--client/client.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/client/client.go b/client/client.go
index cf903b0762..33cdfef37b 100644
--- a/client/client.go
+++ b/client/client.go
@@ -167,7 +167,10 @@ func NewClientWithOpts(ops ...Opt) (*Client, error) {
func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) {
transport := &http.Transport{}
- _ = sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
+ err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
+ if err != nil {
+ return nil, err
+ }
return &http.Client{
Transport: transport,
CheckRedirect: CheckRedirect,