diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-06-11 15:38:32 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-06-12 14:42:07 +0200 |
commit | 8ea157775debeccfa0f2fab3aa7e009d13ce4391 (patch) | |
tree | 7b3aa596916f78b19314ce4df95064bbe1e24f2e /test/http2/test_http2_protocol.py | |
parent | eeaed93a83fbe14762e263e9f25b5361088daa15 (diff) | |
download | mitmproxy-8ea157775debeccfa0f2fab3aa7e009d13ce4391.tar.gz mitmproxy-8ea157775debeccfa0f2fab3aa7e009d13ce4391.tar.bz2 mitmproxy-8ea157775debeccfa0f2fab3aa7e009d13ce4391.zip |
http2: general improvements
Diffstat (limited to 'test/http2/test_http2_protocol.py')
-rw-r--r-- | test/http2/test_http2_protocol.py | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/test/http2/test_http2_protocol.py b/test/http2/test_http2_protocol.py index cb46bc68..1591edd8 100644 --- a/test/http2/test_http2_protocol.py +++ b/test/http2/test_http2_protocol.py @@ -50,7 +50,39 @@ class TestCheckALPNMismatch(test.ServerTestBase): tutils.raises(NotImplementedError, protocol.check_alpn) -class TestPerformConnectionPreface(test.ServerTestBase): +class TestPerformServerConnectionPreface(test.ServerTestBase): + class handler(tcp.BaseHandler): + + def handle(self): + # send magic + self.wfile.write(\ + '505249202a20485454502f322e300d0a0d0a534d0d0a0d0a'.decode('hex')) + self.wfile.flush() + + # send empty settings frame + self.wfile.write('000000040000000000'.decode('hex')) + self.wfile.flush() + + # check empty settings frame + assert self.rfile.read(9) ==\ + '000000040000000000'.decode('hex') + + # check settings acknowledgement + assert self.rfile.read(9) == \ + '000000040100000000'.decode('hex') + + # send settings acknowledgement + self.wfile.write('000000040100000000'.decode('hex')) + self.wfile.flush() + + def test_perform_server_connection_preface(self): + c = tcp.TCPClient(("127.0.0.1", self.port)) + c.connect() + protocol = http2.HTTP2Protocol(c) + protocol.perform_server_connection_preface() + + +class TestPerformClientConnectionPreface(test.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): @@ -74,14 +106,11 @@ class TestPerformConnectionPreface(test.ServerTestBase): self.wfile.write('000000040100000000'.decode('hex')) self.wfile.flush() - ssl = True - - def test_perform_connection_preface(self): + def test_perform_client_connection_preface(self): c = tcp.TCPClient(("127.0.0.1", self.port)) c.connect() - c.convert_to_ssl() protocol = http2.HTTP2Protocol(c) - protocol.perform_connection_preface() + protocol.perform_client_connection_preface() class TestStreamIds(): |