summaryrefslogtreecommitdiff
path: root/src
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 /src
parentdf2480da2c65cf0ddb0427803edbc04516fc237f (diff)
downloadpyopenssl-git-be2bd54f4bf0c8ea50eaf5fd7343652f2bdf9eca.tar.gz
Deprecated NPN (#820)
* Deprecated NPN * arithmetic is hard * oops * oops
Diffstat (limited to 'src')
-rw-r--r--src/OpenSSL/SSL.py9
1 files changed, 9 insertions, 0 deletions
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 *")