使用drogon默认plugin GlobalFilters时,运行程序闪退 #1636
Replies: 2 comments
-
windows clion+vs2022开发环境 |
Beta Was this translation helpful? Give feedback.
0 replies
-
编译问题,还是不自己编译了,用vcpkg一点问题没有了现在 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
这是我的配置文件的内容
{
"name": "drogon::plugin::GlobalFilters",
"dependencies": [],
"config": {
"filters": [
"LoginFilter"
],
"exempt": [
"^/static/.\.css", "^/images/.","/UserController/loginPage"
]
}
}
这是我LoginFilter的内容
void LoginFilter::doFilter(const HttpRequestPtr &req,
FilterCallback &&fcb,
FilterChainCallback &&fccb)
{
auto session = req->session();
if (session && session->getstd::string("username") != "")
{
fccb();
}
else
{
auto resp = drogon::HttpResponse::newHttpViewResponse(view::LOGIN_PAGE);
fcb(resp);
}
}
在配置文件中添加globalfilter之前运行正常,添加后就闪退,不知道是bug还是我哪里没配置好
Beta Was this translation helpful? Give feedback.
All reactions