aboutsummaryrefslogtreecommitdiffhomepage
path: root/livereload
diff options
context:
space:
mode:
authorIvan Vyshnevskyi <[email protected]>2017-12-16 17:41:52 +0200
committerBjørn Erik Pedersen <[email protected]>2017-12-16 19:06:00 +0100
commit25114986086e5877a0b4108d8cf5e4e95f377241 (patch)
treebf2c71b79f55aa092ee916932c8ea6a179860e41 /livereload
parent9df3736fec164c51d819797416dc263f2869be77 (diff)
downloadhugo-25114986086e5877a0b4108d8cf5e4e95f377241.tar.gz
hugo-25114986086e5877a0b4108d8cf5e4e95f377241.zip
livereload: Fix host comparison when ports aren't present
Compare the original hosts from 'Origin' and 'Host' headers before attempting to do a port-less comparison. This helps in the case when hugo server was started with a '--port=80' so both headers do not contain a port. Fixes #4141
Diffstat (limited to 'livereload')
-rw-r--r--livereload/livereload.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/livereload/livereload.go b/livereload/livereload.go
index 7bfbbaf6b..2f3cee8f0 100644
--- a/livereload/livereload.go
+++ b/livereload/livereload.go
@@ -62,6 +62,10 @@ var upgrader = &websocket.Upgrader{
return false
}
+ if u.Host == r.Host {
+ return true
+ }
+
h1, _, err := net.SplitHostPort(u.Host)
if err != nil {
return false