summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2022-09-19 12:39:42 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2022-09-22 15:34:51 +0000
commit1fa0e86995bfdf9c0507fcd097fce712554a769e (patch)
treef85d79ae5a5661f557005136e26da68716962eb6 /src/network/access
parentb3262c7e540c446c5570c3ebf999adea48b2e2e4 (diff)
QNetworkReply: honor legacy behavior of setting Accept-Encoding
And don't decompress the data Pick-to: 6.4 Fixes: QTBUG-106689 Change-Id: I93a96be8178e24ff0b0bb8647276828161445cf5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index b7626cd060..a753639b14 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1329,6 +1329,11 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
q->setAttribute(QNetworkRequest::Http2WasUsedAttribute, h2Used);
+ // A user having manually defined which encodings they accept is, for
+ // somwehat unknown (presumed legacy compatibility) reasons treated as
+ // disabling our decompression:
+ const bool autoDecompress = request.rawHeader("accept-encoding").isEmpty();
+ const bool shouldDecompress = isCompressed && autoDecompress;
// reconstruct the HTTP header
QList<QPair<QByteArray, QByteArray> > headerMap = hm;
QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(),
@@ -1342,7 +1347,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
if (it->first.toLower() == "location")
value.clear();
- if (isCompressed && !decompressHelper.isValid()
+ if (shouldDecompress && !decompressHelper.isValid()
&& it->first.compare("content-encoding", Qt::CaseInsensitive) == 0) {
if (!synchronous) // with synchronous all the data is expected to be handled at once