Fix cruft

This commit is contained in:
Asim Aslam 2020-04-07 00:25:11 +01:00
parent ca11c4a672
commit b6348ba59a

View File

@ -146,7 +146,11 @@ func namespaceFromRequest(req *http.Request) (string, error) {
host := req.URL.Hostname()
if len(host) == 0 {
// fallback to req.Host
host, _, _ = net.SplitHostPort(req.Host)
var err error
host, _, err = net.SplitHostPort(req.Host)
if err != nil && err.Error() == "missing port in address" {
host = req.Host
}
}
// check for an ip address