summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-07-06 16:05:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-07-06 16:05:48 (GMT)
commit8bc5a6319455d7dc0655a8c48862ada8890b0064 (patch)
tree2f43d23e5a30e9f2c18698038291c74254db480a /src/network
parent013fb92b20db4fc3dc6a7a7d4cd0a3a0c941472f (diff)
parent156893a247f1c24094129b6f5151c8b821d8b1b5 (diff)
downloadQt-8bc5a6319455d7dc0655a8c48862ada8890b0064.zip
Qt-8bc5a6319455d7dc0655a8c48862ada8890b0064.tar.gz
Qt-8bc5a6319455d7dc0655a8c48862ada8890b0064.tar.bz2
Merge branch 4.7 into qt-4.8-from-4.7
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkreply.cpp12
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 7c644ad..9b2a6e8 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -649,8 +649,11 @@ bool QHttpNetworkConnectionChannel::expand(bool dataComplete)
int ret = Z_OK;
if (content.size())
ret = reply->d_func()->gunzipBodyPartially(content, inflated);
- int retCheck = (dataComplete) ? Z_STREAM_END : Z_OK;
- if (ret >= retCheck) {
+ if (ret >= Z_OK) {
+ if (dataComplete && ret == Z_OK && !reply->d_func()->streamEnd) {
+ reply->d_func()->gunzipBodyPartiallyEnd();
+ reply->d_func()->streamEnd = true;
+ }
if (inflated.size()) {
reply->d_func()->totalProgress += inflated.size();
reply->d_func()->appendUncompressedReplyData(inflated);
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 00653b6..1a02200 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -461,15 +461,21 @@ int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteA
}
have = sizeof(out) - inflateStrm.avail_out;
inflated.append(QByteArray((const char *)out, have));
- } while (inflateStrm.avail_out == 0);
+ } while (inflateStrm.avail_out == 0 && inflateStrm.avail_in > 0);
// clean up and return
if (ret <= Z_ERRNO || ret == Z_STREAM_END) {
- inflateEnd(&inflateStrm);
- initInflate = false;
+ gunzipBodyPartiallyEnd();
}
streamEnd = (ret == Z_STREAM_END);
return ret;
}
+
+void QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd()
+{
+ inflateEnd(&inflateStrm);
+ initInflate = false;
+}
+
#endif
qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 583a256..de6c0d2 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -207,6 +207,7 @@ public:
#ifndef QT_NO_COMPRESS
bool gzipCheckHeader(QByteArray &content, int &pos);
int gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated);
+ void gunzipBodyPartiallyEnd();
#endif
void removeAutoDecompressHeader();
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 8e301a1..58eb0d8 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -1030,7 +1030,7 @@ bool QNetworkReplyImplPrivate::migrateBackend()
return true;
// Backend does not support resuming download.
- if (!backend->canResume())
+ if (backend && !backend->canResume())
return false;
state = QNetworkReplyImplPrivate::Reconnecting;