diff options
author | tarnacious <tarn@tarnbarford.net> | 2017-03-01 16:35:54 +0100 |
---|---|---|
committer | tarnacious <tarn@tarnbarford.net> | 2017-03-01 16:35:54 +0100 |
commit | fc3848345bce893918bb532216b4598fea2f574b (patch) | |
tree | 72a453f86c78dedf5f8f57dca744c917bcb3ee05 | |
parent | a505221e1ab210d35c91c9126eb6b621637235b3 (diff) | |
download | mitmproxy-fc3848345bce893918bb532216b4598fea2f574b.tar.gz mitmproxy-fc3848345bce893918bb532216b4598fea2f574b.tar.bz2 mitmproxy-fc3848345bce893918bb532216b4598fea2f574b.zip |
Call error handler and mark flow on HTTPException
This allows scripts to handle HTTPExceptions such as "HTTP Body too
large" raised in mitmproxy/net/http/http1/read.py:131
-rw-r--r-- | mitmproxy/proxy/protocol/http.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py index 16d04eeb..154646cd 100644 --- a/mitmproxy/proxy/protocol/http.py +++ b/mitmproxy/proxy/protocol/http.py @@ -276,6 +276,8 @@ class HttpLayer(base.Layer): # We optimistically guess there might be an HTTP client on the # other end self.send_error_response(400, repr(e)) + f.error = flow.Error(str(e)) + self.channel.ask("error", f) raise exceptions.ProtocolException( "HTTP protocol error in client request: {}".format(e) ) |