namespace PT renamed to pt

This commit is contained in:
2021-05-20 20:59:12 +02:00
parent d66a36cf21
commit e48a28a5c8
100 changed files with 597 additions and 597 deletions

View File

@@ -815,7 +815,7 @@ void App::Make()
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
{
PT::Date date(cur.session->ip_ban->expires);
pt::Date date(cur.session->ip_ban->expires);
// IMPROVE ME there is no slog now
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
@@ -878,7 +878,7 @@ void App::LogEnvironmentHTTPVariables()
{
if( cur.request->headers_in.is_object() )
{
PT::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
pt::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
for( ; i != cur.request->headers_in.value.value_object.end() ; ++i)
{
@@ -934,7 +934,7 @@ void App::SetEnv(const char * name, std::wstring & env)
if( v )
{
PT::UTF8ToWide(v, env);
pt::UTF8ToWide(v, env);
}
}
@@ -967,12 +967,12 @@ void App::ReadEnvHTTPVariables()
{
char * env = *e;
if( PT::is_substr_nc("HTTP_", env) )
if( pt::is_substr_nc("HTTP_", env) )
{
env += http_prefix_len;
// cookies we have in a different table
if( !PT::is_substr_nc("COOKIE=", env) )
if( !pt::is_substr_nc("COOKIE=", env) )
{
if( SaveEnvHTTPVariable(env) )
{
@@ -1002,7 +1002,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::to_lower(env[i]);
header_name[i] = pt::to_lower(env[i]);
}
header_name[i] = 0;
@@ -1031,8 +1031,8 @@ bool App::SaveEnvHTTPVariable(const char * env)
return false;
}
PT::UTF8ToWide(header_name, http_header_name);
PT::UTF8ToWide(header_value, http_header_value);
pt::UTF8ToWide(header_name, http_header_name);
pt::UTF8ToWide(header_value, http_header_value);
cur.request->headers_in.add(http_header_name, http_header_value);
http_header_name.clear();
@@ -1050,9 +1050,9 @@ void App::ReadEnvRemoteIP()
{
http_header_name = L"HTTP_";
http_header_name += config.proxy_ip_header;
PT::to_upper_emplace(http_header_name);
pt::to_upper_emplace(http_header_name);
PT::WideToUTF8(http_header_name, http_header_8bit);
pt::WideToUTF8(http_header_name, http_header_8bit);
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
}
else
@@ -1063,7 +1063,7 @@ void App::ReadEnvRemoteIP()
if( v )
{
cur.request->ip = (int)inet_addr(v);
PT::UTF8ToWide(v, cur.request->ip_str);
pt::UTF8ToWide(v, cur.request->ip_str);
}
}
@@ -1076,16 +1076,16 @@ void App::CheckRequestMethod()
if( !cur.request->env_request_method.empty() )
{
if( PT::to_lower(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::to_lower(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::to_lower(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::to_lower(cur.request->env_request_method[0]) == 'd' )
if( pt::to_lower(cur.request->env_request_method[0]) == 'd' )
cur.request->method = Request::delete_;
}
}
@@ -1101,7 +1101,7 @@ void App::CheckSSL()
if( config.assume_connection_is_through_ssl )
cur.request->using_ssl = true;
else
if( PT::is_equal_nc(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;
}
@@ -1145,7 +1145,7 @@ void App::ReadPostJson()
do
{
// IMPROVE ME
// we can read to PT::TextBuffer and make a PT::JSONToSpaceParser::Parse(PT::TextBuffer &) method
// we can read to pt::TextBuffer and make a pt::JSONToSpaceParser::Parse(pt::TextBuffer &) method
read_len = FCGX_GetStr(buffer, buffer_len, fcgi_request.in);
if( read_len > 0 )
@@ -1155,14 +1155,14 @@ void App::ReadPostJson()
if( !post_buffer.empty() )
{
PT::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
pt::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
post_buffer.clear();
if( status != PT::SpaceParser::ok )
if( status != pt::SpaceParser::ok )
{
log << log1 << "App: cannot parse the input stream as an JSON object";
if( status == PT::SpaceParser::syntax_error )
if( status == pt::SpaceParser::syntax_error )
log << ", syntax error in line: " << space_parser.get_last_parsed_line() << logend;
cur.request->post_in.clear();
@@ -1184,13 +1184,13 @@ void App::ReadPostVars()
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
{
if( PT::is_substr_nc(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::is_substr_nc(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();
@@ -1246,7 +1246,7 @@ void App::PrepareSessionCookie()
}
else
{
PT::Date expires = cur.request->start_time + config.session_remember_max_idle;
pt::Date expires = cur.request->start_time + config.session_remember_max_idle;
cur.request->AddCookie(config.http_session_id_name, cookie_id_string, expires);
}
}
@@ -1277,7 +1277,7 @@ return false;
}
bool App::AddHeader(const wchar_t * name, const PT::WTextStream & value)
bool App::AddHeader(const wchar_t * name, const pt::WTextStream & value)
{
if( !cur.request->out_headers.has_key(name) )
{
@@ -1289,7 +1289,7 @@ return false;
}
bool App::AddHeader(const std::wstring & name, const PT::WTextStream & value)
bool App::AddHeader(const std::wstring & name, const pt::WTextStream & value)
{
if( !cur.request->out_headers.has_key(name) )
{
@@ -1301,7 +1301,7 @@ return false;
}
bool App::PrepareHeadersStaticCreateResource(PT::WTextStream & out_path)
bool App::PrepareHeadersStaticCreateResource(pt::WTextStream & out_path)
{
size_t i = 0;
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
@@ -1348,7 +1348,7 @@ void App::PrepareHeadersStatic()
return;
}
PT::WTextStream path;
pt::WTextStream path;
path << config.static_dirs[index] << L"/";
if( !PrepareHeadersStaticCreateResource(path) )
@@ -1470,7 +1470,7 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
if( output_size != static_cast<size_t>(-1) )
{
PT::WTextStream buf;
pt::WTextStream buf;
buf << output_size;
AddHeader(L"Content-Length", buf);
}
@@ -1483,8 +1483,8 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
// and if compression is enabled the client's browser will not be able to decompress the stream
void App::SendHeaders()
{
PT::Space::ObjectType::iterator i;
PT::Space & headers = cur.request->out_headers;
pt::Space::ObjectType::iterator i;
pt::Space & headers = cur.request->out_headers;
if( headers.is_object() )
{
@@ -1494,8 +1494,8 @@ void App::SendHeaders()
{
if( i->second->is_wstr() )
{
PT::WideToUTF8(i->first, aheader_name);
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
pt::WideToUTF8(i->first, aheader_name);
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
FCGX_PutS(": ", fcgi_request.out);
@@ -1517,8 +1517,8 @@ void App::SendHeaders()
void App::SendCookies()
{
PT::Space::ObjectType::iterator i;
PT::Space & cookies = cur.request->out_cookies;
pt::Space::ObjectType::iterator i;
pt::Space & cookies = cur.request->out_cookies;
if( cookies.is_object() )
{
@@ -1528,8 +1528,8 @@ void App::SendCookies()
{
if( i->second->is_wstr() )
{
PT::WideToUTF8(i->first, aheader_name);
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
pt::WideToUTF8(i->first, aheader_name);
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
@@ -1582,7 +1582,7 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
void App::PrepareStandardJSONFields()
{
PT::Space & info = cur.request->info;
pt::Space & info = cur.request->info;
if( !info.has_key(L"status") )
{
@@ -1788,7 +1788,7 @@ size_t output_size = 0;
SelectCompression(source->length(), compressing, compress_encoding);
PT::WideToUTF8(*source, output_8bit);
pt::WideToUTF8(*source, output_8bit);
// !! IMPROVE ME add to log the binary stream as well
if( config.log_server_answer )
@@ -2270,7 +2270,7 @@ int sig;
app->synchro.was_stop_signal = true;
FCGX_ShutdownPending();
PT::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
pt::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
app->Unlock();
app->SendEmptyFastCGIPacket();