Fix incorrect use of QObject::disconnect in synchronous http request
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Wed, 15 Feb 2012 17:58:11 +0000 (17:58 +0000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 17 Feb 2012 14:03:53 +0000 (15:03 +0100)
In certain circumstances, this could cause the request to time out
(and repeatedly send bad authentication credentials to the server)
instead of failing with AuthenticationRequiredError.

Change-Id: Iff66b32f1d7268f21fd77b6620aae4b5d49d857f
Reviewed-by: Richard J. Moore <rich@kde.org>
src/network/access/qhttpthreaddelegate.cpp

index 5cf1533..3901635 100644 (file)
@@ -560,7 +560,8 @@ void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetwo
     }
 
     // Disconnect this connection now since we only want to ask the authentication cache once.
-    QObject::disconnect(this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)));
+    QObject::disconnect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)),
+        this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*)));
 }
 
 #ifndef QT_NO_NETWORKPROXY
@@ -577,7 +578,8 @@ void  QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet
     }
 
     // Disconnect this connection now since we only want to ask the authentication cache once.
-    QObject::disconnect(this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)));
+    QObject::disconnect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+        this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*)));
 }
 
 #endif