Skip to content

Commit

Permalink
Fixing the truth in Changelog SSL.py and test_ssl.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ihamburglar committed May 28, 2015
1 parent a923e93 commit 208438c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
@@ -1,8 +1,8 @@
2015-05-27 Jim Shaver <dcypherd@gmail.com>

* OpenSSL/SSL.py, : Add ``get_protocol_version()`` and
``get_protocol_version_name()`` to Connection
Based on work from Rich Moore
``get_protocol_version_name()`` to ``Connection``.
Based on work from Rich Moore.

2015-05-02 Jim Shaver <dcypherd@gmail.com>

Expand Down
25 changes: 13 additions & 12 deletions OpenSSL/SSL.py
Expand Up @@ -1889,12 +1889,24 @@ def get_protocol_version_name(self):
:returns: The TLS version of the current connection, for example
the value for TLS 1.2 would be ``b'TLSv1.2'``.
:rtype: :py:class:`unicode`
:rtype: :py:class:`bytes`
"""
version = _ffi.string(_lib.SSL_get_version(self._ssl))
return version


def get_protocol_version(self):
"""
Obtain the protocol version of the current connection.
:returns: The TLS version of the current connection, for example
the value for TLS 1 would be 0x769.
:rtype: :py:class:`int`
"""
version = _lib.SSL_version(self._ssl)
return version


@_requires_npn
def get_next_proto_negotiated(self):
"""
Expand Down Expand Up @@ -1950,17 +1962,6 @@ def get_alpn_proto_negotiated(self):
return _ffi.buffer(data[0], data_len[0])[:]


def get_protocol_version(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 0x303.
:rtype: :py:class:`int`
"""
version = _lib.SSL_version(self._ssl)
return version


ConnectionType = Connection

Expand Down
1 change: 1 addition & 0 deletions OpenSSL/test/test_ssl.py
Expand Up @@ -2775,6 +2775,7 @@ def test_get_protocol_version(self):
self.assertEqual(server_protocol_version, client_protocol_version)



class ConnectionGetCipherListTests(TestCase):
"""
Tests for :py:obj:`Connection.get_cipher_list`.
Expand Down
5 changes: 2 additions & 3 deletions doc/api/ssl.rst
Expand Up @@ -601,9 +601,8 @@ Connection objects have the following methods:
.. py:method:: Connection.get_protocol_version()
Retrieve the version of the SSL or TLS protocol used by the Connection.
For example, it will return ``0x303`` for connections made over TLS
version 1.2, or ``Unknown`` for connections that were not successfully
established.
For example, it will return ``0x769`` for connections made over TLS
version 1.


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

0 comments on commit 208438c

Please sign in to comment.