mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +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
|
self._handle_event = self.passthrough
|
||||||
else:
|
else:
|
||||||
yield from self.send_response()
|
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)
|
@expect(RequestData, RequestEndOfMessage, events.Event)
|
||||||
def passthrough(self, event: events.Event) -> layer.CommandGenerator[None]:
|
def passthrough(self, event: events.Event) -> layer.CommandGenerator[None]:
|
||||||
|
@ -339,6 +339,7 @@ def test_server_unreachable(tctx, connect):
|
|||||||
playbook << CloseConnection(tctx.client)
|
playbook << CloseConnection(tctx.client)
|
||||||
|
|
||||||
assert playbook
|
assert playbook
|
||||||
|
if not connect:
|
||||||
assert flow().error
|
assert flow().error
|
||||||
assert b"502 Bad Gateway" in err()
|
assert b"502 Bad Gateway" in err()
|
||||||
assert b"Connection failed" in err()
|
assert b"Connection failed" in err()
|
||||||
|
Loading…
Reference in New Issue
Block a user