node: relax websocket connection header check (#21646)

This makes it accept the "upgrade,keep-alive" header value, which
apparently is a thing.
This commit is contained in:
Felix Lange
2020-10-07 20:05:14 +02:00
committed by GitHub
parent 716864deba
commit 015e78928a
2 changed files with 16 additions and 1 deletions

View File

@ -313,7 +313,7 @@ func (h *httpServer) wsAllowed() bool {
// isWebsocket checks the header of an http request for a websocket upgrade request.
func isWebsocket(r *http.Request) bool {
return strings.ToLower(r.Header.Get("Upgrade")) == "websocket" &&
strings.ToLower(r.Header.Get("Connection")) == "upgrade"
strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade")
}
// NewHTTPHandlerStack returns wrapped http-related handlers