mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Catch occasional protocol errors in regular connect
Fixes #1843 and #1847
This commit is contained in:
parent
6b5673e849
commit
61e552553c
@ -182,15 +182,6 @@ class HttpLayer(base.Layer):
|
||||
|
||||
try:
|
||||
self.set_server((f.request.host, f.request.port))
|
||||
except (
|
||||
exceptions.ProtocolException, exceptions.NetlibException
|
||||
) as e:
|
||||
# HTTPS tasting means that ordinary errors like resolution
|
||||
# and connection errors can happen here.
|
||||
self.send_error_response(502, repr(e))
|
||||
f.error = flow.Error(str(e))
|
||||
self.channel.ask("error", f)
|
||||
return False
|
||||
|
||||
if f.response:
|
||||
resp = f.response
|
||||
@ -202,6 +193,15 @@ class HttpLayer(base.Layer):
|
||||
if is_ok(resp.status_code):
|
||||
layer = self.ctx.next_layer(self)
|
||||
layer()
|
||||
except (
|
||||
exceptions.ProtocolException, exceptions.NetlibException
|
||||
) as e:
|
||||
# HTTPS tasting means that ordinary errors like resolution
|
||||
# and connection errors can happen here.
|
||||
self.send_error_response(502, repr(e))
|
||||
f.error = flow.Error(str(e))
|
||||
self.channel.ask("error", f)
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user