From 3254595584e1d711e7ae292ad34753a52f7a0fc1 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 25 Jul 2016 15:12:20 -0700 Subject: [PATCH] minor fixes --- mitmproxy/web/app.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mitmproxy/web/app.py b/mitmproxy/web/app.py index 848ca4741..8ccc21c52 100644 --- a/mitmproxy/web/app.py +++ b/mitmproxy/web/app.py @@ -47,8 +47,8 @@ def convert_flow_to_json_dict(flow): "path": flow.request.path, "http_version": flow.request.http_version, "headers": tuple(flow.request.headers.items(True)), - "contentLength": len(flow.request.content) if flow.request.content is not None else None, - "contentHash": hashlib.sha256(flow.request.raw_content).hexdigest() if flow.request.content is not None else None, + "contentLength": len(flow.request.raw_content) if flow.request.raw_content is not None else None, + "contentHash": hashlib.sha256(flow.request.raw_content).hexdigest() if flow.request.raw_content is not None else None, "timestamp_start": flow.request.timestamp_start, "timestamp_end": flow.request.timestamp_end, "is_replay": flow.request.is_replay, @@ -59,8 +59,8 @@ def convert_flow_to_json_dict(flow): "status_code": flow.response.status_code, "reason": flow.response.reason, "headers": tuple(flow.response.headers.items(True)), - "contentLength": len(flow.response.content) if flow.response.content is not None else None, - "contentHash": hashlib.sha256(flow.response.raw_content).hexdigest() if flow.response.content is not None else None, + "contentLength": len(flow.response.raw_content) if flow.response.raw_content is not None else None, + "contentHash": hashlib.sha256(flow.response.raw_content).hexdigest() if flow.response.raw_content is not None else None, "timestamp_start": flow.response.timestamp_start, "timestamp_end": flow.response.timestamp_end, "is_replay": flow.response.is_replay, @@ -304,11 +304,10 @@ class ReplayFlow(RequestHandler): class FlowContent(RequestHandler): def post(self, flow_id, message): - flow = self.flow - flow.backup() - message = getattr(flow, message) + self.flow.backup() + message = getattr(self.flow, message) message.content = self.request.files.values()[0][0].body - self.state.update_flow(flow) + self.state.update_flow(self.flow) def get(self, flow_id, message): message = getattr(self.flow, message)