Skip to content

Commit

Permalink
[1.26] Properly proxy EOF on the SSLTransport test suite
Browse files Browse the repository at this point in the history
Previously the proxy was continuously ignoring EOF signals and keeping
the socket open.

Signed-off-by: Jorge Lopez Silva <[email protected]>
  • Loading branch information
jalopezsilva authored and sethmlarson committed May 19, 2021
1 parent a891304 commit 1884878
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/test_ssltransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ def proxy_handler(listener):
)
self._read_write_loop(client_sock, upstream_sock)
upstream_sock.close()
client_sock.close()

self._start_server(proxy_handler)

Expand Down Expand Up @@ -286,6 +287,10 @@ def _read_write_loop(self, client_sock, server_sock, chunks=65536):
if write_socket in writable:
try:
b = read_socket.recv(chunks)
if len(b) == 0:
# One of the sockets has EOFed, we return to close
# both.
return
write_socket.send(b)
except ssl.SSLEOFError:
# It's possible, depending on shutdown order, that we'll
Expand Down Expand Up @@ -335,6 +340,7 @@ def socket_handler(listener):
request = consume_socket(ssock)
validate_request(request)
ssock.send(sample_response())
sock.close()

cls._start_server(socket_handler)

Expand Down

0 comments on commit 1884878

Please sign in to comment.