fixed: dots in url-es (now only one dot is available in the whole name and it cannot be only one dot ".")

added:   cmslu can act as an authorizer (fast cgi authorize role)
added:   Item::static_auth we can have additional static content on the file system
         this content is authorized through cmslu (fastcgi authorizer mode)
changed: some changes in config
changed: the way how the www server is using cmslu
         added new virtuals: static static_auth
changed: cmslu returns correct http headers (200, 404, 403)
changed: in cookie parser: we get the last cookie (if the server has more than one cookie with the same name)



git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@540 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-12-30 20:46:12 +00:00
parent 118bf1fc65
commit 60fccea703
23 changed files with 431 additions and 128 deletions

View File

@@ -11,6 +11,7 @@
#include "log.h"
#include "data.h"
#include "plugin.h"
#include "misc.h"
Config::Config()
@@ -109,9 +110,19 @@ void Config::AssignValues()
data.db_database = Text("db_database");
data.db_user = Text("db_user");
data.db_pass = Text("db_pass");
data.base_url = Text("base_url");
data.item_url_empty = Text("item_url_empty");
NoLastSlash(data.base_url);
data.base_server = Text("base_server");
data.base_url_prefix = Text("base_url_prefix");
data.base_url_static_prefix = Text("base_url_static_prefix");
data.base_url_static_auth_prefix = Text("base_url_static_auth_prefix");
NoLastSlash(data.base_server);
NoFirstHttp(data.base_server);
data.base_url = data.base_url_prefix + data.base_server;
data.base_url_static = data.base_url_static_prefix + data.base_server;
data.base_url_static_auth = data.base_url_static_auth_prefix + data.base_server;
data.one_item_is_showed = Bool("one_item_is_showed");
@@ -199,18 +210,34 @@ void Config::NoLastSlash(std::string & s)
if( s.empty() )
return;
log << log2 << "Config: removing the last slash from: " << s << logend;
if( *(--s.end()) == '/' )
s.erase(--s.end());
}
void Config::NoFirstHttp(std::string & s)
{
if( s.empty() )
return;
const char http[] = "http://";
const char https[] = "https://";
if( IsSubStringNoCase(http, s.c_str()) )
{
s.erase(0, sizeof(http)/sizeof(char));
}
else
if( IsSubStringNoCase(https, s.c_str()) )
{
s.erase(0, sizeof(https)/sizeof(char));
}
}