From fc3848345bce893918bb532216b4598fea2f574b Mon Sep 17 00:00:00 2001 From: tarnacious Date: Wed, 1 Mar 2017 16:35:54 +0100 Subject: 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 --- mitmproxy/proxy/protocol/http.py | 2 ++ 1 file changed, 2 insertions(+) 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) ) -- cgit v1.2.3