console: use `get_message_content_view`

This commit is contained in:
Maximilian Hils 2022-10-13 19:59:55 +02:00
parent 051c90067f
commit 7ffdac506b
2 changed files with 2 additions and 30 deletions

View File

@ -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,

View File

@ -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: