diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2024-02-07 12:10:21 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@qt.io> | 2024-02-08 17:02:52 +0200 |
commit | 60f471f4b6269827fe2fcaa1f8fbe73db4abe8eb (patch) | |
tree | e723878bfbbe71a9a1930ff35f7e33502bebe744 /src/network/access/qnetworkreplyhttpimpl.cpp | |
parent | a61ac2ca58eb705021176720d481c0eb4c925c2a (diff) |
Replace QHttpHeaders::toListOfPairs() usage with iteration
... as a more computationally effective way, which was not present at
the time those usages were introduced.
As a drive-by add spaces around a binary operator
Task-number: QTBUG-122017
Pick-to: 6.7
Change-Id: I0528c995d1a3c1fe171486c5c313697d1706ee10
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 84d9e08b91..a5f2d91f0d 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1364,7 +1364,10 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm, const bool autoDecompress = request.rawHeader("accept-encoding").isEmpty(); const bool shouldDecompress = isCompressed && autoDecompress; // reconstruct the HTTP header - for (const auto &[key, originValue] : hm.toListOfPairs()) { + for (qsizetype i = 0; i < hm.size(); ++i) { + const auto key = hm.nameAt(i); + const auto originValue = hm.valueAt(i); + QByteArray value = q->rawHeader(key); // Reset any previous "location" header set in the reply. In case of @@ -1398,7 +1401,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm, value += ", "; } value += originValue; - q->setRawHeader(key, value); + q->setRawHeader({key.data(), key.size()}, value); } q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, statusCode); |