diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-19 09:43:17 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-19 09:43:17 -0600 |
commit | 31c6ac097e14776d9a259ba450d096fc61416ebe (patch) | |
tree | e6cfbbdb421df5c1486c1a92e9f9337593cb0e80 | |
parent | 406df22a16074ee09c0ee9cf5447ff49bc3ea1e5 (diff) |
httpcaddyfile: 'bind' properly parses unix sockets (fixes #2999)
-rw-r--r-- | caddyconfig/httpcaddyfile/addresses.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/caddyconfig/httpcaddyfile/addresses.go b/caddyconfig/httpcaddyfile/addresses.go index 4dad166..f5fd6b6 100644 --- a/caddyconfig/httpcaddyfile/addresses.go +++ b/caddyconfig/httpcaddyfile/addresses.go @@ -21,6 +21,7 @@ import ( "strconv" "strings" + "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" "github.com/caddyserver/caddy/v2/modules/caddyhttp" "github.com/caddyserver/certmagic" @@ -199,7 +200,12 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str // use a map to prevent duplication listeners := make(map[string]struct{}) for _, host := range lnHosts { - listeners[net.JoinHostPort(host, lnPort)] = struct{}{} + addr, err := caddy.ParseNetworkAddress(host) + if err == nil && addr.IsUnixNetwork() { + listeners[host] = struct{}{} + } else { + listeners[net.JoinHostPort(host, lnPort)] = struct{}{} + } } // now turn map into list |