Browse Source

Allow blank lines in multipart form-data input

Fixes #11298.
PR #16579.
adaptive-webui-19844
Aleksandr Cupacenko 3 years ago committed by GitHub
parent
commit
1b53c590f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/base/http/requestparser.cpp

8
src/base/http/requestparser.cpp

@ -308,16 +308,16 @@ bool RequestParser::parsePostMessage(const QByteArray &data) @@ -308,16 +308,16 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
bool RequestParser::parseFormData(const QByteArray &data)
{
const QVector<QByteArray> list = splitToViews(data, EOH, Qt::KeepEmptyParts);
const int eohPos = data.indexOf(EOH);
if (list.size() != 2)
if (eohPos < 0)
{
qWarning() << Q_FUNC_INFO << "multipart/form-data format error";
return false;
}
const QString headers = QString::fromLatin1(list[0]);
const QByteArray payload = viewWithoutEndingWith(list[1], CRLF);
const QString headers = QString::fromLatin1(Utils::ByteArray::midView(data, 0, eohPos));
const QByteArray payload = viewWithoutEndingWith(Utils::ByteArray::midView(data, (eohPos + EOH.size()), data.size()), CRLF);
HeaderMap headersMap;
const QList<QStringView> headerLines = QStringView(headers).split(QString::fromLatin1(CRLF), Qt::SkipEmptyParts);

Loading…
Cancel
Save