mitmproxy/pathod/protocols/http2.py

22 lines
695 B
Python
Raw Normal View History

2015-07-15 20:04:25 +00:00
from netlib.http import http2
2016-05-28 12:36:43 +00:00
from .. import language
2016-05-28 20:25:54 +00:00
class HTTP2Protocol:
def __init__(self, pathod_handler):
self.pathod_handler = pathod_handler
2015-09-16 18:12:53 +00:00
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)
2015-07-18 13:54:29 +00:00
def read_request(self, lg=None):
self.wire_protocol.perform_server_connection_preface()
2015-09-16 16:44:34 +00:00
return self.wire_protocol.read_request(self.pathod_handler.rfile)
2015-07-29 09:26:10 +00:00
def assemble(self, message):
return self.wire_protocol.assemble(message)