httpcaddyfile: Detect ambiguous site definitions (fix #4635)

Previously, our "duplicate key in server block" logic was flawed because
it did not account for the site's bind address. We defer this check to
when the listener addresses have been assigned, but before we commit
a server block to its listener.

Also refined how network address parsing and joining works, which was
necessary for a less convoluted fix.
This commit is contained in:
Matthew Holt
2022-07-25 17:28:20 -06:00
parent 0bebea0d4c
commit 1e18afb5c8
5 changed files with 99 additions and 45 deletions

View File

@ -68,7 +68,7 @@ func TestDuplicateHosts(t *testing.T) {
}
`,
"caddyfile",
"duplicate site address not allowed")
"ambiguous site definition")
}
func TestReadCookie(t *testing.T) {