From ab5b3a61f5b6aa323d66ece457334396c4ccdd03 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Wed, 14 Jan 2015 22:16:10 -0800 Subject: [PATCH] Improve server error messages Update the error messages for missing 'Connection: upgrade' and 'Upgrade: websocket' tokens to indicate that the header might not be present. The previous error message implied that the header is present, but has the wrong value. This leads to some confusion for those debugging connection problems. --- server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 349e5b9..e56a004 100644 --- a/server.go +++ b/server.go @@ -98,11 +98,11 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade } if !tokenListContainsValue(r.Header, "Connection", "upgrade") { - return u.returnError(w, r, http.StatusBadRequest, "websocket: connection header != upgrade") + return u.returnError(w, r, http.StatusBadRequest, "websocket: could not find connection header with token 'upgrade'") } if !tokenListContainsValue(r.Header, "Upgrade", "websocket") { - return u.returnError(w, r, http.StatusBadRequest, "websocket: upgrade != websocket") + return u.returnError(w, r, http.StatusBadRequest, "websocket: could not find upgrade header with token 'websocket'") } checkOrigin := u.CheckOrigin