summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2011-03-22 13:54:33 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2011-05-04 09:19:09 (GMT)
commit1db1c895259fba1813a2d970d2334a6b35ba4f5d (patch)
tree739bdd33bcdc75d17695c775066a7d0475c9abf8 /src/network
parent3ba1b1a9529999e0135f48394b43beac89df7e4e (diff)
downloadQt-1db1c895259fba1813a2d970d2334a6b35ba4f5d.zip
Qt-1db1c895259fba1813a2d970d2334a6b35ba4f5d.tar.gz
Qt-1db1c895259fba1813a2d970d2334a6b35ba4f5d.tar.bz2
QNAM HTTP: Fix bug with explicitly zero-length compressed responses.
In the case of a response with e.g content-encoding "gzip" and content-length "0", the HTTP backend would incorrectly fall back to the "unspecified length" code path and wait for readyRead() forever. Task-number: QTBUG-18232 Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttpnetworkreply.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index e608005..d329c10 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -811,8 +811,14 @@ bool QHttpNetworkReplyPrivate::expectContent()
return false;
if (request.operation() == QHttpNetworkRequest::Head)
return !shouldEmitSignals();
- if (contentLength() == 0)
+ qint64 expectedContentLength = contentLength();
+ if (expectedContentLength == 0)
return false;
+ if (expectedContentLength == -1 && bodyLength == 0) {
+ // The content-length header was stripped, but its value was 0.
+ // This would be the case for an explicitly zero-length compressed response.
+ return false;
+ }
return true;
}