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)
|
// and then BaseUrlRedirect() will be called (for performance)
|
||||||
if( !BaseUrlRedirect() )
|
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 )
|
if( cur.request->env_request_uri.size() <= WINIX_URL_MAX_SIZE )
|
||||||
{
|
{
|
||||||
functions.Parse(); // parsing directories, files, functions and parameters
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -436,6 +441,18 @@ void App::ProcessRequestThrow()
|
||||||
log << log1 << "App: the URL is too long: " << cur.request->env_request_uri.size() << logend;
|
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();
|
cur.mount = system.mounts.CalcCurMount();
|
||||||
|
|
||||||
if( cur.mount->type != system.mounts.MountTypeStatic() )
|
if( cur.mount->type != system.mounts.MountTypeStatic() )
|
||||||
|
@ -659,8 +676,8 @@ void App::Make()
|
||||||
if( cur.request->status == WINIX_ERR_OK )
|
if( cur.request->status == WINIX_ERR_OK )
|
||||||
plugin.Call(WINIX_PREPARE_REQUEST);
|
plugin.Call(WINIX_PREPARE_REQUEST);
|
||||||
|
|
||||||
if( cur.request->status == WINIX_ERR_OK )
|
// if( cur.request->status == WINIX_ERR_OK )
|
||||||
functions.CheckFunctionAndSymlink();
|
// functions.CheckFunctionAndSymlink();
|
||||||
|
|
||||||
CheckAccessFromPlugins();
|
CheckAccessFromPlugins();
|
||||||
|
|
||||||
|
|
|
@ -460,16 +460,23 @@ void SessionManager::SetSession()
|
||||||
|
|
||||||
if( !IsIPBanned() )
|
if( !IsIPBanned() )
|
||||||
{
|
{
|
||||||
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
|
if( cur->request->function && cur->request->function->need_session )
|
||||||
|
|
||||||
if( i != cur->request->cookie_tab.end() )
|
|
||||||
{
|
{
|
||||||
if( !SetSessionFromCookie(i->second) )
|
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
|
||||||
cur->request->cookie_tab.erase(i);
|
|
||||||
|
if( i != cur->request->cookie_tab.end() )
|
||||||
|
{
|
||||||
|
if( !SetSessionFromCookie(i->second) )
|
||||||
|
cur->request->cookie_tab.erase(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NoSessionCookieCheckBan();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NoSessionCookieCheckBan();
|
SetTemporarySession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ FunctionBase::FunctionBase()
|
||||||
follow_symlinks = true;
|
follow_symlinks = true;
|
||||||
template_index = size_t(-1);
|
template_index = size_t(-1);
|
||||||
need_ssl = false;
|
need_ssl = false;
|
||||||
|
need_session = true;
|
||||||
|
|
||||||
fun.user_id = -1;
|
fun.user_id = -1;
|
||||||
fun.group_id = -1;
|
fun.group_id = -1;
|
||||||
|
|
|
@ -80,6 +80,10 @@ public:
|
||||||
// (this option is ignored if 'use_ssl' in the config is false)
|
// (this option is ignored if 'use_ssl' in the config is false)
|
||||||
bool need_ssl;
|
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 void Init();
|
||||||
virtual bool HasAccess();
|
virtual bool HasAccess();
|
||||||
virtual void MakePost();
|
virtual void MakePost();
|
||||||
|
|
Loading…
Reference in New Issue