]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Clean up style when rejecting/passing on origin 980/head
authorKyle Kelley <kyle.kelley@rackspace.com>
Thu, 8 May 2014 18:57:39 +0000 (13:57 -0500)
committerKyle Kelley <kyle.kelley@rackspace.com>
Thu, 8 May 2014 18:57:39 +0000 (13:57 -0500)
tornado/websocket.py

index e9fa3d2e97a315a7e610ec74e3c0911653e5c7b6..6f552f71d03117bb4a443b6e35299e03a11e9d90 100644 (file)
@@ -154,13 +154,11 @@ class WebSocketHandler(tornado.web.RequestHandler):
         else:
             origin = self.request.headers.get("Sec-Websocket-Origin", None)
 
-        # When origin is None, assume it didn't come from a browser and we can
-        # pass it on
-        if origin is None:
-            pass
+
         # If there was an origin header, check to make sure it matches
-        # according to check_origin
-        elif origin and not self.check_origin(origin):
+        # according to check_origin. When the origin is None, we assume it
+        # came from a browser and that it can be passed on.
+        if origin is not None and not self.check_origin(origin):
             self.stream.write(tornado.escape.utf8(
                 "HTTP/1.1 403 Cross Origin Websockets Disabled\r\n\r\n"
             ))