summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkreply.cpp10
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
3 files changed, 14 insertions, 4 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 63f923f..7c2e2a1 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -599,8 +599,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 516841a..01360d5 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -434,12 +434,18 @@ int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteA
} while (inflateStrm.avail_out == 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 05feaa9..365308f 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -200,6 +200,7 @@ public:
#ifndef QT_NO_COMPRESS
bool gzipCheckHeader(QByteArray &content, int &pos);
int gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated);
+ void gunzipBodyPartiallyEnd();
#endif
void removeAutoDecompressHeader();