From 7ffdac506b704bf5742a5984ca1fbafb136bb333 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 13 Oct 2022 19:59:55 +0200 Subject: [PATCH] console: use `get_message_content_view` --- mitmproxy/contentviews/__init__.py | 17 ----------------- mitmproxy/tools/console/flowview.py | 15 ++------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/mitmproxy/contentviews/__init__.py b/mitmproxy/contentviews/__init__.py index 66dc3a98e..86fff00b2 100644 --- a/mitmproxy/contentviews/__init__.py +++ b/mitmproxy/contentviews/__init__.py @@ -159,23 +159,6 @@ def get_message_content_view( return description, lines, error -def get_proto_content_view( - viewname: str, - data: bytes, - flow: Union[TCPFlow, UDPFlow], -): - viewmode = get(viewname) - if not viewmode: - viewmode = get("auto") - - # https://github.com/mitmproxy/mitmproxy/pull/3970#issuecomment-623024447 - assert viewmode - - description, lines, error = get_content_view(viewmode, data, flow=flow) - - return description, lines, error - - def get_content_view( viewmode: View, data: bytes, diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index 68214e70b..20e969c39 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -255,22 +255,11 @@ class FlowDetails(tabs.Tabs): viewmode = self.master.commands.call("console.flowview.mode") - # Merge adjacent TCP "messages". For detailed explanation of this code block see: - # https://github.com/mitmproxy/mitmproxy/pull/3970/files/469bd32582f764f9a29607efa4f5b04bd87961fb#r418670880 - from_client = None - messages = [] - for message in flow.messages: - if message.from_client is not from_client: - messages.append(message.content) - from_client = message.from_client - else: - messages[-1] += message.content - widget_lines = [] from_client = flow.messages[0].from_client - for m in messages: - _, lines, _ = contentviews.get_proto_content_view(viewmode, m, flow) + for m in flow.messages: + _, lines, _ = contentviews.get_message_content_view(viewmode, m, flow) for line in lines: if from_client: