diff options
author | Maximilian Hils <git@maximilianhils.com> | 2019-11-15 17:45:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-15 17:45:28 +0100 |
commit | fbbbbb678e77e3cff5ab35b1fd55e85e875ed3f5 (patch) | |
tree | b9d07b980bc87f7f8365aebca72c58e5c280ebf0 /mitmproxy/proxy | |
parent | f6f9eb2c4e022cd44ccc39b3f61fdf31cbfea793 (diff) | |
parent | 0d042c6d8eb89691b7f731ccfd3d4bbaa27e3d48 (diff) | |
download | mitmproxy-fbbbbb678e77e3cff5ab35b1fd55e85e875ed3f5.tar.gz mitmproxy-fbbbbb678e77e3cff5ab35b1fd55e85e875ed3f5.tar.bz2 mitmproxy-fbbbbb678e77e3cff5ab35b1fd55e85e875ed3f5.zip |
Merge pull request #3612 from ccssrryy/fix-dup-resp
fix duplicate error response
Diffstat (limited to 'mitmproxy/proxy')
-rw-r--r-- | mitmproxy/proxy/protocol/http.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py index 2ae656b3..4c20617b 100644 --- a/mitmproxy/proxy/protocol/http.py +++ b/mitmproxy/proxy/protocol/http.py @@ -263,7 +263,7 @@ class HttpLayer(base.Layer): else: msg = "Unexpected CONNECT request." self.send_error_response(400, msg) - raise exceptions.ProtocolException(msg) + return False validate_request_form(self.mode, request) self.channel.ask("requestheaders", f) @@ -289,9 +289,12 @@ class HttpLayer(base.Layer): f.request = None f.error = flow.Error(str(e)) self.channel.ask("error", f) - raise exceptions.ProtocolException( - "HTTP protocol error in client request: {}".format(e) - ) from e + self.log( + "request", + "warn", + ["HTTP protocol error in client request: {}".format(e)] + ) + return False self.log("request", "debug", [repr(request)]) @@ -448,8 +451,8 @@ class HttpLayer(base.Layer): return False # should never be reached except (exceptions.ProtocolException, exceptions.NetlibException) as e: - self.send_error_response(502, repr(e)) if not f.response: + self.send_error_response(502, repr(e)) f.error = flow.Error(str(e)) self.channel.ask("error", f) return False |