"Support" memoryview and partial writes
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index f7e4a3b..ae8c3b1 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -193,10 +193,11 @@
self._passphrase_userdata = None
self._app_data = None
- # SSL_CTX_set_app_data(self->ctx, self);
- # SSL_CTX_set_mode(self->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE |
- # SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
- # SSL_MODE_AUTO_RETRY);
+ # SSL_CTX_set_app_data(self->ctx, self);
+ # SSL_CTX_set_mode(self->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE |
+ # SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
+ # SSL_MODE_AUTO_RETRY);
+ self.set_mode(_api.SSL_MODE_ENABLE_PARTIAL_WRITE)
def load_verify_locations(self, cafile, capath=None):
@@ -830,6 +831,8 @@
API, the value is ignored
:return: The number of bytes written
"""
+ if isinstance(buf, memoryview):
+ buf = buf.tobytes()
if not isinstance(buf, bytes):
raise TypeError("data must be a byte string")
if not isinstance(flags, int):
@@ -852,6 +855,8 @@
API, the value is ignored
:return: The number of bytes written
"""
+ if isinstance(buf, memoryview):
+ buf = buf.tobytes()
if not isinstance(buf, bytes):
raise TypeError("buf must be a byte string")
if not isinstance(flags, int):