updated to the current pikotools api from branch api2021

This commit is contained in:
2021-05-11 22:20:46 +02:00
parent 85f9fda984
commit f1af7e2eeb
15 changed files with 54 additions and 80 deletions

View File

@@ -272,7 +272,6 @@ return true;
}
bool App::Init()
{
postgresql_connector.set_conn_param(config.db_database, config.db_user, config.db_pass);
@@ -283,7 +282,6 @@ bool App::Init()
model_connector.set_flat_connector(json_connector);
model_connector.set_db_connector(postgresql_connector);
model_connector.set_logger(log);
//model_connector.set_doc_connector(doc_html_connector);
// temporary
if( config.space.to_bool(L"do_migration_to_winix_fullmorm", false) )
@@ -295,30 +293,6 @@ bool App::Init()
log << log1 << "Migrations complete, now remove do_migration_to_winix_fullmorm from the config" << logend;
std::exit(0);
}
/////////////
morm::Finder<User> finder(model_connector);
User user = finder.
select().
where().
eq(L"id", 1).
get();
log << log1 << user << logend;
std::exit(0);
//////////////////////////////////
db_conn.SetConnParam(config.db_database, config.db_user, config.db_pass);
db_conn.WaitForConnection();
@@ -956,12 +930,12 @@ void App::ReadEnvHTTPVariables()
{
char * env = *e;
if( PT::IsSubStringNoCasep("HTTP_", env) )
if( PT::is_substr_nc("HTTP_", env) )
{
env += http_prefix_len;
// cookies we have in a different table
if( !PT::IsSubStringNoCasep("COOKIE=", env) )
if( !PT::is_substr_nc("COOKIE=", env) )
{
if( SaveEnvHTTPVariable(env) )
{
@@ -991,7 +965,7 @@ bool App::SaveEnvHTTPVariable(const char * env)
for( ; env[i] != 0 && env[i] != '=' && i < Request::INPUT_HEADER_NAME_MAX_LENGTH ; ++i)
{
header_name[i] = PT::ToLower(env[i]);
header_name[i] = PT::to_lower(env[i]);
}
header_name[i] = 0;
@@ -1039,7 +1013,7 @@ void App::ReadEnvRemoteIP()
{
http_header_name = L"HTTP_";
http_header_name += config.proxy_ip_header;
PT::ToUpper(http_header_name);
PT::to_upper_emplace(http_header_name);
PT::WideToUTF8(http_header_name, http_header_8bit);
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
@@ -1065,16 +1039,16 @@ void App::CheckRequestMethod()
if( !cur.request->env_request_method.empty() )
{
if( PT::ToLower(cur.request->env_request_method[0]) == 'g' )
if( PT::to_lower(cur.request->env_request_method[0]) == 'g' )
cur.request->method = Request::get;
else
if( PT::ToLower(cur.request->env_request_method[0]) == 'p' )
if( PT::to_lower(cur.request->env_request_method[0]) == 'p' )
cur.request->method = Request::post;
else
if( PT::ToLower(cur.request->env_request_method[0]) == 'h' )
if( PT::to_lower(cur.request->env_request_method[0]) == 'h' )
cur.request->method = Request::head;
else
if( PT::ToLower(cur.request->env_request_method[0]) == 'd' )
if( PT::to_lower(cur.request->env_request_method[0]) == 'd' )
cur.request->method = Request::delete_;
}
}
@@ -1090,7 +1064,7 @@ void App::CheckSSL()
if( config.assume_connection_is_through_ssl )
cur.request->using_ssl = true;
else
if( PT::EqualNoCase(cur.request->env_https.c_str(), L"on") )
if( PT::is_equal_nc(cur.request->env_https.c_str(), L"on") )
cur.request->using_ssl = true;
}
@@ -1173,13 +1147,13 @@ void App::ReadPostVars()
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
{
if( PT::IsSubStringNoCase(L"multipart/form-data", cur.request->env_content_type.c_str()) )
if( PT::is_substr_nc(L"multipart/form-data", cur.request->env_content_type.c_str()) )
{
log << log3 << "App: post content type: multipart/form-data" << logend;
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
}
else
if( PT::IsSubStringNoCase(L"application/json", cur.request->env_content_type.c_str()) )
if( PT::is_substr_nc(L"application/json", cur.request->env_content_type.c_str()) )
{
log << log3 << "App: post content type: application/json" << logend;
ReadPostJson();