diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-08-18 12:10:16 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-08-24 17:43:36 +0200 |
commit | 62d85389a4a3ef22db80e721bf7c646a50874452 (patch) | |
tree | 18195354acbe1b9f77325061dbf225b914d4b870 /src/network | |
parent | a8ad1451bd478758c96c924476f80e4e95661cb3 (diff) |
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 <peter@edelhirsch.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 14 |
1 files 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<QByteArray> protocols = sslConfiguration->allowedNextProtocols(); + QSslConfiguration newConfiguration = sslSocket->sslConfiguration(); + QList<QByteArray> 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); |