[issue13721] ssl.wrap_socket on a connected but failed connection succeeds and .peer_certificate gives AttributeError

Mads Kiilerich report at bugs.python.org
Sun Jan 8 19:19:32 CET 2012


Mads Kiilerich <mads at kiilerich.com> added the comment:

> I'm a bit wary of API bloat here.

Yes, but explicit is better than magic ...

> Thanks. So fixing how getpeercert behaves and either raise a dedicated
> error or return None would improve things here, right?

Well ... that would at least make it theoretically possible to claim 
that it works as intended ;-)

A counter argument could be that retrieving the certificate that already 
has been used for negotiation isn't a socket operation. It would make 
sense to be able to look at it even after the socket has been closed. 
 From that point of view _sslobj should be kept "forever".

A return value of None would still not indicate if we had a working 
connection without certificate or a failed connection. That would be 
annoying.

My primary concern with my Mercurial hat on is to get the documentation 
updated so we know how to write code that works correctly also with 
previous Python versions.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13721>
_______________________________________


More information about the Python-bugs-list mailing list