diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index 543e87c0ca4..b24fdad1f98 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -470,12 +470,11 @@ SSL* QSslContext::createSsl() q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext); // Client: q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len); - } else { -#else - { -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... - q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); } +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... + + // And in case our peer does not support ALPN, but supports NPN: + q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 48f8e258dfa..5c0c8674cd2 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1564,7 +1564,9 @@ void QSslSocketBackendPrivate::continueHandshake() // Client does not have a callback that sets it ... configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; } - } else { + } + + if (!proto_len) { // Test if NPN was more lucky ... #else { #endif