mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-22 16:46:53 +01:00
httpcaddyfile: 'bind' properly parses unix sockets (fixes #2999)
This commit is contained in:
parent
406df22a16
commit
31c6ac097e
1 changed files with 7 additions and 1 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/caddyserver/caddy/v2"
|
||||||
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
|
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
|
||||||
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
|
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
|
||||||
"github.com/caddyserver/certmagic"
|
"github.com/caddyserver/certmagic"
|
||||||
|
@ -199,7 +200,12 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str
|
||||||
// use a map to prevent duplication
|
// use a map to prevent duplication
|
||||||
listeners := make(map[string]struct{})
|
listeners := make(map[string]struct{})
|
||||||
for _, host := range lnHosts {
|
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
|
// now turn map into list
|
||||||
|
|
Loading…
Reference in a new issue