|
|
|
@ -21,7 +21,6 @@ import ( |
|
|
|
|
"context" |
|
|
|
|
"crypto/tls" |
|
|
|
|
"crypto/x509" |
|
|
|
|
"errors" |
|
|
|
|
"fmt" |
|
|
|
|
"io" |
|
|
|
|
"net" |
|
|
|
@ -198,6 +197,7 @@ func (authClient *AuthRPCClient) Call(serviceMethod string, args interface { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// gob doesn't provide any typed errors for us to reflect
|
|
|
|
|
// upon, this is the only way to return proper error.
|
|
|
|
|
if err != nil && strings.Contains(err.Error(), "gob: wrong type") { |
|
|
|
@ -206,6 +206,7 @@ func (authClient *AuthRPCClient) Call(serviceMethod string, args interface { |
|
|
|
|
|
|
|
|
|
err = errRPCAPIVersionUnsupported |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
return err |
|
|
|
@ -257,7 +258,7 @@ func rpcDial(serverAddr, serviceEndpoint string, secureConn bool) (netRPCClient |
|
|
|
|
Op: "dial-http", |
|
|
|
|
Net: serverAddr + serviceEndpoint, |
|
|
|
|
Addr: nil, |
|
|
|
|
Err: fmt.Errorf("Unable to parse server address <%s>: %s", serverAddr, err), |
|
|
|
|
Err: fmt.Errorf("Unable to parse server address <%s>/<%s>: %s", serverAddr, serviceEndpoint, err), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// ServerName in tls.Config needs to be specified to support SNI certificates.
|
|
|
|
@ -313,7 +314,7 @@ func rpcDial(serverAddr, serviceEndpoint string, secureConn bool) (netRPCClient |
|
|
|
|
} |
|
|
|
|
if resp.Status != connectSuccessMessage { |
|
|
|
|
conn.Close() |
|
|
|
|
return nil, errors.New("unexpected HTTP response: " + resp.Status) |
|
|
|
|
return nil, fmt.Errorf("Unexpected HTTP response: %s from %s/%s", resp.Status, serverAddr, serviceEndpoint) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialize rpc client.
|
|
|
|
|