summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyimpl.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-10 04:18:43 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-10 04:18:43 (GMT)
commit4599758f91319044fa9d135a51653af7b7001aac (patch)
tree4c4696691810e654f7fda06c13333fb1ce424727 /src/network/access/qnetworkreplyimpl.cpp
parent85a7b344571b5bb4b06bdef88a11a4e01f97d6ad (diff)
parentb925a547ebab24a65587bd255b8b0f7586a0fdc1 (diff)
downloadQt-4599758f91319044fa9d135a51653af7b7001aac.zip
Qt-4599758f91319044fa9d135a51653af7b7001aac.tar.gz
Qt-4599758f91319044fa9d135a51653af7b7001aac.tar.bz2
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (101 commits) Fix QTextEdit::selectAll crash from textChanged() Fix proxy reading from gconf so that it is only done once / session. rebuild configure fix misleading uppercasing deprecation warning Enable Phonon on Symbian by default. Disable OpenGL on Symbian only by default instead of always VFP type on ARM option in Linux configure script Adding -dont-process option to Unix configure script Synchronized configure.exe OpenGL options with Unix configure build lrelease as part of the "libs" part. purge vestiges of imageformat-plugins Unify epocroot usage in createpackage and patch_capabilities scripts Update visual tests for the recent qmlviewer change Do not use openGL on Mac OS X for QML visual tests Give qmlviewer a minimum size if root object has no size. Add 'Writing New Components' docs, and document the connect() function. Mention that image providers should be added before loading QML files Update QML visual tests Cleaned up sis_targets.prf Append qml import path individually for each available drive on Symbian ...
Diffstat (limited to 'src/network/access/qnetworkreplyimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 010e904..feb869b 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -91,7 +91,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
}
#ifndef QT_NO_BEARERMANAGEMENT
- if (!backend->start()) {
+ if (!backend->start()) { // ### we should call that method even if bearer is not used
// backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call reply->backend->start() again for us when the session
// state changes.
@@ -115,11 +115,15 @@ void QNetworkReplyImplPrivate::_q_startOperation()
}
#endif
- if (state != Finished) {
- if (operation == QNetworkAccessManager::GetOperation)
- pendingNotifications.append(NotifyDownstreamReadyWrite);
+ if (backend->isSynchronous()) {
+ state = Finished;
+ } else {
+ if (state != Finished) {
+ if (operation == QNetworkAccessManager::GetOperation)
+ pendingNotifications.append(NotifyDownstreamReadyWrite);
- handleNotifications();
+ handleNotifications();
+ }
}
}
@@ -297,7 +301,25 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
url = request.url();
operation = op;
- if (outgoingData && backend) {
+ q->QIODevice::open(QIODevice::ReadOnly);
+ // Internal code that does a HTTP reply for the synchronous Ajax
+ // in QtWebKit.
+ QVariant synchronousHttpAttribute = req.attribute(
+ static_cast<QNetworkRequest::Attribute>(QNetworkRequest::DownloadBufferAttribute + 1));
+ if (synchronousHttpAttribute.toBool()) {
+ backend->setSynchronous(true);
+ if (outgoingData && outgoingData->isSequential()) {
+ outgoingDataBuffer = new QRingBuffer();
+ QByteArray data;
+ do {
+ data = outgoingData->readAll();
+ if (data.isEmpty())
+ break;
+ outgoingDataBuffer->append(data);
+ } while (1);
+ }
+ }
+ if (outgoingData && backend && !backend->isSynchronous()) {
// there is data to be uploaded, e.g. HTTP POST.
if (!backend->needsResetableUploadData() || !outgoingData->isSequential()) {
@@ -308,7 +330,7 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
} else {
bool bufferingDisallowed =
req.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute,
- false).toBool();
+ false).toBool();
if (bufferingDisallowed) {
// if a valid content-length header for the request was supplied, we can disable buffering
@@ -333,17 +355,18 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
// for HTTP, we want to send out the request as fast as possible to the network, without
// invoking methods in a QueuedConnection
#ifndef QT_NO_HTTP
- if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) {
+ if (qobject_cast<QNetworkAccessHttpBackend *>(backend) || (backend && backend->isSynchronous())) {
_q_startOperation();
} else {
QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
}
#else
- QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
+ if (backend->isSynchronous())
+ _q_startOperation();
+ else
+ QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
#endif // QT_NO_HTTP
- }
-
- q->QIODevice::open(QIODevice::ReadOnly);
+ }
}
void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification)