From 56a4bc381efc177c08ed7b9e7c845f74120050e4 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 24 Aug 2015 18:17:04 +0200 Subject: request -> request_method --- libmproxy/protocol/http.py | 6 +++--- libmproxy/protocol/http_wrappers.py | 20 ++++++-------------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'libmproxy/protocol') diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 1b168569..4472cb2a 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -41,7 +41,7 @@ def send_connect_request(conn, host, port, update_state=True): protocol = http1.HTTP1Protocol(conn) conn.send(protocol.assemble(upstream_request)) - resp = HTTPResponse.from_protocol(protocol, upstream_request) + resp = HTTPResponse.from_protocol(protocol, upstream_request.method) if resp.status_code != 200: raise proxy.ProxyError(resp.status_code, "Cannot establish SSL " + @@ -177,7 +177,7 @@ class HTTPHandler(ProtocolHandler): # Only get the headers at first... flow.response = HTTPResponse.from_protocol( self.c.server_conn.protocol, - flow.request, + flow.request.method, body_size_limit=self.c.config.body_size_limit, include_body=False, ) @@ -760,7 +760,7 @@ class RequestReplayThread(threading.Thread): self.flow.server_conn.protocol = http1.HTTP1Protocol(self.flow.server_conn) self.flow.response = HTTPResponse.from_protocol( self.flow.server_conn.protocol, - r, + r.method, body_size_limit=self.config.body_size_limit, ) if self.channel: diff --git a/libmproxy/protocol/http_wrappers.py b/libmproxy/protocol/http_wrappers.py index f91b936c..b1000a79 100644 --- a/libmproxy/protocol/http_wrappers.py +++ b/libmproxy/protocol/http_wrappers.py @@ -240,13 +240,10 @@ class HTTPRequest(MessageMixin, semantics.Request): def from_protocol( self, protocol, - include_body=True, - body_size_limit=None, + *args, + **kwargs ): - req = protocol.read_request( - include_body = include_body, - body_size_limit = body_size_limit, - ) + req = protocol.read_request(*args, **kwargs) return self.wrap(req) @classmethod @@ -352,15 +349,10 @@ class HTTPResponse(MessageMixin, semantics.Response): def from_protocol( self, protocol, - request, - include_body=True, - body_size_limit=None + *args, + **kwargs ): - resp = protocol.read_response( - request, - body_size_limit, - include_body=include_body - ) + resp = protocol.read_response(*args, **kwargs) return self.wrap(resp) @classmethod -- cgit v1.2.3