调整类重载,修复部分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
+3 -3
View File
@@ -740,18 +740,18 @@ uns::ResponseBuilder& uns::ResponseBuilder::AutoCORS(uns::RequestPtr req)
std::string host = req->GetImpl()->webcc_req->HasHeader("Host") ? req->GetImpl()->webcc_req->GetHeader("Host") : "";
if(host.empty() || GlobalCORSConfig.HostValidate(host))
{
SCLOG_INFO("Applied CORS headers for origin=%s cred=%d", origin.c_str(), GlobalCORSConfig.AllowCookie() ? 1 : 0);
SCLOGF_INFO("Applied CORS headers for origin={} cred={}", origin, GlobalCORSConfig.AllowCookie() ? 1 : 0);
return CORS(origin);
}
else
{
SCLOG_WARNING("Actual request: Host not allowed: %s", host.c_str());
SCLOGF_WARNING("Actual request: Host not allowed: {}", host);
return Forbidden().Body(std::string("CORS ERROR"));
}
}
else
{
SCLOG_WARNING("Actual request: Origin not allowed: %s", origin.c_str());
SCLOGF_WARNING("Actual request: Origin not allowed: {}", origin);
return Forbidden().Body(std::string("CORS ERROR"));
}
}