summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-09-04 19:00:10 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-09-04 19:00:10 (GMT)
commit47e40429fbebb7c0751c5cb20d666089b05710c6 (patch)
treeb20eadff0e6aa3f3091e5931955d3e51ffbe0a4a /Lib/ssl.py
parent60a64d6812e5d3c3bf4291081e3db9dc6acf996c (diff)
downloadcpython-47e40429fbebb7c0751c5cb20d666089b05710c6.zip
cpython-47e40429fbebb7c0751c5cb20d666089b05710c6.tar.gz
cpython-47e40429fbebb7c0751c5cb20d666089b05710c6.tar.bz2
Issue #20421: Add a .version() method to SSL sockets exposing the actual protocol version in use.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index efea02a..f0ecbc7 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -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,