Browse Source

Merge pull request #13042 from FranciscoPombal/fix_request_parser

Fix truncation when parsing HTTP request query
adaptive-webui-19844
Vladimir Golovnev 5 years ago committed by GitHub
parent
commit
06e1b07274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/CMakeLists.txt
  2. 2
      src/base/http/requestparser.cpp
  3. 1
      src/src.pro

1
src/CMakeLists.txt

@ -36,6 +36,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# defines # defines
add_definitions(-DQT_DEPRECATED_WARNINGS) add_definitions(-DQT_DEPRECATED_WARNINGS)
add_definitions(-DQT_NO_CAST_TO_ASCII) add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_STRICT_ITERATORS) add_definitions(-DQT_STRICT_ITERATORS)

2
src/base/http/requestparser.cpp

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

1
src/src.pro

@ -57,6 +57,7 @@ include(../version.pri)
# Qt defines # Qt defines
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_NO_CAST_TO_ASCII DEFINES += QT_NO_CAST_TO_ASCII
DEFINES += QT_NO_CAST_FROM_BYTEARRAY
DEFINES += QT_USE_QSTRINGBUILDER DEFINES += QT_USE_QSTRINGBUILDER
DEFINES += QT_STRICT_ITERATORS DEFINES += QT_STRICT_ITERATORS

Loading…
Cancel
Save