diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-24 18:17:04 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-24 18:17:04 +0200 |
commit | 56a4bc381efc177c08ed7b9e7c845f74120050e4 (patch) | |
tree | 579bebfecc1d4c3012daf1bcd76a10141d82e30f /libmproxy/protocol2/http.py | |
parent | f1f34e7713295adb8f54b13ec50d74d43cd42841 (diff) | |
download | mitmproxy-56a4bc381efc177c08ed7b9e7c845f74120050e4.tar.gz mitmproxy-56a4bc381efc177c08ed7b9e7c845f74120050e4.tar.bz2 mitmproxy-56a4bc381efc177c08ed7b9e7c845f74120050e4.zip |
request -> request_method
Diffstat (limited to 'libmproxy/protocol2/http.py')
-rw-r--r-- | libmproxy/protocol2/http.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libmproxy/protocol2/http.py b/libmproxy/protocol2/http.py index 973f169c..2c8c8d27 100644 --- a/libmproxy/protocol2/http.py +++ b/libmproxy/protocol2/http.py @@ -34,10 +34,10 @@ class Http1Layer(Layer): body_size_limit=self.config.body_size_limit ) - def read_from_server(self, request): + def read_from_server(self, request_method): return HTTPResponse.from_protocol( self.server_protocol, - request, + request_method, body_size_limit=self.config.body_size_limit, include_body=False, ) @@ -64,6 +64,7 @@ class Http1Layer(Layer): layer = HttpLayer(self, self.mode) layer() + class Http2Layer(Layer): def __init__(self, ctx, mode): super(Http2Layer, self).__init__(ctx) @@ -72,20 +73,20 @@ class Http2Layer(Layer): self.server_protocol = HTTP2Protocol(self.server_conn, is_server=False, unhandled_frame_cb=self.handle_unexpected_frame) def read_from_client(self): - return HTTPRequest.from_protocol( + request = HTTPRequest.from_protocol( self.client_protocol, body_size_limit=self.config.body_size_limit ) + self._stream_id = request.stream_id - def read_from_server(self, request): - response = HTTPResponse.from_protocol( + def read_from_server(self, request_method): + return HTTPResponse.from_protocol( self.server_protocol, - request, + request_method, body_size_limit=self.config.body_size_limit, include_body=False, + stream_id=self._stream_id ) - response.stream_id = request.stream_id - return response def send_to_client(self, message): # TODO: implement flow control and WINDOW_UPDATE frames @@ -356,7 +357,7 @@ class HttpLayer(Layer): def get_response_from_server(self, flow): def get_response(): self.send_to_server(flow.request) - flow.response = self.read_from_server(flow.request) + flow.response = self.read_from_server(flow.request.method) try: get_response() |