Use reference when parsing URL query

PR #19659.
This commit is contained in:
Chocobo1 2023-09-30 11:42:35 +08:00 committed by GitHub
parent 16111496ca
commit 47439a7efd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -251,12 +251,9 @@ bool RequestParser::parsePostMessage(const QByteArrayView data)
// [URL Standard] 5.1 application/x-www-form-urlencoded parsing // [URL Standard] 5.1 application/x-www-form-urlencoded parsing
const QByteArray processedData = data.toByteArray().replace('+', ' '); const QByteArray processedData = data.toByteArray().replace('+', ' ');
QListIterator<QStringPair> i(QUrlQuery(QString::fromUtf8(processedData)).queryItems(QUrl::FullyDecoded)); const QList<QStringPair> pairs = QUrlQuery(QString::fromUtf8(processedData)).queryItems(QUrl::FullyDecoded);
while (i.hasNext()) for (const QStringPair &pair : pairs)
{
const QStringPair pair = i.next();
m_request.posts[pair.first] = pair.second; m_request.posts[pair.first] = pair.second;
}
return true; return true;
} }