mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
[sans-io] close client conn on CONNECT failure
This commit is contained in:
parent
b9e3b46fd8
commit
21000fca2c
@ -369,7 +369,7 @@ class HttpStream(layer.Layer):
|
||||
self._handle_event = self.passthrough
|
||||
else:
|
||||
yield from self.send_response()
|
||||
return SendHttp(ResponseProtocolError(self.stream_id, "EOF"), self.context.client)
|
||||
return (yield SendHttp(ResponseProtocolError(self.stream_id, "EOF"), self.context.client))
|
||||
|
||||
@expect(RequestData, RequestEndOfMessage, events.Event)
|
||||
def passthrough(self, event: events.Event) -> layer.CommandGenerator[None]:
|
||||
|
@ -339,7 +339,8 @@ def test_server_unreachable(tctx, connect):
|
||||
playbook << CloseConnection(tctx.client)
|
||||
|
||||
assert playbook
|
||||
assert flow().error
|
||||
if not connect:
|
||||
assert flow().error
|
||||
assert b"502 Bad Gateway" in err()
|
||||
assert b"Connection failed" in err()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user