console: fix bug that caused wrong direction indicators in message stream flow view (#5923)

This commit is contained in:
konradh 2023-02-10 14:22:05 +01:00 committed by GitHub
parent 5969f25db4
commit 09a83a89b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -2,6 +2,8 @@
## Unreleased: mitmproxy next
* Fix a bug where the direction indicator in the message stream view would be in the wrong direction.
([#5921](https://github.com/mitmproxy/mitmproxy/issues/5921), @konradh)
* Fix a bug where peername would be None in tls_passthrough script, which would make it not working.
([#5904](https://github.com/mitmproxy/mitmproxy/pull/5904), @truebit)

View File

@ -255,21 +255,17 @@ class FlowDetails(tabs.Tabs):
viewmode = self.master.commands.call("console.flowview.mode")
widget_lines = []
from_client = flow.messages[0].from_client
for m in flow.messages:
_, lines, _ = contentviews.get_message_content_view(viewmode, m, flow)
for line in lines:
if from_client:
if m.from_client:
line.insert(0, self.FROM_CLIENT_MARKER)
else:
line.insert(0, self.TO_CLIENT_MARKER)
widget_lines.append(urwid.Text(line))
from_client = not from_client
if flow.intercepted:
markup = widget_lines[-1].get_text()[0]
widget_lines[-1].set_text(("intercept", markup))