aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Stupin <18281368+nikitastupin@users.noreply.github.com>2020-05-03 10:42:31 +0300
committerNikita Stupin <18281368+nikitastupin@users.noreply.github.com>2020-05-03 10:42:31 +0300
commitfe75f14ea29d0654c3a688ecc4c3669a946ea2a8 (patch)
tree9befc172c55f736ff3c3394b0fa6ab88fea90313
parent5ce87b72537ae9b6dca73159549444bd4f28e186 (diff)
downloadmitmproxy-fe75f14ea29d0654c3a688ecc4c3669a946ea2a8.tar.gz
mitmproxy-fe75f14ea29d0654c3a688ecc4c3669a946ea2a8.tar.bz2
mitmproxy-fe75f14ea29d0654c3a688ecc4c3669a946ea2a8.zip
Revert view_tcp_stream to List[bytes] implementation
-rw-r--r--mitmproxy/tools/console/flowview.py34
1 files changed, 14 insertions, 20 deletions
diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py
index e6574338..466ff0c2 100644
--- a/mitmproxy/tools/console/flowview.py
+++ b/mitmproxy/tools/console/flowview.py
@@ -139,39 +139,33 @@ class FlowDetails(tabs.Tabs):
# Merge adjacent TCP "messages". For detailed explanation of this code block see:
# https://github.com/mitmproxy/mitmproxy/pull/3970/files/469bd32582f764f9a29607efa4f5b04bd87961fb#r418670880
- merged_messages = []
+ from_client = None
+ messages = []
for message in flow.messages:
-
- if not merged_messages:
- merged_messages.append({
- "content": message.content,
- "from_client": message.from_client,
- })
- continue
-
- if merged_messages[-1]["from_client"] == message.from_client:
- merged_messages[-1]["content"] += message.content
+ if message.from_client is not from_client:
+ messages.append(message.content)
+ from_client = message.from_client
else:
- merged_messages.append({
- "content": message.content,
- "from_client": message.from_client,
- })
+ messages[-1] += message.content
widget_lines = []
- widget_lines.append(self._contentview_status_bar(viewmode.capitalize(), viewmode))
-
- for message in merged_messages:
- _, lines, _ = contentviews.get_tcp_content_view(viewmode, message["content"])
+ from_client = flow.messages[0].from_client
+ for m in messages:
+ _, lines, _ = contentviews.get_tcp_content_view(viewmode, m)
for line in lines:
- if message["from_client"]:
+ if from_client:
line.insert(0, ("from_client", f"{common.SYMBOL_FROM_CLIENT} "))
else:
line.insert(0, ("to_client", f"{common.SYMBOL_TO_CLIENT} "))
widget_lines.append(urwid.Text(line))
+ from_client = not from_client
+
+ widget_lines.insert(0, self._contentview_status_bar(viewmode.capitalize(), viewmode))
+
return searchable.Searchable(widget_lines)
def view_details(self):