summaryrefslogtreecommitdiff
path: root/OpenSSL
diff options
context:
space:
mode:
authorJim Shaver <dcypherd@gmail.com>2015-05-28 11:52:32 -0400
committerJim Shaver <dcypherd@gmail.com>2015-05-28 11:52:32 -0400
commit58d257327d3cee9ef8dcd03a3e47973d791ed94b (patch)
tree533931de13e90e295982fae1c82b6d13b1f43ca1 /OpenSSL
parent208438c9a8c9e2aea7d9a266bf6a8012a0939d7c (diff)
downloadpyopenssl-58d257327d3cee9ef8dcd03a3e47973d791ed94b.tar.gz
Switch get_protocol_version_name back to unicode.
Diffstat (limited to 'OpenSSL')
-rw-r--r--OpenSSL/SSL.py7
-rw-r--r--OpenSSL/test/test_ssl.py4
2 files changed, 6 insertions, 5 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index ec03241..4c221d0 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -1888,11 +1888,12 @@ class Connection(object):
Obtain the protocol version of the current connection.
:returns: The TLS version of the current connection, for example
- the value for TLS 1.2 would be ``b'TLSv1.2'``.
- :rtype: :py:class:`bytes`
+ the value for TLS 1.2 would be ``TLSv1.2``or ``Unknown``
+ for connections that were not successfully.
+ :rtype: :py:class:`unicode`
"""
version = _ffi.string(_lib.SSL_get_version(self._ssl))
- return version
+ return version.decode("utf-8")
def get_protocol_version(self):
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py
index 91f115c..e586537 100644
--- a/OpenSSL/test/test_ssl.py
+++ b/OpenSSL/test/test_ssl.py
@@ -2754,8 +2754,8 @@ class ConnectionTests(TestCase, _LoopbackMixin):
client_protocol_version_name = client.get_protocol_version_name()
server_protocol_version_name = server.get_protocol_version_name()
- self.assertIsInstance(server_protocol_version_name, bytes)
- self.assertIsInstance(client_protocol_version_name, bytes)
+ self.assertIsInstance(server_protocol_version_name, text_type)
+ self.assertIsInstance(client_protocol_version_name, text_type)
self.assertEqual(server_protocol_version_name, client_protocol_version_name)