aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ignore_websocket.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-12-01 03:36:04 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-12-01 03:36:04 +0100
commita7a9ef826c206ca93c20ae26c20f5e5a2d5de8e6 (patch)
tree60d3b912aa8f06c1cd162e13ebb757dc53448e95 /examples/ignore_websocket.py
parent40fbb95701a7172fe1b11f7432fb8dcf0f26b978 (diff)
downloadmitmproxy-a7a9ef826c206ca93c20ae26c20f5e5a2d5de8e6.tar.gz
mitmproxy-a7a9ef826c206ca93c20ae26c20f5e5a2d5de8e6.tar.bz2
mitmproxy-a7a9ef826c206ca93c20ae26c20f5e5a2d5de8e6.zip
fix tests
Diffstat (limited to 'examples/ignore_websocket.py')
-rw-r--r--examples/ignore_websocket.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/examples/ignore_websocket.py b/examples/ignore_websocket.py
index 1ee81d38..48093951 100644
--- a/examples/ignore_websocket.py
+++ b/examples/ignore_websocket.py
@@ -14,14 +14,21 @@ from libmproxy.protocol.tcp import TCPHandler
from libmproxy.protocol import KILL
from libmproxy.script import concurrent
-HTTPRequest._headers_to_strip_off.remove("Connection")
-HTTPRequest._headers_to_strip_off.remove("Upgrade")
+
+def start(context, argv):
+ HTTPRequest._headers_to_strip_off.remove("Connection")
+ HTTPRequest._headers_to_strip_off.remove("Upgrade")
+
+
+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":
- # 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
+ if flow.response.headers.get_first("Connection", None) == "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