]> granicus.if.org Git - python/commitdiff
Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 21 Mar 2010 19:33:38 +0000 (19:33 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 21 Mar 2010 19:33:38 +0000 (19:33 +0000)
Lib/ssl.py
Misc/NEWS

index 0cb79f33ba4cd14030158fa3cb43a168cd8cf2f7..21664b94cd30c15c967ee89a41f25ac87202a80c 100644 (file)
@@ -210,16 +210,9 @@ class SSLSocket(socket):
         if self._sslobj:
             if flags != 0:
                 raise ValueError(
-                    "non-zero flags not allowed in calls to sendall() on %s" %
+                    "non-zero flags not allowed in calls to recv() on %s" %
                     self.__class__)
-            while True:
-                try:
-                    return self.read(buflen)
-                except SSLError, x:
-                    if x.args[0] == SSL_ERROR_WANT_READ:
-                        continue
-                    else:
-                        raise x
+            return self.read(buflen)
         else:
             return socket.recv(self, buflen, flags)
 
@@ -233,17 +226,10 @@ class SSLSocket(socket):
                 raise ValueError(
                   "non-zero flags not allowed in calls to recv_into() on %s" %
                   self.__class__)
-            while True:
-                try:
-                    tmp_buffer = self.read(nbytes)
-                    v = len(tmp_buffer)
-                    buffer[:v] = tmp_buffer
-                    return v
-                except SSLError as x:
-                    if x.args[0] == SSL_ERROR_WANT_READ:
-                        continue
-                    else:
-                        raise x
+            tmp_buffer = self.read(nbytes)
+            v = len(tmp_buffer)
+            buffer[:v] = tmp_buffer
+            return v
         else:
             return socket.recv_into(self, buffer, nbytes, flags)
 
index 48fe18d272db4c4bdffd2635488109c5be120614..895c7538420bd9576cc5da9388e92126e49be003 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
+
 - Issue #8179: Fix macpath.realpath() on a non-existing path.
 
 - Issue #8024: Update the Unicode database to 5.2.