优化文件上传速度,增加请求头预校验功能

This commit is contained in:
UnknownObject
2026-08-05 11:44:57 +08:00
parent a805d22901
commit 74685e4c24
933 changed files with 14735 additions and 2813 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
#ifndef WEBCC_VIEW_H_
#ifndef WEBCC_VIEW_H_
#define WEBCC_VIEW_H_
#include <memory>
@@ -25,6 +25,14 @@ public:
virtual bool Stream(const std::string& /*method*/) {
return false; // No streaming by default
}
// 【核心新增】:请求头预校验虚函数
// 当 Header 刚解析完毕、尚未接收 Body 时触发。
// 返回 true 继续接收数据;返回 false 强行 RST 切断连接。
virtual bool ValidateHeader(RequestPtr /*request*/)
{
return true; // 默认不校验,全放行
}
};
using ViewPtr = std::shared_ptr<View>;