diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-03-21 19:33:38 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-03-21 19:33:38 (GMT) |
commit | 448da71807603770a8033e51b65f6f212fb3e2e4 (patch) | |
tree | e47ba54a15fa32a939c4648ef270c47a290acf68 /Lib | |
parent | 56472c2463ce12830a580af3159cba3437666677 (diff) | |
download | cpython-448da71807603770a8033e51b65f6f212fb3e2e4.zip cpython-448da71807603770a8033e51b65f6f212fb3e2e4.tar.gz cpython-448da71807603770a8033e51b65f6f212fb3e2e4.tar.bz2 |
Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ssl.py | 26 |
1 files changed, 6 insertions, 20 deletions
@@ -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) |