Skip to content

Commit dda7525

Browse files
authored
Updated SSL.py to fix problem caused by SSL_WANT_READ or SSL_WANT_WRITE errors.
When SSL_WANT_READ or SSL_WANT_WRITE are encountered, it's typical to retry the call but this must be repeated with the exact same arguments. Without this change, openSSL requires that the address of the buffer passed is the same. However, buffers in python can change location in some circumstances which cause the retry to fail. By add the setting SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER, the requirement for the same buffer address is forgiven and the retry has a better chance of success. See cherrypy/cheroot#245 for discussion.
1 parent b259bfb commit dda7525

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/OpenSSL/SSL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ def __init__(self, method):
850850
self._cookie_generate_helper = None
851851
self._cookie_verify_helper = None
852852

853-
self.set_mode(_lib.SSL_MODE_ENABLE_PARTIAL_WRITE)
853+
self.set_mode(_lib.SSL_MODE_ENABLE_PARTIAL_WRITE | _lib.SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)
854854
if version is not None:
855855
self.set_min_proto_version(version)
856856
self.set_max_proto_version(version)

0 commit comments

Comments
 (0)