diff options
author | yevgeny hong <hongyevgeny@gmail.com> | 2024-03-26 07:45:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 07:45:43 (GMT) |
commit | ea9a296fce2f786b4cf43c7924e5de01061f27ca (patch) | |
tree | 0bf5ebcaa4d4ebffc7b56d5c653b53900befc612 /Misc | |
parent | d52bdfb19fadd7614a0e5abaf68525fc7300e841 (diff) | |
download | cpython-ea9a296fce2f786b4cf43c7924e5de01061f27ca.zip cpython-ea9a296fce2f786b4cf43c7924e5de01061f27ca.tar.gz cpython-ea9a296fce2f786b4cf43c7924e5de01061f27ca.tar.bz2 |
gh-115627: Fix PySSL_SetError handling SSL_ERROR_SYSCALL (GH-115628)
Python 3.10 changed from using SSL_write() and SSL_read() to SSL_write_ex() and
SSL_read_ex(), but did not update handling of the return value.
Change error handling so that the return value is not examined.
OSError (not EOF) is now returned when retval is 0.
According to *recent* man pages of all functions for which we call
PySSL_SetError, (in OpenSSL 3.0 and 1.1.1), their return value should
be used to determine whether an error happened (i.e. if PySSL_SetError
should be called), but not what kind of error happened (so,
PySSL_SetError shouldn't need retval). To get the error,
we need to use SSL_get_error.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2024-02-18-09-50-31.gh-issue-115627.HGchj0.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-02-18-09-50-31.gh-issue-115627.HGchj0.rst b/Misc/NEWS.d/next/Library/2024-02-18-09-50-31.gh-issue-115627.HGchj0.rst new file mode 100644 index 0000000..75d926a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-02-18-09-50-31.gh-issue-115627.HGchj0.rst @@ -0,0 +1,2 @@ +Fix the :mod:`ssl` module error handling of connection terminate by peer. +It now throws an OSError with the appropriate error code instead of an EOFError. |