diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-03-22 10:18:16 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-03-22 10:18:16 (GMT) |
commit | 88ebb57019913958771416261206d9daa77fc4aa (patch) | |
tree | 44950a191d27dd51881088737cf19154a774f8bb /src/network | |
parent | 84a342eea111f0a1da8fd0c417362aae2b851e56 (diff) | |
parent | 9e85af3454bd0a2d962523d52e688f9bc7259528 (diff) | |
download | Qt-88ebb57019913958771416261206d9daa77fc4aa.zip Qt-88ebb57019913958771416261206d9daa77fc4aa.tar.gz Qt-88ebb57019913958771416261206d9daa77fc4aa.tar.bz2 |
Merge remote-tracking branch 'mainline/master'
Conflicts:
src/gui/image/qpnghandler.cpp
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 7 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 5 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 7 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 62c6fab..6564b4b 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -91,8 +91,10 @@ void QHttpNetworkConnectionChannel::init() #else socket = new QTcpSocket; #endif +#ifndef QT_NO_NETWORKPROXY // Set by QNAM anyway, but let's be safe here socket->setProxy(QNetworkProxy::NoProxy); +#endif QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), @@ -586,13 +588,15 @@ bool QHttpNetworkConnectionChannel::ensureConnection() #endif } else { // In case of no proxy we can use the Unbuffered QTcpSocket +#ifndef QT_NO_NETWORKPROXY if (connection->d_func()->networkProxy.type() == QNetworkProxy::NoProxy && connection->cacheProxy().type() == QNetworkProxy::NoProxy && connection->transparentProxy().type() == QNetworkProxy::NoProxy) { +#endif socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite | QIODevice::Unbuffered); // For an Unbuffered QTcpSocket, the read buffer size has a special meaning. socket->setReadBufferSize(1*1024); - +#ifndef QT_NO_NETWORKPROXY } else { socket->connectToHost(connectHost, connectPort); @@ -601,6 +605,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection() // here and there. socket->setReadBufferSize(64*1024); } +#endif } return false; } diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 4908e0a..a031cd0 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -233,6 +233,11 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest, return; } + // The disk cache API does not currently support partial content retrieval. + // That is why we don't use the disk cache for any such requests. + if (request().hasRawHeader("Range")) + return; + QAbstractNetworkCache *nc = networkCache(); if (!nc) return; // no local cache diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 485f449..1c9fa3e 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -514,6 +514,13 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() { Q_Q(QNetworkReplyImpl); + // The disk cache does not support partial content, so don't even try to + // save any such content into the cache. + if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) { + cacheEnabled = false; + return; + } + // save the meta data QNetworkCacheMetaData metaData; metaData.setUrl(url); |