changed: now we are parsing directories and functions before checking a session
added: need_session to FunctionBase (true if the functions requires a session) default: true git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1114 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
436a198c36
commit
35b93b1655
|
@ -402,21 +402,26 @@ void App::ProcessRequestThrow()
|
|||
// and then BaseUrlRedirect() will be called (for performance)
|
||||
if( !BaseUrlRedirect() )
|
||||
{
|
||||
session_manager.SetSession();
|
||||
cur.session = session_manager.GetCurSession();
|
||||
SetLocale();
|
||||
|
||||
if( cur.session->new_session )
|
||||
{
|
||||
cur.session->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_SESSION_CHANGED);
|
||||
|
||||
if( cur.request->env_request_uri.size() <= WINIX_URL_MAX_SIZE )
|
||||
{
|
||||
functions.Parse(); // parsing directories, files, functions and parameters
|
||||
|
||||
if( !cur.request->dir_tab.empty() )
|
||||
{
|
||||
functions.CheckFunctionAndSymlink(); // CHECK ME it is correct now?
|
||||
|
||||
session_manager.SetSession();
|
||||
cur.session = session_manager.GetCurSession();
|
||||
SetLocale();
|
||||
|
||||
if( cur.session->new_session )
|
||||
{
|
||||
cur.session->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_SESSION_CHANGED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -436,6 +441,18 @@ void App::ProcessRequestThrow()
|
|||
log << log1 << "App: the URL is too long: " << cur.request->env_request_uri.size() << logend;
|
||||
}
|
||||
|
||||
if( cur.request->dir_tab.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty), adding a root dir" << logend;
|
||||
Item * root_dir = system.dirs.GetRootDir();
|
||||
|
||||
if( root_dir )
|
||||
{
|
||||
cur.request->dir_tab.push_back(root_dir);
|
||||
cur.request->last_item = cur.request->dir_tab.back();
|
||||
}
|
||||
}
|
||||
|
||||
cur.mount = system.mounts.CalcCurMount();
|
||||
|
||||
if( cur.mount->type != system.mounts.MountTypeStatic() )
|
||||
|
@ -659,8 +676,8 @@ void App::Make()
|
|||
if( cur.request->status == WINIX_ERR_OK )
|
||||
plugin.Call(WINIX_PREPARE_REQUEST);
|
||||
|
||||
if( cur.request->status == WINIX_ERR_OK )
|
||||
functions.CheckFunctionAndSymlink();
|
||||
// if( cur.request->status == WINIX_ERR_OK )
|
||||
// functions.CheckFunctionAndSymlink();
|
||||
|
||||
CheckAccessFromPlugins();
|
||||
|
||||
|
|
|
@ -460,16 +460,23 @@ void SessionManager::SetSession()
|
|||
|
||||
if( !IsIPBanned() )
|
||||
{
|
||||
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
|
||||
|
||||
if( i != cur->request->cookie_tab.end() )
|
||||
if( cur->request->function && cur->request->function->need_session )
|
||||
{
|
||||
if( !SetSessionFromCookie(i->second) )
|
||||
cur->request->cookie_tab.erase(i);
|
||||
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
|
||||
|
||||
if( i != cur->request->cookie_tab.end() )
|
||||
{
|
||||
if( !SetSessionFromCookie(i->second) )
|
||||
cur->request->cookie_tab.erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
NoSessionCookieCheckBan();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NoSessionCookieCheckBan();
|
||||
SetTemporarySession();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ FunctionBase::FunctionBase()
|
|||
follow_symlinks = true;
|
||||
template_index = size_t(-1);
|
||||
need_ssl = false;
|
||||
need_session = true;
|
||||
|
||||
fun.user_id = -1;
|
||||
fun.group_id = -1;
|
||||
|
|
|
@ -80,6 +80,10 @@ public:
|
|||
// (this option is ignored if 'use_ssl' in the config is false)
|
||||
bool need_ssl;
|
||||
|
||||
// true if the function need a session object
|
||||
// if false then a temporary session is used
|
||||
bool need_session;
|
||||
|
||||
virtual void Init();
|
||||
virtual bool HasAccess();
|
||||
virtual void MakePost();
|
||||
|
|
Loading…
Reference in New Issue