Christian Heimes <li...@cheimes.de> added the comment:

The problem is caused by the way how TLS 1.3 works. Select considers a TLS 1.3 
socket as readable after the handshake, because there is still data on the 
line. The server is sending session tickets (usually two) after the handshake 
has been performed. If you set "context.num_tickets = 0" in server.py or 
"context.maximum_version = ssl.TLSVersion.TLSv1_2" in either server.py or 
client.py, your script works. Ticket #37120 has more information on that.

Session tickets are low-level TLS protocol elements. Methods like 
SSLSocket.pending() and SSLSocket.recv() only act on high-level application 
protocol data. That's why pending() returns 0 and recv() is blocking. There is 
no application data available.

You have to take another approach and follow the guidelines in 
https://docs.python.org/3/library/ssl.html#notes-on-non-blocking-sockets . You 
also have to set the SSLSocket into non-blocking mode and handle 
SSLWantWriteError or SSLWantReadError.

----------
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to