http: catch all exceptions

This commit is contained in:
Maximilian Hils 2015-11-26 23:19:43 +01:00
parent a9f64c22f8
commit 6a239526e5

View File

@ -318,6 +318,11 @@ class HttpLayer(Layer):
# Make sure that the incoming request matches our expectations
self.validate_request(request)
# Regular Proxy Mode: Handle CONNECT
if self.mode == "regular" and request.form_in == "authority":
self.handle_regular_mode_connect(request)
return
except HttpReadDisconnect:
# don't throw an error for disconnects that happen before/between requests.
return
@ -327,12 +332,6 @@ class HttpLayer(Layer):
try:
flow = HTTPFlow(self.client_conn, self.server_conn, live=self)
# Regular Proxy Mode: Handle CONNECT
if self.mode == "regular" and request.form_in == "authority":
self.handle_regular_mode_connect(request)
return
flow.request = request
self.process_request_hook(flow)
@ -368,7 +367,7 @@ class HttpLayer(Layer):
self.handle_upstream_mode_connect(flow.request.copy())
return
except NetlibException as e:
except (ProtocolException, NetlibException) as e:
self.send_error_response(502, repr(e))
if not flow.response: