summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2023-03-22 12:16:26 (GMT)
committerGitHub <noreply@github.com>2023-03-22 12:16:26 (GMT)
commit420bbb783b43216cc897dc8914851899db37a31d (patch)
tree32042565aa052c629a0c5564b2820c320a923306 /Lib/webbrowser.py
parent7b2d53daccf5a6479e179535068fd9a841db44fc (diff)
downloadcpython-420bbb783b43216cc897dc8914851899db37a31d.zip
cpython-420bbb783b43216cc897dc8914851899db37a31d.tar.gz
cpython-420bbb783b43216cc897dc8914851899db37a31d.tar.bz2
GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495)
GH-25309 enabled SSL_OP_IGNORE_UNEXPECTED_EOF by default, with a comment that it restores OpenSSL 1.1.1 behavior, but this wasn't quite right. That option causes OpenSSL to treat transport EOF as the same as close_notify (i.e. SSL_ERROR_ZERO_RETURN), whereas Python actually has distinct SSLEOFError and SSLZeroReturnError exceptions. (The latter is usually mapped to a zero return from read.) In OpenSSL 1.1.1, the ssl module would raise them for transport EOF and close_notify, respectively. In OpenSSL 3.0, both act like close_notify. Fix this by, instead, just detecting SSL_R_UNEXPECTED_EOF_WHILE_READING and mapping that to the other exception type. There doesn't seem to have been any unit test of this error, so fill in the missing one. This had to be done with the BIO path because it's actually slightly tricky to simulate a transport EOF with Python's fd based APIs. (If you instruct the server to close the socket, it gets confused, probably because the server's SSL object is still referencing the now dead fd?)
Diffstat (limited to 'Lib/webbrowser.py')
0 files changed, 0 insertions, 0 deletions