diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index d92561f2d..24b3ddae0 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -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 @@ -591,7 +591,12 @@ class ConsoleMaster(flow.FlowMaster): 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() diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 95de6606d..06465fc4e 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -1043,4 +1043,4 @@ class HTTPHandler(ProtocolHandler, TemporaryServerChangeMixin): self.c.config.authenticator.clean(request.headers) else: raise HttpAuthenticationError(self.c.config.authenticator.auth_challenge_headers()) - return request.headers \ No newline at end of file + return request.headers