Skip to content

Commit

Permalink
client: set SkipServerVersionCheck: true only if no version is specified
Browse files Browse the repository at this point in the history
Related to fsouza#795.
  • Loading branch information
fsouza committed Aug 23, 2019
1 parent 2694696 commit 70e17b5
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ func NewClient(endpoint string) (*Client, error) {
if err != nil {
return nil, err
}
client.SkipServerVersionCheck = true
return client, nil
}

Expand All @@ -179,7 +178,6 @@ func NewTLSClient(endpoint string, cert, key, ca string) (*Client, error) {
if err != nil {
return nil, err
}
client.SkipServerVersionCheck = true
return client, nil
}

Expand All @@ -191,7 +189,6 @@ func NewTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, caPEMCert
if err != nil {
return nil, err
}
client.SkipServerVersionCheck = true
return client, nil
}

Expand All @@ -210,12 +207,13 @@ func NewVersionedClient(endpoint string, apiVersionString string) (*Client, erro
}
}
c := &Client{
HTTPClient: defaultClient(),
Dialer: &net.Dialer{},
endpoint: endpoint,
endpointURL: u,
eventMonitor: new(eventMonitoringState),
requestedAPIVersion: requestedAPIVersion,
HTTPClient: defaultClient(),
SkipServerVersionCheck: apiVersionString == "",
Dialer: &net.Dialer{},
endpoint: endpoint,
endpointURL: u,
eventMonitor: new(eventMonitoringState),
requestedAPIVersion: requestedAPIVersion,
}
c.initializeNativeClient(defaultTransport)
return c, nil
Expand Down Expand Up @@ -273,7 +271,6 @@ func NewClientFromEnv() (*Client, error) {
if err != nil {
return nil, err
}
client.SkipServerVersionCheck = true
return client, nil
}

Expand Down Expand Up @@ -340,13 +337,14 @@ func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock,
return nil, err
}
c := &Client{
HTTPClient: &http.Client{Transport: tr},
TLSConfig: tlsConfig,
Dialer: &net.Dialer{},
endpoint: endpoint,
endpointURL: u,
eventMonitor: new(eventMonitoringState),
requestedAPIVersion: requestedAPIVersion,
HTTPClient: &http.Client{Transport: tr},
TLSConfig: tlsConfig,
SkipServerVersionCheck: apiVersionString == "",
Dialer: &net.Dialer{},
endpoint: endpoint,
endpointURL: u,
eventMonitor: new(eventMonitoringState),
requestedAPIVersion: requestedAPIVersion,
}
c.initializeNativeClient(defaultTransport)
return c, nil
Expand Down

0 comments on commit 70e17b5

Please sign in to comment.