From 5ecc6eb36365e5382ac18b268a885fc17a3abf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 12 Aug 2020 12:12:18 +0200 Subject: [PATCH] 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 --- src/network/access/qhttpnetworkconnection.cpp | 3 ++- src/network/access/qhttpnetworkconnectionchannel.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 8c108689a5..3a5ce9c6c9 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -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 diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index b85d718f5f..0c59c20255 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -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);