summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-12-04 11:35:06 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2018-12-07 15:59:23 +0000
commitb60c642ec0532c108abcf57a42e214f44595ef93 (patch)
treec5267b8307c44a2a61541432c6a26279a47ffc8a /src/network/access/qnetworkreplyhttpimpl.cpp
parentf184f1a4817f868bd17280c95b4117f48c9b4c23 (diff)
Revise filtering of Content-Length in HTTP cache control
We filter out Content-Length from the cache metadata due to IIS sending it bogusly on 304 responses; however, we were only doing this if the cached response had a Content-Length header, which doesn't happen when the original request was delivered chunked. Furthermore, the filtering wasn't limited to the case of 304 responses. So skip the "had it previously" requirement and only do this for 304s. Fixes: QTBUG-72035 Change-Id: Ie5d858e0f0205bf68f0a13a9c9d4a6e844cb3568 Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 8750a841f6..ed2235ad28 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1676,13 +1676,13 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
|| header == "content-range"
|| header == "content-type")
continue;
-
- // For MS servers that send "Content-Length: 0" on 304 responses
- // ignore this too
- if (header == "content-length")
- continue;
}
+ // IIS has been known to send "Content-Length: 0" on 304 responses, so
+ // ignore this too
+ if (header == "content-length" && statusCode == 304)
+ continue;
+
#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
QByteArray n = q->rawHeader(header);
QByteArray o;