Merged revisions 79226,79286 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. ........ r79286 | antoine.pitrou | 2010-03-22 15:41:48 +0100 (lun., 22 mars 2010) | 3 lines Fix an occasional test_ftplib failure, following r79226. ........
This commit is contained in:
parent
808fc0a0ee
commit
5733c08f55
14
Lib/ssl.py
14
Lib/ssl.py
|
@ -240,16 +240,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 recv_into() 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 as 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)
|
||||||
|
|
||||||
|
@ -273,6 +266,7 @@ class SSLSocket(socket):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise x
|
raise x
|
||||||
|
return self.read(nbytes, buffer)
|
||||||
else:
|
else:
|
||||||
return socket.recv_into(self, buffer, nbytes, flags)
|
return socket.recv_into(self, buffer, nbytes, flags)
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,9 @@ if ssl is not None:
|
||||||
try:
|
try:
|
||||||
return super(SSLConnection, self).send(data)
|
return super(SSLConnection, self).send(data)
|
||||||
except ssl.SSLError as err:
|
except ssl.SSLError as err:
|
||||||
if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
|
if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN,
|
||||||
|
ssl.SSL_ERROR_WANT_READ,
|
||||||
|
ssl.SSL_ERROR_WANT_WRITE):
|
||||||
return 0
|
return 0
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -304,6 +306,9 @@ if ssl is not None:
|
||||||
try:
|
try:
|
||||||
return super(SSLConnection, self).recv(buffer_size)
|
return super(SSLConnection, self).recv(buffer_size)
|
||||||
except ssl.SSLError as err:
|
except ssl.SSLError as err:
|
||||||
|
if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
|
||||||
|
ssl.SSL_ERROR_WANT_WRITE):
|
||||||
|
return ''
|
||||||
if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
|
if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
return b''
|
return b''
|
||||||
|
|
|
@ -287,6 +287,8 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
|
||||||
|
|
||||||
- Issue #4282: Fix the main function of the profile module for a non-ASCII
|
- Issue #4282: Fix the main function of the profile module for a non-ASCII
|
||||||
script, open the file in binary mode and not in text mode with the default
|
script, open the file in binary mode and not in text mode with the default
|
||||||
(utf8) encoding.
|
(utf8) encoding.
|
||||||
|
|
Loading…
Reference in New Issue