diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-01-23 18:28:57 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-01-23 18:38:27 +0100 |
commit | 5792e2c483e622896790bb5f08ac67002e18cc14 (patch) | |
tree | 558745313535d6c5aa425ffa0ddfdc5d2e798624 | |
parent | d674de298cbaef2eb5348ed65ef51775edadb89b (diff) | |
download | mitmproxy-5792e2c483e622896790bb5f08ac67002e18cc14.tar.gz mitmproxy-5792e2c483e622896790bb5f08ac67002e18cc14.tar.bz2 mitmproxy-5792e2c483e622896790bb5f08ac67002e18cc14.zip |
test disable_h2c_upgrade addon
-rw-r--r-- | mitmproxy/test/tflow.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_disable_h2c_upgrade.py | 17 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_dumper.py | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/mitmproxy/test/tflow.py b/mitmproxy/test/tflow.py index a93c86dd..edf4d7a7 100644 --- a/mitmproxy/test/tflow.py +++ b/mitmproxy/test/tflow.py @@ -27,6 +27,7 @@ def ttcpflow(client_conn=True, server_conn=True, messages=True, err=None): f.reply = controller.DummyReply() return f + def twebsocketflow(client_conn=True, server_conn=True, messages=True, err=None, handshake_flow=True): if client_conn is True: diff --git a/test/mitmproxy/addons/test_disable_h2c_upgrade.py b/test/mitmproxy/addons/test_disable_h2c_upgrade.py new file mode 100644 index 00000000..6cab713d --- /dev/null +++ b/test/mitmproxy/addons/test_disable_h2c_upgrade.py @@ -0,0 +1,17 @@ +from mitmproxy.addons import disable_h2c_upgrade +from mitmproxy.test import tflow + + +class TestTermLog: + def test_simple(self): + a = disable_h2c_upgrade.DisableH2CleartextUpgrade() + + f = tflow.tflow() + f.request.headers['upgrade'] = 'h2c' + f.request.headers['connection'] = 'foo' + f.request.headers['http2-settings'] = 'bar' + + a.request(f) + assert 'upgrade' not in f.request.headers + assert 'connection' not in f.request.headers + assert 'http2-settings' not in f.request.headers diff --git a/test/mitmproxy/addons/test_dumper.py b/test/mitmproxy/addons/test_dumper.py index 1a2639a2..8fa8a22a 100644 --- a/test/mitmproxy/addons/test_dumper.py +++ b/test/mitmproxy/addons/test_dumper.py @@ -166,6 +166,7 @@ def test_tcp(): d.tcp_error(f) assert "Error in TCP" in sio.getvalue() + def test_websocket(): sio = io.StringIO() d = dumper.Dumper(sio) |