diff options
Diffstat (limited to 'src/HttpServer.cc')
| -rw-r--r-- | src/HttpServer.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc index b7f467b1..afb1ab45 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -148,10 +148,13 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest() if(setupResponseRecv() < 0) { A2_LOG_INFO("Request path is invaild. Ignore the request body."); } - lastContentLength_ = - lastRequestHeader_->findAsLLInt(HttpHeader::CONTENT_LENGTH); - if(lastContentLength_ < 0) { - throw DL_ABORT_EX("Content-Length must be positive."); + if(!util::parseLLIntNoThrow(lastContentLength_, + lastRequestHeader_-> + find(HttpHeader::CONTENT_LENGTH)) || + lastContentLength_ < 0) { + throw DL_ABORT_EX(fmt("Invalid Content-Length=%s", + lastRequestHeader_-> + find(HttpHeader::CONTENT_LENGTH).c_str())); } headerProcessor_->clear(); |
