Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Lib/test/test_asyncio/test_sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,15 @@ def server(sock):
orig_sock.send(b'please corrupt the SSL connection')
# the client now closes the connection; although its
# TLS shutdown fails on the corrupted record, it must
# still send close_notify, completing our unwrap()
# still send close_notify, on which recv() returns b''.
# Wait for it before sending ours: unwrap() right away
# would send close_notify to a peer that is about to
# close its socket, which turns that close into a TCP
# reset, and on Windows a reset discards the client's
# close_notify that is still unread (gh-158646).
sock.recv(1)
# recv() also returns b'' on a ragged EOF, i.e. without
# close_notify, but then unwrap() fails with an SSLError.
sock.unwrap()
except ssl.SSLError as exc:
server_err = exc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix a race in ``test_asyncio.test_sslproto`` where the server side of
``test_shutdown_corrupted_ssl_sends_close_notify`` could fail with a
connection reset on Windows.
Loading