NCBI C++ ToolKit
Classes | Macros | Functions | Variables
cgiapp.cpp File Reference
#include <ncbi_pch.hpp>
#include <cgi/cgiapp.hpp>
#include <corelib/ncbienv.hpp>
#include <corelib/rwstream.hpp>
#include <corelib/stream_utils.hpp>
#include <corelib/ncbi_system.hpp>
#include <corelib/ncbi_safe_static.hpp>
#include <corelib/request_ctx.hpp>
#include <corelib/ncbi_strings.h>
#include <util/multi_writer.hpp>
#include <util/cache/cache_ref.hpp>
#include <cgi/cgictx.hpp>
#include <cgi/cgi_exception.hpp>
#include <cgi/cgi_serial.hpp>
#include <cgi/error_codes.hpp>
#include <signal.h>
#include <unistd.h>
+ Include dependency graph for cgiapp.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CCGIStreamReader
 
class  CCgiStreamWrapperWriter
 
class  CStderrDiagFactory
 
class  CAsBodyDiagFactory
 

Macros

#define NCBI_USE_ERRCODE_X   Cgi_Application
 

Functions

 NCBI_PARAM_DECL (bool, CGI, Print_Http_Referer)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Print_Http_Referer, true, eParam_NoThread, CGI_PRINT_HTTP_REFERER)
 
typedef NCBI_PARAM_TYPE (CGI, Print_Http_Referer) TPrintRefererParam
 
 NCBI_PARAM_DECL (bool, CGI, Print_User_Agent)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Print_User_Agent, true, eParam_NoThread, CGI_PRINT_USER_AGENT)
 
typedef NCBI_PARAM_TYPE (CGI, Print_User_Agent) TPrintUserAgentParam
 
 NCBI_PARAM_DECL (bool, CGI, Print_Self_Url)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Print_Self_Url, true, eParam_NoThread, CGI_PRINT_SELF_URL)
 
typedef NCBI_PARAM_TYPE (CGI, Print_Self_Url) TPrintSelfUrlParam
 
 NCBI_PARAM_DECL (bool, CGI, Print_Request_Method)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Print_Request_Method, true, eParam_NoThread, CGI_PRINT_REQUEST_METHOD)
 
typedef NCBI_PARAM_TYPE (CGI, Print_Request_Method) TPrintRequestMethodParam
 
 NCBI_PARAM_DECL (bool, CGI, Allow_Sigpipe)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Allow_Sigpipe, false, eParam_NoThread, CGI_ALLOW_SIGPIPE)
 
typedef NCBI_PARAM_TYPE (CGI, Allow_Sigpipe) TParamAllowSigpipe
 
 NCBI_PARAM_DEF_EX (bool, CGI, Client_Connection_Interruption_Okay, false, eParam_NoThread, CGI_CLIENT_CONNECTION_INTERRUPTION_OKAY)
 
 NCBI_PARAM_ENUM_ARRAY (EDiagSev, CGI, Client_Connection_Interruption_Severity)
 
 NCBI_PARAM_ENUM_DEF_EX (EDiagSev, CGI, Client_Connection_Interruption_Severity, eDiag_Error, eParam_NoThread, CGI_CLIENT_CONNECTION_INTERRUPTION_SEVERITY)
 
 NCBI_PARAM_DECL (bool, CGI, Count_Transfered)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Count_Transfered, true, eParam_NoThread, CGI_COUNT_TRANSFERED)
 
typedef NCBI_PARAM_TYPE (CGI, Count_Transfered) TCGI_Count_Transfered
 
void SigTermHandler (int)
 
static void s_CleanupProcessor (CCgiRequestProcessor *processor, void *)
 
 NCBI_PARAM_DECL (bool, CGI, Merge_Log_Lines)
 
 NCBI_PARAM_DEF_EX (bool, CGI, Merge_Log_Lines, true, eParam_NoThread, CGI_MERGE_LOG_LINES)
 
typedef NCBI_PARAM_TYPE (CGI, Merge_Log_Lines) TMergeLogLines
 
 NCBI_PARAM_DECL (bool, CGI, EnableHelpRequest)
 
 NCBI_PARAM_DEF_EX (bool, CGI, EnableHelpRequest, true, eParam_NoThread, CGI_ENABLE_HELP_REQUEST)
 
typedef NCBI_PARAM_TYPE (CGI, EnableHelpRequest) TEnableHelpRequest
 
string FindContentType (CTempString format)
 
 NCBI_PARAM_DECL (string, CGI, EnableVersionRequest)
 
 NCBI_PARAM_DEF_EX (string, CGI, EnableVersionRequest, "t", eParam_NoThread, CGI_ENABLE_VERSION_REQUEST)
 
typedef NCBI_PARAM_TYPE (CGI, EnableVersionRequest) TEnableVersionRequest
 
 NCBI_PARAM_DECL (bool, CGI, ValidateCSRFToken)
 
 NCBI_PARAM_DEF_EX (bool, CGI, ValidateCSRFToken, false, eParam_NoThread, CGI_VALIDATE_CSRF_TOKEN)
 
typedef NCBI_PARAM_TYPE (CGI, ValidateCSRFToken) TParamValidateCSRFToken
 
 DEFINE_STATIC_FAST_MUTEX (s_RestartReasonMutex)
 
 NCBI_PARAM_DECL (string, CGI, Exception_Message)
 
 NCBI_PARAM_DEF_EX (string, CGI, Exception_Message, "", eParam_NoThread, CGI_EXCEPTION_MESSAGE)
 
typedef NCBI_PARAM_TYPE (CGI, Exception_Message) TExceptionMessage
 
 NCBI_PARAM_DEF (bool, CGI, DisableTrackingCookie, false)
 
 NCBI_PARAM_DEF (string, CGI, TrackingCookieName, "ncbi_sid")
 
 NCBI_PARAM_DEF (string, CGI, TrackingTagName, "NCBI-SID")
 
 NCBI_PARAM_DEF (string, CGI, TrackingCookieDomain, ".nih.gov")
 
 NCBI_PARAM_DEF (string, CGI, TrackingCookiePath, "/")
 

Variables

const char * kToolkitRcPath = "/etc/toolkitrc"
 
const char * kWebDirToPort = "Web_dir_to_port"
 
static const char * kStdFormats [] = { "html", "xml", "json" }
 
static const char * kStdContentTypes [] = { "text/html", "text/xml", "application/json" }
 
static const char * kCSRFTokenName = "NCBI_CSRF_TOKEN"
 

Macro Definition Documentation

◆ NCBI_USE_ERRCODE_X

#define NCBI_USE_ERRCODE_X   Cgi_Application

Definition at line 59 of file cgiapp.cpp.

Function Documentation

◆ DEFINE_STATIC_FAST_MUTEX()

DEFINE_STATIC_FAST_MUTEX ( s_RestartReasonMutex  )

◆ FindContentType()

string FindContentType ( CTempString  format)
inline

Definition at line 1761 of file cgiapp.cpp.

References format, i, kEmptyStr, kStdContentTypes, and kStdFormats.

Referenced by CCgiRequestProcessor::ProcessHelpRequest().

◆ NCBI_PARAM_DECL() [1/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Allow_Sigpipe   
)

◆ NCBI_PARAM_DECL() [2/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Count_Transfered   
)

◆ NCBI_PARAM_DECL() [3/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
EnableHelpRequest   
)

◆ NCBI_PARAM_DECL() [4/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Merge_Log_Lines   
)

◆ NCBI_PARAM_DECL() [5/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Print_Http_Referer   
)

◆ NCBI_PARAM_DECL() [6/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Print_Request_Method   
)

◆ NCBI_PARAM_DECL() [7/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Print_Self_Url   
)

◆ NCBI_PARAM_DECL() [8/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
Print_User_Agent   
)

◆ NCBI_PARAM_DECL() [9/11]

NCBI_PARAM_DECL ( bool  ,
CGI  ,
ValidateCSRFToken   
)

◆ NCBI_PARAM_DECL() [10/11]

NCBI_PARAM_DECL ( string  ,
CGI  ,
EnableVersionRequest   
)

◆ NCBI_PARAM_DECL() [11/11]

NCBI_PARAM_DECL ( string  ,
CGI  ,
Exception_Message   
)

◆ NCBI_PARAM_DEF() [1/5]

NCBI_PARAM_DEF ( bool  ,
CGI  ,
DisableTrackingCookie  ,
false   
)

◆ NCBI_PARAM_DEF() [2/5]

NCBI_PARAM_DEF ( string  ,
CGI  ,
TrackingCookieDomain  ,
".nih.gov"   
)

◆ NCBI_PARAM_DEF() [3/5]

NCBI_PARAM_DEF ( string  ,
CGI  ,
TrackingCookieName  ,
"ncbi_sid"   
)

◆ NCBI_PARAM_DEF() [4/5]

NCBI_PARAM_DEF ( string  ,
CGI  ,
TrackingCookiePath  ,
"/"   
)

◆ NCBI_PARAM_DEF() [5/5]

NCBI_PARAM_DEF ( string  ,
CGI  ,
TrackingTagName  ,
"NCBI-SID"   
)

◆ NCBI_PARAM_DEF_EX() [1/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Allow_Sigpipe  ,
false  ,
eParam_NoThread  ,
CGI_ALLOW_SIGPIPE   
)

◆ NCBI_PARAM_DEF_EX() [2/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Client_Connection_Interruption_Okay  ,
false  ,
eParam_NoThread  ,
CGI_CLIENT_CONNECTION_INTERRUPTION_OKAY   
)

◆ NCBI_PARAM_DEF_EX() [3/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Count_Transfered  ,
true  ,
eParam_NoThread  ,
CGI_COUNT_TRANSFERED   
)

◆ NCBI_PARAM_DEF_EX() [4/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
EnableHelpRequest  ,
true  ,
eParam_NoThread  ,
CGI_ENABLE_HELP_REQUEST   
)

◆ NCBI_PARAM_DEF_EX() [5/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Merge_Log_Lines  ,
true  ,
eParam_NoThread  ,
CGI_MERGE_LOG_LINES   
)

◆ NCBI_PARAM_DEF_EX() [6/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Print_Http_Referer  ,
true  ,
eParam_NoThread  ,
CGI_PRINT_HTTP_REFERER   
)

◆ NCBI_PARAM_DEF_EX() [7/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Print_Request_Method  ,
true  ,
eParam_NoThread  ,
CGI_PRINT_REQUEST_METHOD   
)

◆ NCBI_PARAM_DEF_EX() [8/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Print_Self_Url  ,
true  ,
eParam_NoThread  ,
CGI_PRINT_SELF_URL   
)

◆ NCBI_PARAM_DEF_EX() [9/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
Print_User_Agent  ,
true  ,
eParam_NoThread  ,
CGI_PRINT_USER_AGENT   
)

◆ NCBI_PARAM_DEF_EX() [10/12]

NCBI_PARAM_DEF_EX ( bool  ,
CGI  ,
ValidateCSRFToken  ,
false  ,
eParam_NoThread  ,
CGI_VALIDATE_CSRF_TOKEN   
)

◆ NCBI_PARAM_DEF_EX() [11/12]

NCBI_PARAM_DEF_EX ( string  ,
CGI  ,
EnableVersionRequest  ,
"t"  ,
eParam_NoThread  ,
CGI_ENABLE_VERSION_REQUEST   
)

◆ NCBI_PARAM_DEF_EX() [12/12]

NCBI_PARAM_DEF_EX ( string  ,
CGI  ,
Exception_Message  ,
""  ,
eParam_NoThread  ,
CGI_EXCEPTION_MESSAGE   
)

◆ NCBI_PARAM_ENUM_ARRAY()

NCBI_PARAM_ENUM_ARRAY ( EDiagSev  ,
CGI  ,
Client_Connection_Interruption_Severity   
)

Definition at line 100 of file cgiapp.cpp.

References eDiag_Critical, eDiag_Error, eDiag_Fatal, eDiag_Info, eDiag_Trace, and eDiag_Warning.

◆ NCBI_PARAM_ENUM_DEF_EX()

NCBI_PARAM_ENUM_DEF_EX ( EDiagSev  ,
CGI  ,
Client_Connection_Interruption_Severity  ,
eDiag_Error  ,
eParam_NoThread  ,
CGI_CLIENT_CONNECTION_INTERRUPTION_SEVERITY   
)

◆ NCBI_PARAM_TYPE() [1/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Allow_Sigpipe   
)

◆ NCBI_PARAM_TYPE() [2/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Count_Transfered   
)

◆ NCBI_PARAM_TYPE() [3/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
EnableHelpRequest   
)

◆ NCBI_PARAM_TYPE() [4/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
EnableVersionRequest   
)

◆ NCBI_PARAM_TYPE() [5/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Exception_Message   
)

◆ NCBI_PARAM_TYPE() [6/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Merge_Log_Lines   
)

◆ NCBI_PARAM_TYPE() [7/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Print_Http_Referer   
)

◆ NCBI_PARAM_TYPE() [8/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Print_Request_Method   
)

◆ NCBI_PARAM_TYPE() [9/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Print_Self_Url   
)

◆ NCBI_PARAM_TYPE() [10/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
Print_User_Agent   
)

◆ NCBI_PARAM_TYPE() [11/11]

typedef NCBI_PARAM_TYPE ( CGI  ,
ValidateCSRFToken   
)

◆ s_CleanupProcessor()

static void s_CleanupProcessor ( CCgiRequestProcessor processor,
void *   
)
static

Definition at line 845 of file cgiapp.cpp.

Referenced by CCgiApplication::x_CreateProcessor().

◆ SigTermHandler()

void SigTermHandler ( int  )

Definition at line 463 of file cgiapp.cpp.

Referenced by CCgiApplication::Run().

Variable Documentation

◆ kCSRFTokenName

const char* kCSRFTokenName = "NCBI_CSRF_TOKEN"
static

Definition at line 1880 of file cgiapp.cpp.

Referenced by CCgiRequestProcessor::ValidateSynchronizationToken().

◆ kStdContentTypes

const char* kStdContentTypes[] = { "text/html", "text/xml", "application/json" }
static

Definition at line 1759 of file cgiapp.cpp.

Referenced by FindContentType(), and CCgiRequestProcessor::ProcessHelpRequest().

◆ kStdFormats

const char* kStdFormats[] = { "html", "xml", "json" }
static

Definition at line 1758 of file cgiapp.cpp.

Referenced by FindContentType(), and CCgiRequestProcessor::ProcessHelpRequest().

◆ kToolkitRcPath

const char* kToolkitRcPath = "/etc/toolkitrc"

Definition at line 1639 of file cgiapp.cpp.

Referenced by GetDefaultLogLocation(), and CCgiApplication::GetDefaultLogPath().

◆ kWebDirToPort

const char* kWebDirToPort = "Web_dir_to_port"

Definition at line 1640 of file cgiapp.cpp.

Referenced by GetDefaultLogLocation(), and CCgiApplication::GetDefaultLogPath().

Modified on Fri Sep 20 14:58:03 2024 by modify_doxy.py rev. 669887