Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix line lengths as well 🙃
  • Loading branch information
mhils committed Feb 17, 2021
commit 2b1b645e141a43095a37672e43d0504eaa958b22
6 changes: 4 additions & 2 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,8 @@ def set_alpn_protos(self, protos):
input_str = _ffi.new("unsigned char[]", protostr)

# https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_set_alpn_protos.html:
# SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success, and non-0 on failure.
# SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos()
# return 0 on success, and non-0 on failure.
# WARNING: these functions reverse the return value convention.
_openssl_assert(
_lib.SSL_CTX_set_alpn_protos(
Expand Down Expand Up @@ -2404,7 +2405,8 @@ def set_alpn_protos(self, protos):
input_str = _ffi.new("unsigned char[]", protostr)

# https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_set_alpn_protos.html:
# SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success, and non-0 on failure.
# SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos()
# return 0 on success, and non-0 on failure.
# WARNING: these functions reverse the return value convention.
_openssl_assert(
_lib.SSL_set_alpn_protos(self._ssl, input_str, len(protostr)) == 0
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1890,8 +1890,8 @@ def select(conn, options):

def test_alpn_call_failure(self):
"""
SSL_CTX_set_alpn_protos does not like to be called with an empty protocols list.
Ensure that we produce a user-visible error.
SSL_CTX_set_alpn_protos does not like to be called with an empty
protocols list. Ensure that we produce a user-visible error.
"""
context = Context(SSLv23_METHOD)
with pytest.raises(Error):
Expand Down