mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 03:38:03 +08:00
Return 400 if the content-length is invalid (#629)
This commit is contained in:
parent
72a4cad9c1
commit
4ce2d25d55
@ -214,7 +214,16 @@ bool HttpRequestParser::parseRequest(MsgBuffer *buf)
|
||||
request_->getHeaderBy("content-length");
|
||||
if (!len.empty())
|
||||
{
|
||||
currentContentLength_ = std::stoull(len.c_str());
|
||||
try
|
||||
{
|
||||
currentContentLength_ = std::stoull(len.c_str());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
buf->retrieveAll();
|
||||
shutdownConnection(k400BadRequest);
|
||||
return false;
|
||||
}
|
||||
if (currentContentLength_ == 0)
|
||||
{
|
||||
status_ = HttpRequestParseStatus::kGotAll;
|
||||
|
Loading…
Reference in New Issue
Block a user