aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/protocols/http2.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-07-24 17:43:41 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-07-24 17:43:41 +0200
commitf8b4d666870163d6770aabefe212b8ecd981d490 (patch)
tree8c6f2fc9ef4c06c40a04514f651785540d278bf3 /libpathod/protocols/http2.py
parent9a1bee31d6d7b92bf5b4cb68d853c856acdfb036 (diff)
parent96c9c4459f0bb9b76ab34f8c8d03d0e5d28621f4 (diff)
downloadmitmproxy-f8b4d666870163d6770aabefe212b8ecd981d490.tar.gz
mitmproxy-f8b4d666870163d6770aabefe212b8ecd981d490.tar.bz2
mitmproxy-f8b4d666870163d6770aabefe212b8ecd981d490.zip
Merge pull request #31 from Kriechi/protocol-refactor
HTTP protocol refactoring
Diffstat (limited to 'libpathod/protocols/http2.py')
-rw-r--r--libpathod/protocols/http2.py20
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..82ec5482
--- /dev/null
+++ b/libpathod/protocols/http2.py
@@ -0,0 +1,20 @@
+from netlib.http import http2
+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, lg=None):
+ 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)