Permalink
Browse files

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
  • Loading branch information...
sainaen authored and bep committed Dec 16, 2017
1 parent 9df3736 commit 25114986086e5877a0b4108d8cf5e4e95f377241
Showing with 4 additions and 0 deletions.
  1. +4 −0 livereload/livereload.go
View
@@ -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

0 comments on commit 2511498

Please sign in to comment.