WebSocketHandler._handle_one_version7_response doesn't check for Upgrade and Connection headers

Issue #2 invalid
Lon Ingram
repo owner created an issue

The spec doesn't call these out as required in 5.2.1, but they clearly are. The server should fail the connection if either is not present or has the wrong value.

Comments (4)

  1. Ciaran Farrell

    Not sure if this relates to the same things, but the error I'm getting from using your fork is certainly different to the one I was getting from the original. There doesn't seem to be a websocket_connection in the WebSocketHandler object. From looking at the handler.py code (and the gevent.pywsgi code) I can't see where this would be initialized - there is only one reference to self.websocket_connection and that is the if that checks if it is present (which fails)... - - [2011-10-15 10:17:28] "GET / HTTP/1.1" 000 0 0.000236
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
        result = self._run(*self.args, **self.kwargs)
      File "/usr/lib/python2.7/site-packages/gevent/pywsgi.py", line 571, in handle
      File "/usr/lib/python2.7/site-packages/gevent/pywsgi.py", line 180, in handle
        result = self.handle_one_request()
      File "/usr/lib/python2.7/site-packages/gevent/pywsgi.py", line 314, in handle_one_request
      File "/usr/lib/python2.7/site-packages/geventwebsocket/handler.py", line 49, in handle_one_response
        return super(WebSocketHandler, self).handle_one_response()
      File "/usr/lib/python2.7/site-packages/gevent/pywsgi.py", line 454, in handle_one_response
      File "/usr/lib/python2.7/site-packages/geventwebsocket/handler.py", line 109, in start_response
        if self.websocket_connection:
    AttributeError: 'WebSocketHandler' object has no attribute 'websocket_connection'
    <Greenlet at 0xb6cdeaacL: <bound method WSGIServer.handle of <WSGIServer at 0xb6fa1c2cL fileno=3 address=>>(<socket at 0xb6d0770cL fileno=[Errno 9] Bad file d, ('', 36615))> failed with AttributeError
  2. Log in to comment