Wierd M2Crypto bug - phony "peer did not return certificate" error

John Nagle nagle at animats.com
Fri Jan 12 23:23:33 EST 2007


Heikki Toivonen wrote:
> John Nagle wrote:
> 
>>def connect(self, addr):
>>    self.socket.connect(addr)
>>    self.addr = addr
>>    self.socket.settimeout(None) # Back to normal timeout (NEW)
> 
> 
> I am not sure if this is always appropriate. In fact, doesn't this just
> eliminate the timeout completely from this connection?
> 
> In your case you could achieve what you want by calling
> connection_object.socket.settimeout(4.0) method just before calling
> connect, without needing to edit M2Crypto itself.

    No, this actually works right.  It seems that the default timeout
controls the timeout on TCP connect, but puts the socket into
non-blocking mode.  So, if as soon as a TCP connection is
opened, but before the SSL handshake starts, the socket timeout
is set to None, then the socket returns to blocking mode before
its first read.

    At least on Windows.  More later on how this works on Linux.

				John Nagle



More information about the Python-list mailing list