src/network/access/qnetworkreplyimpl.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 14 c0432d11811c
child 23 89e065397ea6
--- a/src/network/access/qnetworkreplyimpl.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/network/access/qnetworkreplyimpl.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -72,6 +72,9 @@
     }
     state = Working;
 
+    // note: if that method is called directly, it cannot happen that the backend is 0,
+    // because we just checked via a qobject_cast that we got a http backend (see
+    // QNetworkReplyImplPrivate::setup())
     if (!backend) {
         error(QNetworkReplyImpl::ProtocolUnknownError,
               QCoreApplication::translate("QNetworkReply", "Protocol \"%1\" is unknown").arg(url.scheme())); // not really true!;
@@ -203,7 +206,6 @@
     }
 }
 
-
 void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req,
                                      QIODevice *data)
 {
@@ -246,7 +248,14 @@
         // No outgoing data (e.g. HTTP GET request)
         // or no backend
         // if no backend, _q_startOperation will handle the error of this
-        QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
+
+        // for HTTP, we want to send out the request as fast as possible to the network, without
+        // invoking methods in a QueuedConnection
+        if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) {
+            _q_startOperation();
+        } else {
+            QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
+        }
     }
 
     q->QIODevice::open(QIODevice::ReadOnly);
@@ -643,6 +652,9 @@
         d->backendNotify(QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite);
 
     QNetworkReply::setReadBufferSize(size);
+
+    if (d->backend)
+        d->backend->setDownstreamLimited(d->readBufferMaxSize > 0);
 }
 
 #ifndef QT_NO_OPENSSL