调整类重载,修复部分BUG,增加请求头检查

This commit is contained in:
UnknownObject
2026-08-05 14:15:47 +08:00
parent 557cc8b995
commit 0d50588ea7
30 changed files with 1816 additions and 157 deletions
+63 -9
View File
@@ -33,7 +33,7 @@ namespace uns
}
// 完美的把 webcc 的驱动流,翻译给用户的纯净业务类
webcc::ResponsePtr Handle(webcc::RequestPtr request) final
webcc::ResponsePtr Handle(webcc::RequestPtr request) override final
{
try
{
@@ -53,7 +53,7 @@ namespace uns
return uns::ResponseBuilder().InternalServerError()()->GetImpl()->webcc_res; //Default 500
}
bool Stream(const std::string& method) final
bool Stream(const std::string& method) override final
{
try
{
@@ -70,7 +70,25 @@ namespace uns
return false; //Default false
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override
bool ValidateHeader(webcc::RequestPtr request) override final
{
try
{
auto uns_req = uns::RequestPtr(new uns::Request(std::make_unique<uns::Request::Impl>(request)));
return user_processor->IsHeaderValid(uns_req);
}
catch (const std::exception& e)
{
SCLOGF_ERROR("Unhandled Exception in ServerProcessorAdapter(ValidateHeader): {}", e.what());
}
catch (...)
{
SCLOGF_FATAL("Unhandled Unknown Exception in ServerProcessorAdapter(ValidateHeader)");
}
return true; //Default true
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override final
{
try
{
@@ -98,7 +116,7 @@ namespace uns
}
// 完美的把 webcc 的驱动流,翻译给用户的纯净业务类
webcc::ResponsePtr Handle(webcc::RequestPtr request) final
webcc::ResponsePtr Handle(webcc::RequestPtr request) override final
{
try
{
@@ -118,13 +136,31 @@ namespace uns
return uns::ResponseBuilder().InternalServerError()()->GetImpl()->webcc_res; //Default 500
}
bool Stream(const std::string& method) final
bool Stream(const std::string& method) override final
{
// 所有数据都不能由webcc进行串流,否则将无法从request中获取文件
return false;
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override
bool ValidateHeader(webcc::RequestPtr request) override final
{
try
{
auto uns_req = uns::RequestPtr(new uns::Request(std::make_unique<uns::Request::Impl>(request)));
return user_reciver->IsHeaderValid(uns_req);
}
catch (const std::exception& e)
{
SCLOGF_ERROR("Unhandled Exception in FileReceiverAdapter(ValidateHeader): {}", e.what());
}
catch (...)
{
SCLOGF_FATAL("Unhandled Unknown Exception in FileReceiverAdapter(ValidateHeader)");
}
return true; //Default true
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override final
{
try
{
@@ -152,7 +188,7 @@ namespace uns
}
// 完美的把 webcc 的驱动流,翻译给用户的纯净业务类
webcc::ResponsePtr Handle(webcc::RequestPtr request) final
webcc::ResponsePtr Handle(webcc::RequestPtr request) override final
{
try
{
@@ -172,13 +208,31 @@ namespace uns
return uns::ResponseBuilder().InternalServerError()()->GetImpl()->webcc_res; //Default 500
}
bool Stream(const std::string& method) final
bool Stream(const std::string& method) override final
{
// 所有数据都不能由webcc进行串流,否则将无法从request中获取文件
return false;
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override
bool ValidateHeader(webcc::RequestPtr request) override final
{
try
{
auto uns_req = uns::RequestPtr(new uns::Request(std::make_unique<uns::Request::Impl>(request)));
return user_reciver->IsHeaderValid(uns_req);
}
catch (const std::exception& e)
{
SCLOGF_ERROR("Unhandled Exception in SyncFileReceiverAdapter(ValidateHeader): {}", e.what());
}
catch (...)
{
SCLOGF_FATAL("Unhandled Unknown Exception in SyncFileReceiverAdapter(ValidateHeader)");
}
return true; //Default true
}
void ApplyIpUpdate(IPTablePtr blocked_ips) override final
{
try
{