summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2019-02-21 21:41:22 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2019-02-22 10:41:22 +0800
commitbe2bd54f4bf0c8ea50eaf5fd7343652f2bdf9eca (patch)
tree22b05157fc7b3620e8ec79f7612ce31fb7b9c99d
parentdf2480da2c65cf0ddb0427803edbc04516fc237f (diff)
downloadpyopenssl-git-be2bd54f4bf0c8ea50eaf5fd7343652f2bdf9eca.tar.gz
Deprecated NPN (#820)
* Deprecated NPN * arithmetic is hard * oops * oops
-rw-r--r--CHANGELOG.rst4
-rw-r--r--src/OpenSSL/SSL.py9
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index ee8dda4..2b6d732 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -18,7 +18,9 @@ Backward-incompatible changes:
Deprecations:
^^^^^^^^^^^^^
-*none*
+- Deprecated ``OpenSSL.SSL.Context.set_npn_advertise_callback``, ``OpenSSL.SSL.Context.set_npn_select_callback``, and ``OpenSSL.SSL.Connection.get_next_proto_negotiated``.
+ ALPN should be used instead.
+ `#820 <https://github.com/pyca/pyopenssl/pull/820>`_
Changes:
diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index de49cf9..232f81d 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -1,5 +1,6 @@
import os
import socket
+import warnings
from sys import platform
from functools import wraps, partial
from itertools import count, chain
@@ -626,6 +627,11 @@ def SSLeay_version(type):
return _ffi.string(_lib.SSLeay_version(type))
+def _warn_npn():
+ warnings.warn("NPN is deprecated. Protocols should switch to using ALPN.",
+ DeprecationWarning, stacklevel=3)
+
+
def _make_requires(flag, error):
"""
Builds a decorator that ensures that functions that rely on OpenSSL
@@ -1415,6 +1421,7 @@ class Context(object):
.. versionadded:: 0.15
"""
+ _warn_npn()
self._npn_advertise_helper = _NpnAdvertiseHelper(callback)
self._npn_advertise_callback = self._npn_advertise_helper.callback
_lib.SSL_CTX_set_next_protos_advertised_cb(
@@ -1433,6 +1440,7 @@ class Context(object):
.. versionadded:: 0.15
"""
+ _warn_npn()
self._npn_select_helper = _NpnSelectHelper(callback)
self._npn_select_callback = self._npn_select_helper.callback
_lib.SSL_CTX_set_next_proto_select_cb(
@@ -2437,6 +2445,7 @@ class Connection(object):
.. versionadded:: 0.15
"""
+ _warn_npn()
data = _ffi.new("unsigned char **")
data_len = _ffi.new("unsigned int *")