Skip to content

Commit 1884878

Browse files
jalopezsilvasethmlarson
authored andcommitted
[1.26] Properly proxy EOF on the SSLTransport test suite
Previously the proxy was continuously ignoring EOF signals and keeping the socket open. Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com>
1 parent a891304 commit 1884878

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test_ssltransport.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def proxy_handler(listener):
258258
)
259259
self._read_write_loop(client_sock, upstream_sock)
260260
upstream_sock.close()
261+
client_sock.close()
261262

262263
self._start_server(proxy_handler)
263264

@@ -286,6 +287,10 @@ def _read_write_loop(self, client_sock, server_sock, chunks=65536):
286287
if write_socket in writable:
287288
try:
288289
b = read_socket.recv(chunks)
290+
if len(b) == 0:
291+
# One of the sockets has EOFed, we return to close
292+
# both.
293+
return
289294
write_socket.send(b)
290295
except ssl.SSLEOFError:
291296
# It's possible, depending on shutdown order, that we'll
@@ -335,6 +340,7 @@ def socket_handler(listener):
335340
request = consume_socket(ssock)
336341
validate_request(request)
337342
ssock.send(sample_response())
343+
sock.close()
338344

339345
cls._start_server(socket_handler)
340346

0 commit comments

Comments
 (0)