From 4b4ad26b977bba0b52f6ea15d08750a7453304a4 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 8 Oct 2014 18:18:42 +0000 Subject: [PATCH 1/4] handle GET redirects Signed-off-by: Victor Vieux --- api/client/cli.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/client/cli.go b/api/client/cli.go index 74e645171a..424ccf2fa2 100644 --- a/api/client/cli.go +++ b/api/client/cli.go @@ -138,14 +138,17 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, // The transport is created here for reuse during the client session tr := &http.Transport{ TLSClientConfig: tlsConfig, - Dial: func(dial_network, dial_addr string) (net.Conn, error) { - // Why 32? See issue 8035 - return net.DialTimeout(proto, addr, 32*time.Second) - }, } + + // Why 32? See issue 8035 if proto == "unix" { // no need in compressing for local communications tr.DisableCompression = true + tr.Dial = func(network, addr string) (net.Conn, error) { + return net.DialTimeout("unix", addr, 32*time.Second) + } + } else { + tr.Dial = (&net.Dialer{Timeout: 32 * time.Second}).Dial } return &DockerCli{ From 6ca144ef3d62e358327249546bf83ce1e347be5c Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 12 Nov 2014 00:37:54 +0000 Subject: [PATCH 2/4] fix unix socket Signed-off-by: Victor Vieux --- api/client/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/client/cli.go b/api/client/cli.go index 424ccf2fa2..7a806d64bb 100644 --- a/api/client/cli.go +++ b/api/client/cli.go @@ -144,8 +144,8 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, if proto == "unix" { // no need in compressing for local communications tr.DisableCompression = true - tr.Dial = func(network, addr string) (net.Conn, error) { - return net.DialTimeout("unix", addr, 32*time.Second) + tr.Dial = func(dial_network, dial_addr string) (net.Conn, error) { + return net.DialTimeout(proto, addr, 32*time.Second) } } else { tr.Dial = (&net.Dialer{Timeout: 32 * time.Second}).Dial From 5fbfec333a90b86add1dcf6bd8d5fcb728d34cdf Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 13 Nov 2014 03:21:18 +0000 Subject: [PATCH 3/4] update timeout Signed-off-by: Victor Vieux --- api/client/cli.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/client/cli.go b/api/client/cli.go index 7a806d64bb..3455962bd2 100644 --- a/api/client/cli.go +++ b/api/client/cli.go @@ -141,14 +141,15 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, } // Why 32? See issue 8035 + timeout := 32 * time.Second if proto == "unix" { // no need in compressing for local communications tr.DisableCompression = true tr.Dial = func(dial_network, dial_addr string) (net.Conn, error) { - return net.DialTimeout(proto, addr, 32*time.Second) + return net.DialTimeout(proto, addr, timeout) } } else { - tr.Dial = (&net.Dialer{Timeout: 32 * time.Second}).Dial + tr.Dial = (&net.Dialer{Timeout: timeout}).Dial } return &DockerCli{ From 454f56e37eefd072e350739a6c5a06743ff913ef Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 14 Nov 2014 19:31:52 +0000 Subject: [PATCH 4/4] use _, _ string Signed-off-by: Victor Vieux --- api/client/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/client/cli.go b/api/client/cli.go index 3455962bd2..a477d0b3a9 100644 --- a/api/client/cli.go +++ b/api/client/cli.go @@ -145,7 +145,7 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, if proto == "unix" { // no need in compressing for local communications tr.DisableCompression = true - tr.Dial = func(dial_network, dial_addr string) (net.Conn, error) { + tr.Dial = func(_, _ string) (net.Conn, error) { return net.DialTimeout(proto, addr, timeout) } } else {