0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Allow IPv6 address without port (fixes #80)

This commit is contained in:
Matthew Holt 2015-05-20 20:15:39 -06:00
parent e42c6ab520
commit 5e8491cf7f

View file

@ -265,11 +265,12 @@ func standardAddress(str string) (host, port string, err error) {
} else if strings.HasPrefix(str, "http://") { } else if strings.HasPrefix(str, "http://") {
schemePort = "http" schemePort = "http"
str = str[7:] str = str[7:]
} else if !strings.Contains(str, ":") {
str += ":" // + Port
} }
host, port, err = net.SplitHostPort(str) host, port, err = net.SplitHostPort(str)
if err != nil {
host, port, err = net.SplitHostPort(str + ":") // tack on empty port
}
if err != nil && schemePort != "" { if err != nil && schemePort != "" {
host = str host = str
port = schemePort // assume port from scheme port = schemePort // assume port from scheme