summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@nokia.com>2011-07-08 11:17:37 (GMT)
committerJerome Pasion <jerome.pasion@nokia.com>2011-07-08 11:17:37 (GMT)
commitf037c0e87d186a01f07cb9aa360dcc496d11145e (patch)
tree9449cc65b856b4743e933cf2b8ae1cb2f85ba9fd /src/network
parent5016de08d84c4d2887f7424dbf17f31e27c2e8e2 (diff)
parent1dd26ea2486db87b61e8e9f70a1e04f7386405ef (diff)
downloadQt-f037c0e87d186a01f07cb9aa360dcc496d11145e.zip
Qt-f037c0e87d186a01f07cb9aa360dcc496d11145e.tar.gz
Qt-f037c0e87d186a01f07cb9aa360dcc496d11145e.tar.bz2
Merge remote branch 'upstream/4.8'
Conflicts: doc/src/external-resources.qdoc
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;