From 8fe876c0ef35f861cbff537c0f0f7548d50c5f88 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 11 Sep 2019 15:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhttp=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=89=B4=E6=9D=83=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 97a521c6..0cd0fa24 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -399,8 +399,9 @@ inline void HttpSession::canAccessPath(const string &path_in,bool is_dir,const f if(cookie){ //找到了cookie,对cookie上锁先 auto lck = cookie->getLock(); - auto accessErr = (*cookie)[kAccessErrKey]; - if(path.find((*cookie)[kCookiePathKey].get()) == 0){ + auto accessErr = (*cookie)[kAccessErrKey].get(); + auto cookiePath = (*cookie)[kCookiePathKey].get(); + if(path.find(cookiePath) == 0){ //上次cookie是限定本目录 if(accessErr.empty()){ //上次鉴权成功 @@ -410,7 +411,7 @@ inline void HttpSession::canAccessPath(const string &path_in,bool is_dir,const f //上次鉴权失败,如果url发生变更,那么也重新鉴权 if (_parser.Params().empty() || _parser.Params() == cookie->getUid()) { //url参数未变,那么判断无权限访问 - callback(accessErr.empty() ? "无权限访问该目录" : accessErr.get(), nullptr); + callback(accessErr.empty() ? "无权限访问该目录" : accessErr, nullptr); return; } }