[sans-io] close client conn on CONNECT failure

This commit is contained in:
Maximilian Hils 2020-04-05 00:50:43 +02:00
parent b9e3b46fd8
commit 21000fca2c
2 changed files with 3 additions and 2 deletions

View File

@ -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]:

View File

@ -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()