src/network/access/qhttpnetworkconnectionchannel.cpp
changeset 30 5dc02b23752f
parent 25 e24348a560a6
child 33 3e2da88830cd
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -173,7 +173,7 @@
         pendingEncrypt = false;
         // if the url contains authentication parameters, use the new ones
         // both channels will use the new authentication parameters
-        if (!request.url().userInfo().isEmpty()) {
+        if (!request.url().userInfo().isEmpty() && request.withCredentials()) {
             QUrl url = request.url();
             QAuthenticator &auth = authenticator;
             if (url.userName() != auth.user()
@@ -187,7 +187,10 @@
             url.setUserInfo(QString());
             request.setUrl(url);
         }
-        connection->d_func()->createAuthorization(socket, request);
+        // Will only be false if QtWebKit is performing a cross-origin XMLHttpRequest
+        // and withCredentials has not been set to true.
+        if (request.withCredentials())
+            connection->d_func()->createAuthorization(socket, request);
 #ifndef QT_NO_NETWORKPROXY
         QByteArray header = QHttpNetworkRequestPrivate::header(request,
             (connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy));
@@ -285,8 +288,8 @@
         }
 
         // HTTP pipelining
-        connection->d_func()->fillPipeline(socket);
-        socket->flush();
+        //connection->d_func()->fillPipeline(socket);
+        //socket->flush();
 
         // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called
         // this is needed if the sends an reply before we have finished sending the request. In that
@@ -679,7 +682,8 @@
             close();
         QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
     } else if (alreadyPipelinedRequests.isEmpty()) {
-        QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+        if (qobject_cast<QHttpNetworkConnection*>(connection))
+            QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
     }
 }
 
@@ -786,7 +790,8 @@
         }
         break;
     default:
-        QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+        if (qobject_cast<QHttpNetworkConnection*>(connection))
+            QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
     }
 }
 
@@ -834,7 +839,8 @@
     requeueCurrentlyPipelinedRequests();
     close();
     resendCurrent = true;
-    QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+    if (qobject_cast<QHttpNetworkConnection*>(connection))
+        QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
 }
 
 bool QHttpNetworkConnectionChannel::isSocketBusy() const