From be2bd54f4bf0c8ea50eaf5fd7343652f2bdf9eca Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 21 Feb 2019 21:41:22 -0500 Subject: Deprecated NPN (#820) * Deprecated NPN * arithmetic is hard * oops * oops --- src/OpenSSL/SSL.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/OpenSSL/SSL.py') 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 *") -- cgit v1.2.1