Issue #20421: Add a .version() method to SSL sockets exposing the actual protocol version in use.

This commit is contained in:
Antoine Pitrou 2014-09-04 21:00:10 +02:00
parent 60a64d6812
commit 47e40429fb
5 changed files with 86 additions and 24 deletions

View file

@ -861,6 +861,15 @@ class SSLSocket(socket):
return None
return self._sslobj.tls_unique_cb()
def version(self):
"""
Return a string identifying the protocol version used by the
current SSL channel, or None if there is no established channel.
"""
if self._sslobj is None:
return None
return self._sslobj.version()
def wrap_socket(sock, keyfile=None, certfile=None,
server_side=False, cert_reqs=CERT_NONE,