Skip to content

Commit

Permalink
Switch get_protocol_version_name back to unicode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ihamburglar committed May 28, 2015
1 parent 208438c commit 58d2573
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1888,11 +1888,12 @@ def get_protocol_version_name(self):
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):
Expand Down
4 changes: 2 additions & 2 deletions OpenSSL/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2754,8 +2754,8 @@ def test_get_protocol_version_name(self):
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)

Expand Down
5 changes: 2 additions & 3 deletions doc/api/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,8 @@ Connection objects have the following methods:
.. py:method:: Connection.get_protocol_version_name()
Retrieve the version of the SSL or TLS protocol used by the Connection.
For example, it will return ``TLSv1`` in bytes for connections made over
TLS version 1, or ``Unknown`` for connections that were not successfully
established.
For example, it will return ``TLSv1`` for connections made over TLS version
1, or ``Unknown`` for connections that were not successfully established.


.. py:method:: Connection.get_client_ca_list()
Expand Down

0 comments on commit 58d2573

Please sign in to comment.