src/network/access/qhttpnetworkconnection.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   284 
   284 
   285     Q_Q(QHttpNetworkConnection);
   285     Q_Q(QHttpNetworkConnection);
   286 
   286 
   287     resend = false;
   287     resend = false;
   288     //create the response header to be used with QAuthenticatorPrivate.
   288     //create the response header to be used with QAuthenticatorPrivate.
   289     QHttpResponseHeader responseHeader;
       
   290     QList<QPair<QByteArray, QByteArray> > fields = reply->header();
   289     QList<QPair<QByteArray, QByteArray> > fields = reply->header();
   291     QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin();
   290 
   292     while (it != fields.constEnd()) {
       
   293         responseHeader.addValue(QString::fromLatin1(it->first), QString::fromUtf8(it->second));
       
   294         it++;
       
   295     }
       
   296     //find out the type of authentication protocol requested.
   291     //find out the type of authentication protocol requested.
   297     QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy);
   292     QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy);
   298     if (authMethod != QAuthenticatorPrivate::None) {
   293     if (authMethod != QAuthenticatorPrivate::None) {
   299         int i = indexOf(socket);
   294         int i = indexOf(socket);
   300         //Use a single authenticator for all domains. ### change later to use domain/realm
   295         //Use a single authenticator for all domains. ### change later to use domain/realm
   308         }
   303         }
   309         //proceed with the authentication.
   304         //proceed with the authentication.
   310         if (auth->isNull())
   305         if (auth->isNull())
   311             auth->detach();
   306             auth->detach();
   312         QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
   307         QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
   313         priv->parseHttpResponse(responseHeader, isProxy);
   308         priv->parseHttpResponse(fields, isProxy);
   314 
   309 
   315         if (priv->phase == QAuthenticatorPrivate::Done) {
   310         if (priv->phase == QAuthenticatorPrivate::Done) {
   316             if ((isProxy && pendingProxyAuthSignal) ||(!isProxy && pendingAuthSignal)) {
   311             if ((isProxy && pendingProxyAuthSignal) ||(!isProxy && pendingAuthSignal)) {
   317                 // drop the request
   312                 // drop the request
   318                 reply->d_func()->eraseData();
   313                 reply->d_func()->eraseData();