zeekay/flask-uwsgi-websocket — pull request #14 by Fizzadar (2014-11-23 16:48:39+00:00)
Title: Return normal Flask response for HTTP requests

Tiny little check for missing `HTTP_SEC_WEBSOCKET_KEY` headers, which would imply a normal HTTP connection; previously caused an exception (below) - Flask should provide a 404/similar response with this change.

```
*** running gevent loop engine [addr:0x10cc69f70] ***
Python auto-reloader enabled
Traceback (most recent call last):
File "/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/flask_uwsgi_websocket/_gevent.py", line 46, in __call__
uwsgi.websocket_handshake(environ.get('HTTP_SEC_WEBSOCKET_KEY'), environ.get('HTTP_ORIGIN', ''))
TypeError: must be string or read-only buffer, not None
```