From b73caede55f5850866a8b3d7f28540b540d14e83 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Wed, 11 Mar 2020 14:43:13 +0000 Subject: [PATCH] Fix url parsing that caused v1 test to fail --- netutil/parsers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netutil/parsers.go b/netutil/parsers.go index cb297e8..932c779 100644 --- a/netutil/parsers.go +++ b/netutil/parsers.go @@ -55,6 +55,12 @@ func AddressesFromNodes(nodes []string) ([]string, error) { return nil, newInvalidNodeError(errInvalidHostName) } + // Given input like "http://localhost:8080:8383", url.Parse() will + // return host as "localhost:8000", which isn't a vaild DNS name. + if strings.Contains(host, ":") { + return nil, newInvalidNodeError(errInvalidHostName) + } + port := url.Port() if port == "" { port = DefaultDialPort