QNAM: Fix proxy auth handling when requesting but not yet changed to h2

In some cases (i.e. with SOCKS) we don't have a HTTP/2 request ready
yet so it would just error out.

Change-Id: I6449de5fb52f5208d5641062c5906c3baff18b77
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-08-12 12:12:18 +02:00
parent c808bd0b60
commit 5ecc6eb363
2 changed files with 4 additions and 2 deletions

View File

@ -1514,7 +1514,8 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
// dialog is displaying
pauseConnection();
QHttpNetworkReply *reply;
if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
if ((connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
&& (chan->switchedToHttp2 || chan->h2RequestsToSend.count() > 0))
|| connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
// we choose the reply to emit the proxyAuth signal from somewhat arbitrarily,
// but that does not matter because the signal will ultimately be emitted

View File

@ -1133,7 +1133,8 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
#ifndef QT_NO_NETWORKPROXY
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth)
{
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
if ((connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
&& (switchedToHttp2 || h2RequestsToSend.count() > 0))
|| connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
if (h2RequestsToSend.count() > 0)
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);