Browse Source

Fix truncation when parsing HTTP request query

Closes #13029.

Fixes an issue with truncation of a QByteArray at the first '\0' byte
when parsing HTTP request query strings.

Previously, the operands of the ternary expression were of
different types. Most likely this was leading to a conversion
of the result to some kind of '\0'-terminated string type somewhere
along the way, in turn causing its truncation at the first '\0' byte
once converted back to QByteArray.

For some reason this bug was only present on Windows (MSVC).
adaptive-webui-19844
FranciscoPombal 4 years ago
parent
commit
0fa7fca31e
  1. 2
      src/base/http/requestparser.cpp

2
src/base/http/requestparser.cpp

@ -202,7 +202,7 @@ bool RequestParser::parseRequestLine(const QString &line) @@ -202,7 +202,7 @@ bool RequestParser::parseRequestLine(const QString &line)
const QByteArray valueComponent = midView(param, (eqCharPos + 1));
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent).replace('+', ' '));
const QByteArray paramValue = valueComponent.isNull()
? ""
? QByteArray("")
: QByteArray::fromPercentEncoding(valueComponent).replace('+', ' ');
m_request.query[paramName] = paramValue;

Loading…
Cancel
Save