func parseEndpointWithFallbackProtocol should check if protocol of endpoint is empty.

This commit is contained in:
carlory
2017-06-02 18:09:03 +08:00
parent 3837d95191
commit 7831085e13
3 changed files with 9 additions and 6 deletions

View File

@@ -39,7 +39,9 @@ func parseEndpoint(endpoint string) (string, string, error) {
return "tcp", u.Host, nil
} else if u.Scheme == "unix" {
return "unix", u.Path, nil
} else if u.Scheme == "" {
return "", "", fmt.Errorf("Using %q as endpoint is deprecated, please consider using full url format", endpoint)
} else {
return "", "", fmt.Errorf("protocol %q not supported", u.Scheme)
return u.Scheme, "", fmt.Errorf("protocol %q not supported", u.Scheme)
}
}