Do not use HTTP_PROXY for unix sock

Makes sure the CLI does not use HTTP_PROXY when connecting to unix
socket.
Also adds some tests to make sure this functionality works as expected.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f6e697d2ace2ea659c1b3f7e3dcef7493baa481c
Component: engine
This commit is contained in:
Brian Goff
2015-02-12 11:38:52 -05:00
parent ebb652c696
commit 106678e894
2 changed files with 62 additions and 1 deletions

View File

@ -155,7 +155,6 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, keyFile string, proto, a
// The transport is created here for reuse during the client session
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: tlsConfig,
}
@ -168,6 +167,7 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, keyFile string, proto, a
return net.DialTimeout(proto, addr, timeout)
}
} else {
tr.Proxy = http.ProxyFromEnvironment
tr.Dial = (&net.Dialer{Timeout: timeout}).Dial
}