Skip to content

Commit

Permalink
Better response when mitmproxy crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Feb 8, 2014
1 parent 569e5d3 commit b642b48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions libmproxy/console/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mailcap, mimetypes, tempfile, os, subprocess, glob, time, shlex, stat
import os.path, sys, weakref
import os.path, sys, weakref, traceback
import urwid
from .. import controller, utils, flow, script
import flowlist, flowview, help, common, grideditor, palettes, contentview, flowdetailview
Expand Down Expand Up @@ -591,7 +591,12 @@ def run(self):
print >> sys.stderr, "Could not load file:", ret
sys.exit(1)

self.ui.run_wrapper(self.loop)
try:
self.ui.run_wrapper(self.loop)
except Exception:
print >> sys.stderr, traceback.format_exc()
print >> sys.stderr, "mitmproxy has crashed!"
print >> sys.stderr, "Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy"
# If True, quit just pops out to flow list view.
print >> sys.stderr, "Shutting down..."
sys.stderr.flush()
Expand Down
2 changes: 1 addition & 1 deletion libmproxy/protocol/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,4 +1043,4 @@ def authenticate(self, request):
self.c.config.authenticator.clean(request.headers)
else:
raise HttpAuthenticationError(self.c.config.authenticator.auth_challenge_headers())
return request.headers
return request.headers

0 comments on commit b642b48

Please sign in to comment.