From 47e40429fbebb7c0751c5cb20d666089b05710c6 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 4 Sep 2014 21:00:10 +0200 Subject: Issue #20421: Add a .version() method to SSL sockets exposing the actual protocol version in use. --- Lib/ssl.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib/ssl.py') diff --git a/Lib/ssl.py b/Lib/ssl.py index efea02a252e..f0ecbc7e7f5 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, -- cgit v1.2.3