diff options
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/__init__.py | 1 | ||||
-rw-r--r-- | libmproxy/console/common.py | 16 | ||||
-rw-r--r-- | libmproxy/console/flowlist.py | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index dc551a22..527ed07d 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -299,6 +299,7 @@ class ConsoleMaster(flow.FlowMaster): def toggle_eventlog(self): self.eventlog = not self.eventlog + signals.pop_view_state.send(self) self.view_flowlist() def _readflows(self, path): diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py index f417aade..ba6ba5b0 100644 --- a/libmproxy/console/common.py +++ b/libmproxy/console/common.py @@ -202,6 +202,7 @@ def save_data(path, data, master, state): except IOError, v: signals.status_message.send(message=v.strerror) + def ask_save_overwite(path, data, master, state): if not path: return @@ -222,6 +223,7 @@ def ask_save_overwite(path, data, master, state): else: save_data(path, data, master, state) + def ask_save_path(prompt, data, master, state): signals.status_prompt_path.send( prompt = prompt, @@ -236,6 +238,8 @@ def copy_flow_format_data(part, scope, flow): else: data = "" if scope in ("q", "a"): + if flow.request.content is None or flow.request.content == CONTENT_MISSING: + return None, "Request content is missing" with decoded(flow.request): if part == "h": data += flow.request.assemble() @@ -247,6 +251,8 @@ def copy_flow_format_data(part, scope, flow): # Add padding between request and response data += "\r\n" * 2 if scope in ("s", "a") and flow.response: + if flow.response.content is None or flow.response.content == CONTENT_MISSING: + return None, "Response content is missing" with decoded(flow.response): if part == "h": data += flow.response.assemble() @@ -254,15 +260,19 @@ def copy_flow_format_data(part, scope, flow): data += flow.response.content else: raise ValueError("Unknown part: {}".format(part)) - return data + return data, False def copy_flow(part, scope, flow, master, state): """ - part: _c_ontent, _a_ll, _u_rl + part: _c_ontent, _h_eaders+content, _u_rl scope: _a_ll, re_q_uest, re_s_ponse """ - data = copy_flow_format_data(part, scope, flow) + data, err = copy_flow_format_data(part, scope, flow) + + if err: + signals.status_message.send(message=err) + return if not data: if scope == "q": diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index c7a0d1b7..6ab45bad 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -233,8 +233,6 @@ class ConnectionItem(urwid.WidgetWrap): class FlowListWalker(urwid.ListWalker): def __init__(self, master, state): self.master, self.state = master, state - if self.state.flow_count(): - self.set_focus(0) signals.flowlist_change.connect(self.sig_flowlist_change) def sig_flowlist_change(self, sender): |