aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/proxy/protocol/http.py22
-rw-r--r--mitmproxy/tools/console/flowlist.py4
-rw-r--r--mitmproxy/tools/console/statusbar.py6
-rw-r--r--test/mitmproxy/addons/test_view.py5
4 files changed, 23 insertions, 14 deletions
diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py
index f3e0f514..50d64e17 100644
--- a/mitmproxy/proxy/protocol/http.py
+++ b/mitmproxy/proxy/protocol/http.py
@@ -182,6 +182,17 @@ class HttpLayer(base.Layer):
try:
self.set_server((f.request.host, f.request.port))
+
+ if f.response:
+ resp = f.response
+ else:
+ resp = http.make_connect_response(f.request.data.http_version)
+
+ self.send_response(resp)
+
+ if is_ok(resp.status_code):
+ layer = self.ctx.next_layer(self)
+ layer()
except (
exceptions.ProtocolException, exceptions.NetlibException
) as e:
@@ -192,17 +203,6 @@ class HttpLayer(base.Layer):
self.channel.ask("error", f)
return False
- if f.response:
- resp = f.response
- else:
- resp = http.make_connect_response(f.request.data.http_version)
-
- self.send_response(resp)
-
- if is_ok(resp.status_code):
- layer = self.ctx.next_layer(self)
- layer()
-
return False
def handle_upstream_connect(self, f):
diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py
index 02265143..1fe0be73 100644
--- a/mitmproxy/tools/console/flowlist.py
+++ b/mitmproxy/tools/console/flowlist.py
@@ -178,8 +178,6 @@ class FlowItem(urwid.WidgetWrap):
elif key == "m":
self.flow.marked = not self.flow.marked
signals.flowlist_change.send(self)
- elif key == "M":
- self.master.view.toggle_marked()
elif key == "r":
try:
self.master.replay_request(self.flow)
@@ -376,6 +374,8 @@ class FlowListBox(urwid.ListBox):
prompt = "Load flows",
callback = self.master.load_flows_callback
)
+ elif key == "M":
+ self.master.view.toggle_marked()
elif key == "n":
signals.status_prompt_onekey.send(
prompt = "Method",
diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py
index dce8605f..785dc766 100644
--- a/mitmproxy/tools/console/statusbar.py
+++ b/mitmproxy/tools/console/statusbar.py
@@ -263,8 +263,12 @@ class StatusBar(urwid.WidgetWrap):
else:
arrow = common.SYMBOL_DOWN
+ marked = ""
+ if self.master.view.show_marked:
+ marked = "M"
+
t = [
- ('heading', ("%s [%s/%s]" % (arrow, offset, fc)).ljust(11)),
+ ('heading', ("%s %s [%s/%s]" % (arrow, marked, offset, fc)).ljust(11)),
]
if self.master.server.bound:
diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py
index 27e10058..96f213e2 100644
--- a/test/mitmproxy/addons/test_view.py
+++ b/test/mitmproxy/addons/test_view.py
@@ -123,6 +123,11 @@ def test_filter():
v.set_filter(None)
assert len(v) == 4
+ v.toggle_marked()
+ assert len(v) == 0
+ v.toggle_marked()
+ assert len(v) == 4
+
v[1].marked = True
v.toggle_marked()
assert len(v) == 1