diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-24 16:52:03 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-24 16:52:03 +0200 |
commit | f1f34e7713295adb8f54b13ec50d74d43cd42841 (patch) | |
tree | 5f5b7605c46c0ba31d2f3975c308e5c35072cd47 /libmproxy/protocol2/http.py | |
parent | 05d26545e4c65e8fd2242142833a40a96ce5fb81 (diff) | |
download | mitmproxy-f1f34e7713295adb8f54b13ec50d74d43cd42841.tar.gz mitmproxy-f1f34e7713295adb8f54b13ec50d74d43cd42841.tar.bz2 mitmproxy-f1f34e7713295adb8f54b13ec50d74d43cd42841.zip |
fix bugs, fix tests
Diffstat (limited to 'libmproxy/protocol2/http.py')
-rw-r--r-- | libmproxy/protocol2/http.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libmproxy/protocol2/http.py b/libmproxy/protocol2/http.py index f093f7c5..973f169c 100644 --- a/libmproxy/protocol2/http.py +++ b/libmproxy/protocol2/http.py @@ -266,12 +266,15 @@ class HttpLayer(Layer): self.handle_upstream_mode_connect(flow.request.copy()) return - except (HttpErrorConnClosed, NetLibError, HttpError) as e: + except (HttpErrorConnClosed, NetLibError, HttpError, ProtocolException) as e: self.send_to_client(make_error_response( getattr(e, "code", 502), repr(e) )) - raise ProtocolException(repr(e), e) + if isinstance(e, ProtocolException): + raise e + else: + raise ProtocolException(repr(e), e) finally: flow.live = False @@ -468,7 +471,7 @@ class HttpLayer(Layer): def validate_request(self, request): if request.form_in == "absolute" and request.scheme != "http": - self.send_response(make_error_response(400, "Invalid request scheme: %s" % request.scheme)) + self.send_to_client(make_error_response(400, "Invalid request scheme: %s" % request.scheme)) raise HttpException("Invalid request scheme: %s" % request.scheme) expected_request_forms = { |