(
void)
override;
112arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
113 "FastCGI MT sample application");
115arg_desc->AddOptionalKey(
"message",
117 "Message passed to CGI application",
121arg_desc->AddDefaultKey(
"delay",
123 "Delay before sending reply, seconds",
137 intdelay =
GetArgs()[
"delay"].AsInteger();
154 boolis_message =
false;
155 stringmessage = request.
GetEntry(
"Message", &is_message);
157message =
"'"+ message +
"'";
169unique_ptr<CHTMLPage> page;
172 stringhtml_path =
"cgi_sample.html";
173 if( !
CFile(html_path).Exists() ) {
176page.reset(
new CHTMLPage(
"Sample CGI", html_path));
177}
catch(exception& e) {
178 ERR_POST(
"Failed to create Sample CGI HTML page: "<< e.what());
187page->AddTagMap(
"MESSAGE",
text);
190page->AddTagMap(
"SELF_URL", self_url);
192 catch(exception& e) {
193 ERR_POST(
"Failed to populate Sample CGI HTML page: "<< e.what());
199 _TRACE(
"stream status: "<<
ctx.GetStreamStatus());
206}
catch(exception& e) {
207 ERR_POST(
"Failed to compose/send Sample CGI HTML page: "<< e.what());
224 if( args[
"message"] ) {
226 const string& m = args[
"message"].AsString();
230 const auto& values = args[
"message"].GetStringList();
232 for(
const auto& v : values) {
Base class for request processors.
CCgiRequestProcessor * CreateRequestProcessor(void) override
Create request processor to process the request.
void Init(void) override
This method is called on the CGI application initialization â before starting to process a HTTP reque...
CFastCgiMTSampleRequestProcessor(CFastCgiMTSampleApplication &app)
~CFastCgiMTSampleRequestProcessor(void) override
int ProcessRequest(CCgiContext &context) override
Process request provided by the context. By default calls application's ProcessRequest.
int NcbiSys_main(int argc, ncbi::TXChar *argv[])
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ eString
An arbitrary string.
@ eInteger
Convertible into an integer number (int or Int8)
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
virtual void Init(void)
This method is called on the CGI application initialization â before starting to process a HTTP reque...
void SetRequestFlags(int flags)
Set cgi parsing flag.
CCgiApplication & GetApp(void)
CNcbiOstream & out(void) const
Get output stream. Throw exception if GetOutput() is NULL.
CNcbiOstream & WriteHeader(void) const
Write HTTP response header to the output stream.
const CCgiEntry & GetEntry(const string &name, bool *is_found=0) const
Get entry value by name.
ERequestMethod GetRequestMethod(void) const
Get request method.
@ fCaseInsensitiveArgs
use case insensitive CGI arguments
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
static void text(MDB_val *v)
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
static CS_CONTEXT * context
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4