diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-04 20:33:22 (GMT) |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-04 20:33:22 (GMT) |
commit | e98205d7984a5b7f884679f7f7a83c3ddd69c167 (patch) | |
tree | 2fcfdbbff027bc2b8f4e3de1cb6bb8e59f73b3dd /Lib/ssl.py | |
parent | ceb0e1d751c927ec0a835cae12f54b4bd339b14c (diff) | |
download | cpython-e98205d7984a5b7f884679f7f7a83c3ddd69c167.zip cpython-e98205d7984a5b7f884679f7f7a83c3ddd69c167.tar.gz cpython-e98205d7984a5b7f884679f7f7a83c3ddd69c167.tar.bz2 |
Issue #20421: Add a .version() method to SSL sockets exposing the actual protocol version in use.
Backport from default.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -862,6 +862,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, |