diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-11 23:47:43 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-22 15:30:33 +0200 |
commit | a2bf19125a92a4fa372708cf2cda7887ab62ac76 (patch) | |
tree | df17ba69ce4a69b88aa49c931794acb1d60d3767 /libpathod/protocols/http2.py | |
parent | c1e84cb32296d9e448df1e9cabcc5312a85fb5fe (diff) | |
download | mitmproxy-a2bf19125a92a4fa372708cf2cda7887ab62ac76.tar.gz mitmproxy-a2bf19125a92a4fa372708cf2cda7887ab62ac76.tar.bz2 mitmproxy-a2bf19125a92a4fa372708cf2cda7887ab62ac76.zip |
refactor protocol-related pathod methods
Diffstat (limited to 'libpathod/protocols/http2.py')
-rw-r--r-- | libpathod/protocols/http2.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libpathod/protocols/http2.py b/libpathod/protocols/http2.py new file mode 100644 index 00000000..29c4e556 --- /dev/null +++ b/libpathod/protocols/http2.py @@ -0,0 +1,20 @@ +from netlib import tcp, http, http2, wsgi, certutils, websockets, odict +from .. import version, app, language, utils, log + +class HTTP2Protocol: + + def __init__(self, pathod_handler): + self.pathod_handler = pathod_handler + self.wire_protocol = http2.HTTP2Protocol( + self.pathod_handler, is_server=True, dump_frames=self.pathod_handler.http2_framedump + ) + + def make_error_response(self, reason, body): + return language.http2.make_error_response(reason, body) + + def read_request(self): + self.wire_protocol.perform_server_connection_preface() + return self.wire_protocol.read_request() + + def create_response(self, code, stream_id, headers, body): + return self.wire_protocol.create_response(code, stream_id, headers, body) |