]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Connection header must include "Upgrade", but should not be equal to. 415/head
authorSerge S. Koval <serge.koval@gmail.com>
Thu, 8 Dec 2011 12:48:38 +0000 (14:48 +0200)
committerSerge S. Koval <serge.koval@gmail.com>
Thu, 8 Dec 2011 12:48:38 +0000 (14:48 +0200)
tornado/websocket.py

index 0d51d8203abe5fb14ee560d9ab822c576e2c26d7..60f1e49710e4664da8350bcfa329094dbd449768 100644 (file)
@@ -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\"."