|
|
@ -103,6 +103,7 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data) |
|
|
|
// handle supported methods
|
|
|
|
// handle supported methods
|
|
|
|
if ((m_request.method == HEADER_REQUEST_METHOD_GET) || (m_request.method == HEADER_REQUEST_METHOD_HEAD)) |
|
|
|
if ((m_request.method == HEADER_REQUEST_METHOD_GET) || (m_request.method == HEADER_REQUEST_METHOD_HEAD)) |
|
|
|
return {ParseStatus::OK, m_request, headerLength}; |
|
|
|
return {ParseStatus::OK, m_request, headerLength}; |
|
|
|
|
|
|
|
|
|
|
|
if (m_request.method == HEADER_REQUEST_METHOD_POST) |
|
|
|
if (m_request.method == HEADER_REQUEST_METHOD_POST) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const auto parseContentLength = [this]() -> int |
|
|
|
const auto parseContentLength = [this]() -> int |
|
|
@ -146,8 +147,7 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data) |
|
|
|
return {ParseStatus::OK, m_request, (headerLength + contentLength)}; |
|
|
|
return {ParseStatus::OK, m_request, (headerLength + contentLength)}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qWarning() << Q_FUNC_INFO << "unsupported request method: " << m_request.method; |
|
|
|
return {ParseStatus::BadMethod, m_request, 0}; |
|
|
|
return {ParseStatus::BadRequest, Request(), 0}; // TODO: SHOULD respond "501 Not Implemented"
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool RequestParser::parseStartLines(const QStringView data) |
|
|
|
bool RequestParser::parseStartLines(const QStringView data) |
|
|
|