mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Allow blank lines in multipart form-data input
Fixes #11298. PR #16579.
This commit is contained in:
parent
f08c0afbea
commit
1b53c590f2
@ -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…
Reference in New Issue
Block a user