From: Serge S. Koval Date: Thu, 8 Dec 2011 12:48:38 +0000 (+0200) Subject: Connection header must include "Upgrade", but should not be equal to. X-Git-Tag: v2.2.0~16^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b5e73b054d718f78aa321d261279832c8cb1ec0;p=thirdparty%2Ftornado.git Connection header must include "Upgrade", but should not be equal to. --- diff --git a/tornado/websocket.py b/tornado/websocket.py index 0d51d8203..60f1e4971 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -82,7 +82,7 @@ class WebSocketHandler(tornado.web.RequestHandler): self.open_args = args self.open_kwargs = kwargs - # Websocket requires GET method + # Websocket only supports GET method if self.request.method != 'GET': self.stream.write(tornado.escape.utf8( "HTTP/1.1 405 Method Not Allowed\r\n\r\n" @@ -101,7 +101,7 @@ class WebSocketHandler(tornado.web.RequestHandler): # Connection header should be upgrade. Some proxy servers/load balancers # might mess with it. - if self.request.headers.get("Connection", "").lower() != 'upgrade': + if self.request.headers.get("Connection", "").lower().find('upgrade') == -1: self.stream.write(tornado.escape.utf8( "HTTP/1.1 400 Bad Request\r\n\r\n" "\"Connection\" must be \"Upgrade\"."