修复: 升级框架并完善报告导出

- 升级 Drogon 和 Trantor,修复畸形请求导致的连接计数泄漏\n- 增加第三方框架版本校验与自动重建\n- 完善完整报告导出和接口文档
This commit is contained in:
cloud
2026-08-10 09:50:09 +08:00
parent 99ed321d24
commit 0e28826073
82 changed files with 3095 additions and 566 deletions
+22 -6
View File
@@ -17,6 +17,8 @@
#include <trantor/utils/Logger.h>
#include <trantor/utils/MsgBuffer.h>
#include <algorithm>
#include <cerrno>
#include <cstdlib>
using namespace trantor;
using namespace drogon;
@@ -129,7 +131,16 @@ bool HttpResponseParser::parseResponse(MsgBuffer *buf)
// LOG_INFO << "content len=" << len;
if (!len.empty())
{
leftBodyLength_ = static_cast<size_t>(std::stoull(len));
try
{
leftBodyLength_ =
static_cast<size_t>(std::stoull(len));
}
catch (...)
{
// Malformed Content-Length from peer.
return false;
}
status_ = HttpResponseParseStatus::kExpectBody;
}
else
@@ -242,12 +253,17 @@ bool HttpResponseParser::parseResponse(MsgBuffer *buf)
const char *crlf = buf->findCRLF();
if (crlf)
{
// chunk length line
std::string len(buf->peek(), crlf - buf->peek());
char *end;
currentChunkLength_ = strtol(len.c_str(), &end, 16);
// LOG_TRACE << "chun length : " <<
// currentChunkLength_;
errno = 0;
char *end = nullptr;
unsigned long long parsed =
std::strtoull(len.c_str(), &end, 16);
if (errno == ERANGE || end == len.c_str() ||
(*end != '\0' && *end != ';'))
{
return false;
}
currentChunkLength_ = static_cast<size_t>(parsed);
if (currentChunkLength_ != 0)
{
status_ = HttpResponseParseStatus::kExpectChunkBody;