diff options
Diffstat (limited to 'examples/ignore_websocket.py')
-rw-r--r-- | examples/ignore_websocket.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/ignore_websocket.py b/examples/ignore_websocket.py index 48093951..b52f18f8 100644 --- a/examples/ignore_websocket.py +++ b/examples/ignore_websocket.py @@ -24,11 +24,13 @@ def done(context): HTTPRequest._headers_to_strip_off.append("Connection") HTTPRequest._headers_to_strip_off.append("Upgrade") + @concurrent def response(context, flow): - if flow.response.headers.get_first("Connection", None) == "Upgrade": + value = flow.response.headers.get_first("Connection", None) + if value and value.upper() == "UPGRADE": # We need to send the response manually now... flow.client_conn.send(flow.response.assemble()) # ...and then delegate to tcp passthrough. TCPHandler(flow.live.c, log=False).handle_messages() - flow.reply(KILL)
\ No newline at end of file + flow.reply(KILL) |