aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-24 15:15:41 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-24 15:15:41 +1200
commitb4e9e55c3420f9bcd27142dfaaf0934e73d90b6f (patch)
tree1b116750f1fc4eba572902429dc2d0bd2d2f07ba /libmproxy/console
parenta5bf9d3eb3da9de9aa9438de3c192a3023c90e6c (diff)
downloadmitmproxy-b4e9e55c3420f9bcd27142dfaaf0934e73d90b6f.tar.gz
mitmproxy-b4e9e55c3420f9bcd27142dfaaf0934e73d90b6f.tar.bz2
mitmproxy-b4e9e55c3420f9bcd27142dfaaf0934e73d90b6f.zip
Be more tolerant of corrupted or truncated flows.
We load as far as possible. mitmproxy will only terminate if it was not able to recover any flows. mitmdump will stop loading as soon as an error is encountered, but not exit with an error.
Diffstat (limited to 'libmproxy/console')
-rw-r--r--libmproxy/console/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index bad73e91..898e858f 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -548,7 +548,9 @@ class ConsoleMaster(flow.FlowMaster):
if self.options.rfile:
ret = self.load_flows(self.options.rfile)
- if ret:
+ if ret and self.state.flow_count():
+ self.add_event("File truncated or corrupted. Loaded as many flows as possible.")
+ else:
self.shutdown()
print >> sys.stderr, "Could not load file:", ret
sys.exit(1)
@@ -653,14 +655,16 @@ class ConsoleMaster(flow.FlowMaster):
fr = flow.FlowReader(f)
except IOError, v:
return v.strerror
+ reterr = None
try:
flow.FlowMaster.load_flows(self, fr)
except flow.FlowReadError, v:
- return v.strerror
+ reterr = v.strerror
f.close()
if self.flow_list_walker:
self.sync_list_view()
self.focus_current()
+ return reterr
def path_prompt(self, prompt, text, callback, *args):
self.statusbar.path_prompt(prompt, text)