diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-12 17:57:21 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-12 17:57:21 +0200 |
commit | 32b487109f2d555870a0e93026968fa6eacf9f11 (patch) | |
tree | 6aab46bceebb0520bd8f31fe7535ab4d0cadf170 /libmproxy/protocol/http.py | |
parent | 4106e1961246616a33c6a1b9d7b8208000611e3d (diff) | |
parent | 5fe12a467f37bfba2f4f663274cacbc6ecc770f7 (diff) | |
download | mitmproxy-32b487109f2d555870a0e93026968fa6eacf9f11.tar.gz mitmproxy-32b487109f2d555870a0e93026968fa6eacf9f11.tar.bz2 mitmproxy-32b487109f2d555870a0e93026968fa6eacf9f11.zip |
Merge pull request #765 from mitmproxy/such-colors-very-wow
Improve Content Views
Diffstat (limited to 'libmproxy/protocol/http.py')
-rw-r--r-- | libmproxy/protocol/http.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 3a415320..230f2be9 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -1,6 +1,7 @@ from __future__ import (absolute_import, print_function, division) import itertools import sys +import traceback import six @@ -384,9 +385,13 @@ class HttpLayer(Layer): return except (HttpErrorConnClosed, NetLibError, HttpError, ProtocolException) as e: + error_propagated = False if flow.request and not flow.response: - flow.error = Error(repr(e)) + flow.error = Error(str(e)) self.channel.ask("error", flow) + self.log(traceback.format_exc(), "debug") + error_propagated = True + try: self.send_response(make_error_response( getattr(e, "code", 502), @@ -394,10 +399,12 @@ class HttpLayer(Layer): )) except NetLibError: pass - if isinstance(e, ProtocolException): - six.reraise(ProtocolException, e, sys.exc_info()[2]) - else: - six.reraise(ProtocolException, ProtocolException("Error in HTTP connection: %s" % repr(e)), sys.exc_info()[2]) + + if not error_propagated: + if isinstance(e, ProtocolException): + six.reraise(ProtocolException, e, sys.exc_info()[2]) + else: + six.reraise(ProtocolException, ProtocolException("Error in HTTP connection: %s" % repr(e)), sys.exc_info()[2]) finally: flow.live = False |