From 62d85389a4a3ef22db80e721bf7c646a50874452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 18 Aug 2020 12:10:16 +0200 Subject: [PATCH] http: When falling back to http/1 use the socket's ssl config And not the ssl configuration we have on the reply since it's missing e.g. the newly received session ticket. Change-Id: Idfeb09012a847605a76d1fe4fb881c663d019b4a Reviewed-by: Peter Hartmann Reviewed-by: Timur Pocheptsov --- .../access/qhttpnetworkconnectionchannel.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index a4e1ecb869..edbaa7efce 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1209,15 +1209,9 @@ void QHttpNetworkConnectionChannel::_q_encrypted() case QSslConfiguration::NextProtocolNegotiationUnsupported: // No agreement, try HTTP/1(.1) case QSslConfiguration::NextProtocolNegotiationNone: { protocolHandler.reset(new QHttpProtocolHandler(this)); - if (!sslConfiguration.data()) { - // Our own auto-tests bypass the normal initialization (done by - // QHttpThreadDelegate), this means in the past we'd have here - // the default constructed QSslConfiguration without any protocols - // to negotiate. Let's create it now: - sslConfiguration.reset(new QSslConfiguration); - } - QList protocols = sslConfiguration->allowedNextProtocols(); + QSslConfiguration newConfiguration = sslSocket->sslConfiguration(); + QList protocols = newConfiguration.allowedNextProtocols(); const int nProtocols = protocols.size(); // Clear the protocol that we failed to negotiate, so we do not try // it again on other channels that our connection can create/open. @@ -1225,10 +1219,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted() protocols.removeAll(QSslConfiguration::ALPNProtocolHTTP2); if (nProtocols > protocols.size()) { - sslConfiguration->setAllowedNextProtocols(protocols); + newConfiguration.setAllowedNextProtocols(protocols); const int channelCount = connection->d_func()->channelCount; for (int i = 0; i < channelCount; ++i) - connection->d_func()->channels[i].setSslConfiguration(*sslConfiguration); + connection->d_func()->channels[i].setSslConfiguration(newConfiguration); } connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP);