diff options
author | Cory Benfield <lukasaoz@gmail.com> | 2015-04-13 12:42:54 -0400 |
---|---|---|
committer | Cory Benfield <lukasaoz@gmail.com> | 2015-04-13 16:12:44 -0400 |
commit | f63d6253312f632d17c34ea7dfe06357ca6bc5a9 (patch) | |
tree | 413f8aa8b86134c66b9fa27ca1682e9139ba5920 | |
parent | 4ca37f747d9dcc21d6f85655895e1e997937a670 (diff) | |
download | pyopenssl-f63d6253312f632d17c34ea7dfe06357ca6bc5a9.tar.gz |
Add NPN feature detection.
-rw-r--r-- | OpenSSL/SSL.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index 1215526..c93172c 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -935,6 +935,9 @@ class Context(object): bytestrings representing the advertised protocols, like ``[b'http/1.1', b'spdy/2']``. """ + if not _lib.Cryptography_HAS_NEXTPROTONEG: + raise NotImplementedError("NPN not available.") + self._npn_advertise_helper = _NpnAdvertiseHelper(callback) self._npn_advertise_callback = self._npn_advertise_helper.callback _lib.SSL_CTX_set_next_protos_advertised_cb( @@ -951,6 +954,9 @@ class Context(object): bytestrings, e.g. ``[b'http/1.1', b'spdy/2']``. It should return one of those bytestrings, the chosen protocol. """ + if not _lib.Cryptography_HAS_NEXTPROTONEG: + raise NotImplementedError("NPN not available.") + self._npn_select_helper = _NpnSelectHelper(callback) self._npn_select_callback = self._npn_select_helper.callback _lib.SSL_CTX_set_next_proto_select_cb( @@ -1750,6 +1756,9 @@ class Connection(object): """ Get the protocol that was negotiated by NPN. """ + if not _lib.Cryptography_HAS_NEXTPROTONEG: + raise NotImplementedError("NPN not available.") + data = _ffi.new("unsigned char **") data_len = _ffi.new("unsigned int *") |