Commits

Jeffrey Gelens committed 5093a51

Closed #49: Changed header check order to allow HTTP/1.0 for non-websocket WSGI apps.

Comments (0)

Files changed (1)

geventwebsocket/handler.py

             self.logger.debug('Can only upgrade connection if using GET method.')
             return
 
-        if self.request_version != 'HTTP/1.1':
-            self.start_response('402 Bad Request', [])
-            self.logger.warning("Bad server protocol in headers")
-
-            return ['Bad protocol version']
-
         upgrade = self.environ.get('HTTP_UPGRADE', '').lower()
 
         if upgrade == 'websocket':
             # This is not a websocket request, so we must not handle it
             return
 
+        if self.request_version != 'HTTP/1.1':
+            self.start_response('402 Bad Request', [])
+            self.logger.warning("Bad server protocol in headers")
+
+            return ['Bad protocol version']
+
         if self.environ.get('HTTP_SEC_WEBSOCKET_VERSION'):
             return self.upgrade_connection()
         else: