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);d109e429dd/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;d109e429dd/vendor/github.com/docker/go-connections/sockets/sockets.go (L29)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
31ee158394
commit
722d477bc6
1 changed files with 4 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue