Fix performance regression

Follow up #19417.
PR #19652.
This commit is contained in:
Chocobo1
2023-09-28 01:26:57 +08:00
committed by GitHub
parent 46c1c9de65
commit 529e49aea7
4 changed files with 14 additions and 5 deletions

View File

@@ -208,7 +208,7 @@ bool RequestParser::parseRequestLine(const QString &line)
const int sepPos = url.indexOf('?');
const QByteArrayView pathComponent = ((sepPos == -1) ? url : QByteArrayView(url).mid(0, sepPos));
m_request.path = QString::fromUtf8(QByteArray::fromPercentEncoding(pathComponent.toByteArray()));
m_request.path = QString::fromUtf8(QByteArray::fromPercentEncoding(asQByteArray(pathComponent)));
if (sepPos >= 0)
{
@@ -223,10 +223,11 @@ bool RequestParser::parseRequestLine(const QString &line)
const QByteArrayView nameComponent = param.mid(0, eqCharPos);
const QByteArrayView valueComponent = param.mid(eqCharPos + 1);
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent.toByteArray()).replace('+', ' '));
const QString paramName = QString::fromUtf8(
QByteArray::fromPercentEncoding(asQByteArray(nameComponent)).replace('+', ' '));
const QByteArray paramValue = valueComponent.isNull()
? QByteArray("")
: QByteArray::fromPercentEncoding(valueComponent.toByteArray()).replace('+', ' ');
: QByteArray::fromPercentEncoding(asQByteArray(valueComponent)).replace('+', ' ');
m_request.query[paramName] = paramValue;
}