aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortarnacious <tarn@tarnbarford.net>2017-03-01 16:35:54 +0100
committertarnacious <tarn@tarnbarford.net>2017-03-01 16:35:54 +0100
commitfc3848345bce893918bb532216b4598fea2f574b (patch)
tree72a453f86c78dedf5f8f57dca744c917bcb3ee05
parenta505221e1ab210d35c91c9126eb6b621637235b3 (diff)
downloadmitmproxy-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.py2
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)
)