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>
bb10
Mårten Nordheim 2020-08-18 12:10:16 +02:00
parent a8ad1451bd
commit 62d85389a4
1 changed files with 4 additions and 10 deletions

View File

@ -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);