handle GET redirects over HTTP
| ... | ... |
@@ -138,14 +138,18 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, |
| 138 | 138 |
// The transport is created here for reuse during the client session |
| 139 | 139 |
tr := &http.Transport{
|
| 140 | 140 |
TLSClientConfig: tlsConfig, |
| 141 |
- Dial: func(dial_network, dial_addr string) (net.Conn, error) {
|
|
| 142 |
- // Why 32? See issue 8035 |
|
| 143 |
- return net.DialTimeout(proto, addr, 32*time.Second) |
|
| 144 |
- }, |
|
| 145 | 141 |
} |
| 142 |
+ |
|
| 143 |
+ // Why 32? See issue 8035 |
|
| 144 |
+ timeout := 32 * time.Second |
|
| 146 | 145 |
if proto == "unix" {
|
| 147 | 146 |
// no need in compressing for local communications |
| 148 | 147 |
tr.DisableCompression = true |
| 148 |
+ tr.Dial = func(_, _ string) (net.Conn, error) {
|
|
| 149 |
+ return net.DialTimeout(proto, addr, timeout) |
|
| 150 |
+ } |
|
| 151 |
+ } else {
|
|
| 152 |
+ tr.Dial = (&net.Dialer{Timeout: timeout}).Dial
|
|
| 149 | 153 |
} |
| 150 | 154 |
|
| 151 | 155 |
return &DockerCli{
|