Give the same treatment to the Connection.sendall method, allowing memoryview to be passed to it.
diff --git a/OpenSSL/ssl/connection.c b/OpenSSL/ssl/connection.c
index ccefcc8..f2881d3 100755
--- a/OpenSSL/ssl/connection.c
+++ b/OpenSSL/ssl/connection.c
@@ -392,8 +392,18 @@
     int len, ret, err, flags;
     PyObject *pyret = Py_None;
 
+#if PY_VERSION_HEX >= 0x02060000
+    Py_buffer pbuf;
+
+    if (!PyArg_ParseTuple(args, "s*|i:sendall", &pbuf, &flags))
+        return NULL;
+
+    buf = pbuf.buf;
+    len = pbuf.len;
+#else
     if (!PyArg_ParseTuple(args, "s#|i:sendall", &buf, &len, &flags))
         return NULL;
+#endif
 
     do {
         MY_BEGIN_ALLOW_THREADS(self->tstate)
@@ -417,9 +427,13 @@
             handle_ssl_errors(self->ssl, err, ret);
             pyret = NULL;
             break;
-        }    
+        }
     } while (len > 0);
 
+#if PY_VERSION_HEX >= 0x02060000
+    PyBuffer_Release(&pbuf);
+#endif
+
     Py_XINCREF(pyret);
     return pyret;
 }
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py
index 58aa497..bd5a92b 100644
--- a/OpenSSL/test/test_ssl.py
+++ b/OpenSSL/test/test_ssl.py
@@ -1116,6 +1116,7 @@
             self.assertEquals(client.recv(2), b('xy'))
 
 
+
 class ConnectionSendallTests(TestCase, _LoopbackMixin):
     """
     Tests for L{Connection.sendall}.
@@ -1141,6 +1142,21 @@
         self.assertEquals(client.recv(1), b('x'))
 
 
+    try:
+        memoryview
+    except NameError:
+        "cannot test sending memoryview without memoryview"
+    else:
+        def test_short_memoryview(self):
+            """
+            When passed a memoryview onto a small number of bytes,
+            L{Connection.sendall} transmits all of them.
+            """
+            server, client = self._loopback()
+            server.sendall(memoryview(b('x')))
+            self.assertEquals(client.recv(1), b('x'))
+
+
     def test_long(self):
         """
         L{Connection.sendall} transmits all of the bytes in the string passed to