handle ZeroReturnError raised by PyOpenSSL

This commit is contained in:
Yann Leboulanger 2009-07-13 17:47:20 +02:00
parent 2bd1e1410d
commit c4a720aa89
1 changed files with 4 additions and 0 deletions

View File

@ -165,6 +165,10 @@ class PyOpenSSLWrapper(SSLWrapper):
log.debug("Recv: Got OpenSSL.SSL.SysCallError: " + repr(e),
exc_info=True)
raise SSLWrapper.Error(self.sock or self.sslobj, e)
except OpenSSL.SSL.ZeroReturnError, e:
# end-of-connection raises ZeroReturnError instead of having the
# connection's .recv() method return a zero-sized result.
raise SSLWrapper.Error(self.sock or self.sslobj, e, -1)
except OpenSSL.SSL.Error, e:
if self.is_numtoolarge(e):
# warn, but ignore this exception