Kaydet (Commit) 52093b8e authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Fix an occasional test_ftplib failure, following r79226.

üst 6557aac5
...@@ -293,7 +293,9 @@ if ssl is not None: ...@@ -293,7 +293,9 @@ if ssl is not None:
try: try:
return super(SSLConnection, self).send(data) return super(SSLConnection, self).send(data)
except ssl.SSLError, err: except ssl.SSLError, 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
...@@ -301,6 +303,9 @@ if ssl is not None: ...@@ -301,6 +303,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, err: except ssl.SSLError, 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 '' return ''
......
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