mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 06:01:33 -06:00
Response proper error status for invalid request methods
This commit is contained in:
@@ -103,6 +103,7 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data)
|
||||
// handle supported methods
|
||||
if ((m_request.method == HEADER_REQUEST_METHOD_GET) || (m_request.method == HEADER_REQUEST_METHOD_HEAD))
|
||||
return {ParseStatus::OK, m_request, headerLength};
|
||||
|
||||
if (m_request.method == HEADER_REQUEST_METHOD_POST)
|
||||
{
|
||||
const auto parseContentLength = [this]() -> int
|
||||
@@ -146,8 +147,7 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data)
|
||||
return {ParseStatus::OK, m_request, (headerLength + contentLength)};
|
||||
}
|
||||
|
||||
qWarning() << Q_FUNC_INFO << "unsupported request method: " << m_request.method;
|
||||
return {ParseStatus::BadRequest, Request(), 0}; // TODO: SHOULD respond "501 Not Implemented"
|
||||
return {ParseStatus::BadMethod, m_request, 0};
|
||||
}
|
||||
|
||||
bool RequestParser::parseStartLines(const QStringView data)
|
||||
|
||||
Reference in New Issue
Block a user