[3.6] bpo-30622: Change NPN detection: (GH-2079) by tiran · Pull Request #3314 · python/cpython (original) (raw)

Version breakdown, support disabled (pre-patch/post-patch):

Version breakdown support enabled (pre-patch/post-patch):

This created a working ssl module for me, with NPN disabled and ALPN
enabled for OpenSSL 1.1.0f.

Concerns to address:
The initial commit for NPN support into OpenSSL [1], had the
OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG
guard. The question is if that ever made it into a release.
This would need an ugly hack, something like:

GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \
    !defined(OPENSSL_NPN_NEGOTIATED)
GH-	define OPENSSL_NPN_UNSUPPORTED 0
GH-	define OPENSSL_NPN_NEGOTIATED 1
GH-	define OPENSSL_NPN_NO_OVERLAP 2
GH-endif

[1] openssl/openssl@68b33cc5c7
(cherry picked from commit b2d096b)

https://bugs.python.org/issue30622