diff options
author | elcore <[email protected]> | 2016-11-27 07:44:15 +0100 |
---|---|---|
committer | Matt Holt <[email protected]> | 2016-11-26 23:44:15 -0700 |
commit | d0bf3e1647bf42b841740c3ae131cc146f203267 (patch) | |
tree | b54e063c582b824d45705685d56af25b1d171390 /caddy.go | |
parent | 7dc23b18aeef7cd3d6f3c13b485a9159767be67a (diff) | |
download | caddy-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.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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. |