src/network/access/qhttpnetworkconnection.cpp
changeset 30 5dc02b23752f
parent 25 e24348a560a6
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   341             if (priv->phase != QAuthenticatorPrivate::Done) {
   341             if (priv->phase != QAuthenticatorPrivate::Done) {
   342                 // send any pending requests
   342                 // send any pending requests
   343                 copyCredentials(i,  auth, isProxy);
   343                 copyCredentials(i,  auth, isProxy);
   344                 QMetaObject::invokeMethod(q, "_q_restartAuthPendingRequests", Qt::QueuedConnection);
   344                 QMetaObject::invokeMethod(q, "_q_restartAuthPendingRequests", Qt::QueuedConnection);
   345             }
   345             }
   346         }
   346         } else if (priv->phase == QAuthenticatorPrivate::Start) {
   347         // changing values in QAuthenticator will reset the 'phase'
   347             // If the url's authenticator has a 'user' set we will end up here (phase is only set to 'Done' by
   348         if (priv->phase == QAuthenticatorPrivate::Done) {
   348             // parseHttpResponse above if 'user' is empty). So if credentials were supplied with the request,
       
   349             // such as in the case of an XMLHttpRequest, this is our only opportunity to cache them.
       
   350             emit q->cacheCredentials(reply->request(), auth, q);
       
   351         }
       
   352         // - Changing values in QAuthenticator will reset the 'phase'.
       
   353         // - If withCredentials has been set to false (e.g. by QtWebKit for a cross-origin XMLHttpRequest) then
       
   354         //   we need to bail out if authentication is required.
       
   355         if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
   349             // authentication is cancelled, send the current contents to the user.
   356             // authentication is cancelled, send the current contents to the user.
   350             emit channels[i].reply->headerChanged();
   357             emit channels[i].reply->headerChanged();
   351             emit channels[i].reply->readyRead();
   358             emit channels[i].reply->readyRead();
   352             QNetworkReply::NetworkError errorCode =
   359             QNetworkReply::NetworkError errorCode =
   353                 isProxy
   360                 isProxy