Commit 498c4386 authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 79226 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79226 | antoine.pitrou | 2010-03-21 20:33:38 +0100 (dim., 21 mars 2010) | 4 lines

  Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
........
parent 4fd2ff90
...@@ -210,16 +210,9 @@ class SSLSocket(socket): ...@@ -210,16 +210,9 @@ class SSLSocket(socket):
if self._sslobj: if self._sslobj:
if flags != 0: if flags != 0:
raise ValueError( 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__) self.__class__)
while True: return self.read(buflen)
try:
return self.read(buflen)
except SSLError, x:
if x.args[0] == SSL_ERROR_WANT_READ:
continue
else:
raise x
else: else:
return socket.recv(self, buflen, flags) return socket.recv(self, buflen, flags)
...@@ -233,17 +226,10 @@ class SSLSocket(socket): ...@@ -233,17 +226,10 @@ class SSLSocket(socket):
raise ValueError( raise ValueError(
"non-zero flags not allowed in calls to recv_into() on %s" % "non-zero flags not allowed in calls to recv_into() on %s" %
self.__class__) self.__class__)
while True: tmp_buffer = self.read(nbytes)
try: v = len(tmp_buffer)
tmp_buffer = self.read(nbytes) buffer[:v] = tmp_buffer
v = len(tmp_buffer) return v
buffer[:v] = tmp_buffer
return v
except SSLError as x:
if x.args[0] == SSL_ERROR_WANT_READ:
continue
else:
raise x
else: else:
return socket.recv_into(self, buffer, nbytes, flags) return socket.recv_into(self, buffer, nbytes, flags)
......
...@@ -23,6 +23,8 @@ Core and Builtins ...@@ -23,6 +23,8 @@ Core and Builtins
Library Library
------- -------
- Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
- Issue #6544: fix a reference leak in the kqueue implementation's error - Issue #6544: fix a reference leak in the kqueue implementation's error
handling. handling.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment