summaryrefslogtreecommitdiffhomepage
path: root/caddy.go
diff options
context:
space:
mode:
authorelcore <[email protected]>2016-11-27 07:44:15 +0100
committerMatt Holt <[email protected]>2016-11-26 23:44:15 -0700
commitd0bf3e1647bf42b841740c3ae131cc146f203267 (patch)
treeb54e063c582b824d45705685d56af25b1d171390 /caddy.go
parent7dc23b18aeef7cd3d6f3c13b485a9159767be67a (diff)
downloadcaddy-d0bf3e1647bf42b841740c3ae131cc146f203267.tar.gz
caddy-d0bf3e1647bf42b841740c3ae131cc146f203267.zip
Fix network listener address comparison, fixes #1258 (#1273)
* Fix issue #1258 * address comments * add a test * address comments 2
Diffstat (limited to 'caddy.go')
-rw-r--r--caddy.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/caddy.go b/caddy.go
index 415c59cff..39a3358ec 100644
--- a/caddy.go
+++ b/caddy.go
@@ -232,7 +232,7 @@ func HasListenerWithAddress(addr string) bool {
func listenerAddrEqual(ln net.Listener, addr string) bool {
lnAddr := ln.Addr().String()
hostname, port, err := net.SplitHostPort(addr)
- if err != nil || hostname != "" {
+ if err != nil {
return lnAddr == addr
}
if lnAddr == net.JoinHostPort("::", port) {
@@ -241,7 +241,7 @@ func listenerAddrEqual(ln net.Listener, addr string) bool {
if lnAddr == net.JoinHostPort("0.0.0.0", port) {
return true
}
- return false
+ return hostname != "" && lnAddr == addr
}
// TCPServer is a type that can listen and serve connections.