summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2011-03-22 13:54:33 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2011-03-22 14:03:45 (GMT)
commite3df83e8735124dbd15107b0c083d75d99b98ea9 (patch)
treeef823cf159beab53dbb59f558ddfb29fb4111b20 /src/network/access
parent3441c288be67c79c960e8386668731e55db60f0c (diff)
downloadQt-e3df83e8735124dbd15107b0c083d75d99b98ea9.zip
Qt-e3df83e8735124dbd15107b0c083d75d99b98ea9.tar.gz
Qt-e3df83e8735124dbd15107b0c083d75d99b98ea9.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/access')
-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 704cf3a..cb6c09f 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -886,8 +886,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;
}