diff --git a/hack/vendor.sh b/hack/vendor.sh index c94d38ed71..dc85589e88 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -24,7 +24,7 @@ clone git golang.org/x/net 47990a1ba55743e6ef1affd3a14e5bac8553615d https://gith clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 clone git github.com/docker/go-connections v0.2.0 -clone git github.com/docker/engine-api v0.3.1 +clone git github.com/docker/engine-api v0.3.2 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 clone git github.com/imdario/mergo 0.2.1 diff --git a/vendor/src/github.com/docker/engine-api/client/hijack.go b/vendor/src/github.com/docker/engine-api/client/hijack.go index 8102d481b4..2fd46b6c52 100644 --- a/vendor/src/github.com/docker/engine-api/client/hijack.go +++ b/vendor/src/github.com/docker/engine-api/client/hijack.go @@ -46,8 +46,7 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu req.Header.Set("Connection", "Upgrade") req.Header.Set("Upgrade", "tcp") - tlsConfig := cli.transport.TLSConfig() - conn, err := dial(cli.proto, cli.addr, tlsConfig) + conn, err := dial(cli.proto, cli.addr, cli.transport.TLSConfig()) if err != nil { if strings.Contains(err.Error(), "connection refused") { return types.HijackedResponse{}, fmt.Errorf("Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?") @@ -126,6 +125,21 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con tcpConn.SetKeepAlivePeriod(30 * time.Second) } + colonPos := strings.LastIndex(addr, ":") + if colonPos == -1 { + colonPos = len(addr) + } + hostname := addr[:colonPos] + + // If no ServerName is set, infer the ServerName + // from the hostname we're connecting to. + if config.ServerName == "" { + // Make a copy to avoid polluting argument or default. + c := *config + c.ServerName = hostname + config = &c + } + conn := tls.Client(rawConn, config) if timeout == 0 { diff --git a/vendor/src/github.com/docker/engine-api/client/transport/transport.go b/vendor/src/github.com/docker/engine-api/client/transport/transport.go index 9e0095f3e4..ff28af1855 100644 --- a/vendor/src/github.com/docker/engine-api/client/transport/transport.go +++ b/vendor/src/github.com/docker/engine-api/client/transport/transport.go @@ -4,7 +4,6 @@ package transport import ( "fmt" "net/http" - "strings" "github.com/docker/go-connections/sockets" ) @@ -35,10 +34,6 @@ func NewTransportWithHTTP(proto, addr string, client *http.Client) (Client, erro } } - if transport.TLSClientConfig != nil && transport.TLSClientConfig.ServerName == "" { - transport.TLSClientConfig.ServerName = hostname(addr) - } - return &apiTransport{ Client: client, tlsInfo: &tlsInfo{transport.TLSClientConfig}, @@ -59,12 +54,4 @@ func defaultTransport(proto, addr string) *http.Transport { return tr } -func hostname(addr string) string { - colonPos := strings.LastIndex(addr, ":") - if colonPos == -1 { - return addr - } - return addr[:colonPos] -} - var _ Client = &apiTransport{}