Преглед на файлове

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.
Gary Burd преди 11 години
родител
ревизия
ab5b3a61f5
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      server.go

+ 2 - 2
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