mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user