changed: now we do not use std::string and char* in the Winix API

everywhere we are using std::wstring and wchar_t*
         (std::string and char* is used only locally in some places
         especially when creating a path to OS file system etc.)
added:   to the special thread when winix closes:
         a write function for curl: FetchPageOnExitCurlCallback()
         without this function the curl library will print
         the page's content to the standart output
changed: TextStream<> class from core can make
         UTF8<->wide strings conversions
removed: from config: utf8 option
         now winix expects UTF8 from the user's input (html forms, url-es)
         and outputs strings in the UTF8 format




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-10-09 20:44:56 +00:00
parent 4abf6642f7
commit 8196fb77d1
74 changed files with 1911 additions and 1612 deletions

View File

@@ -70,14 +70,14 @@ void Config::ShowError()
case PT::SpaceParser::cant_open_file:
if( errors_to_stdout )
std::cout << "Config: cant open a config file: " << config_file << std::endl;
std::wcout << L"Config: I cannot open a config file: " << config_file << std::endl;
log << log1 << "Config: cant open a config file: " << config_file << logend;
break;
case PT::SpaceParser::syntax_error:
if( errors_to_stdout )
std::cout << "Config: syntax error, line: " << parser.line << std::endl;
std::wcout << "Config: syntax error, line: " << parser.line << std::endl;
log << log1 << "Config: syntax error, line: " << parser.line << logend;
break;
@@ -102,7 +102,6 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
log << log2 << "Config: reading a config file" << logend;
parser.SplitSingle(true);
parser.UTF8(true); // config is always read in UTF-8
parser.SetSpace(space);
PT::SpaceParser::Status status = parser.Parse(config_file);
@@ -127,17 +126,18 @@ void Config::AssignValues(bool stdout_is_closed)
{
demonize = Bool(L"demonize", true);
user = AText(L"user");
group = AText(L"group");
user = Text(L"user");
group = Text(L"group");
additional_groups = Bool(L"additional_groups", true);
log_file = AText(L"log_file");
log_notify_file = AText(L"log_notify_file");
log_file = Text(L"log_file");
log_notify_file = Text(L"log_notify_file");
log_delimiter = Text(L"log_delimiter", L"---------------------------------------------------------------------------------");
fcgi_socket = AText(L"fcgi_socket");
fcgi_socket = Text(L"fcgi_socket");
fcgi_socket_chmod = Int(L"fcgi_socket_chmod", 0770);
fcgi_socket_user = AText(L"fcgi_socket_user");
fcgi_socket_group = AText(L"fcgi_socket_group");
fcgi_socket_user = Text(L"fcgi_socket_user");
fcgi_socket_group = Text(L"fcgi_socket_group");
fcgi_socket_listen = Int(L"fcgi_socket_listen", 100);
log_level = Int(L"log_level", 1);
log_request = Int(L"log_request", 1);
log_save_each_line = Bool(L"log_save_each_line", false);
@@ -157,7 +157,7 @@ void Config::AssignValues(bool stdout_is_closed)
NoLastSlash(upload_dir);
NoLastSlash(common_dir);
upload_group = AText(L"upload_group");
upload_group = Text(L"upload_group");
upload_dirs_chmod = Int(L"upload_dirs_chmod", 0750);
upload_files_chmod = Int(L"upload_files_chmod", 0640);
ListText(L"static_dirs", static_dirs);
@@ -184,9 +184,9 @@ void Config::AssignValues(bool stdout_is_closed)
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
http_session_id_name = Text(L"http_session_id_name", L"session_id");
db_database = AText(L"db_database");
db_user = AText(L"db_user");
db_pass = AText(L"db_pass");
db_database = Text(L"db_database");
db_user = Text(L"db_user");
db_pass = Text(L"db_pass");
item_url_empty = Text(L"item_url_empty");
url_proto = Text(L"url_proto", L"http://");
@@ -214,7 +214,7 @@ void Config::AssignValues(bool stdout_is_closed)
session_max_idle = Int(L"session_max_idle", 10800); // 3h
session_remember_max_idle = Int(L"session_remember_max_idle", 16070400); // 3 months
session_file = AText(L"session_file");
session_file = Text(L"session_file");
session_max = Size(L"session_max", 1000000);
compression = Bool(L"compression", true);
@@ -247,7 +247,6 @@ void Config::AssignValues(bool stdout_is_closed)
NoLastSlash(plugins_dir);
ListText(L"plugins", plugin_file);
utf8 = Bool(L"utf8", true);
symlinks_follow_max = Size(L"symlinks_follow_max", 20);
ticket_form_prefix = Text(L"ticket_form_prefix", L"ticketparam");
@@ -368,25 +367,6 @@ std::wstring & Config::Text(const std::wstring & name, const wchar_t * def)
}
std::string & Config::AText(const wchar_t * name)
{
return space.AText(name);
}
std::string & Config::AText(const wchar_t * name, const char * def)
{
return space.AText(name, def);
}
std::string & Config::AText(const std::wstring & name, const char * def)
{
return space.AText(name, def);
}
int Config::Int(const wchar_t * name)
{
return space.Int(name);