--- parser3/src/targets/cgi/parser3.C 2020/10/14 11:24:46 1.303 +++ parser3/src/targets/cgi/parser3.C 2020/11/10 22:32:13 1.307 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.303 2020/10/14 11:24:46 moko Exp $"; +volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.307 2020/11/10 22:32:13 moko Exp $"; #include "pa_config_includes.h" @@ -154,6 +154,10 @@ char* SAPI::Env::get(SAPI_Info& info, co return info.get_env(name); } +bool SAPI::Env::set(SAPI_Info& info, const char* name, const char* value) { + return info.set_env(name, value); +} + const char* const *SAPI::Env::get(SAPI_Info& info) { return info.get_env(); } @@ -316,9 +320,8 @@ static void connection_handler(SAPI_Info { // initing ::request ptr for signal handlers RequestController rc(&request); - bool fail_on_config_read_problem=locate_config(); - // process the request - request.core(config_filespec_cstr, fail_on_config_read_problem, strcasecmp(request_info.method, "HEAD")==0); + // process the request, we need @httpd-main in auto.p if filespec_to_process not specified + request.core(locate_config() || !filespec_to_process ? config_filespec_cstr : NULL, strcasecmp(request_info.method, "HEAD")==0); // clearing ::request in RequestController desctructor to prevent signal handlers from accessing invalid memory } } @@ -428,7 +431,7 @@ static void real_parser_handler(const ch } request_info.content_type = getenv("CONTENT_TYPE"); - request_info.content_length = pa_atoui(getenv("CONTENT_LENGTH"), 10); + request_info.content_length = pa_atoul(getenv("CONTENT_LENGTH")); request_info.cookie = getenv("HTTP_COOKIE"); request_info.mail_received = mail_received; @@ -453,9 +456,8 @@ static void real_parser_handler(const ch { // initing ::request ptr for signal handlers RequestController rc(&request); - bool fail_on_config_read_problem=locate_config(); // process the request - request.core(config_filespec_cstr, fail_on_config_read_problem, strcasecmp(request_info.method, "HEAD")==0); + request.core(locate_config() ? config_filespec_cstr : NULL, strcasecmp(request_info.method, "HEAD")==0); // clearing ::request in RequestController destructor to prevent signal handlers from accessing invalid memory } @@ -505,7 +507,7 @@ static void usage(const char* program) { "Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)\n" "Author: Alexandr Petrosian (http://paf.design.ru)\n" "\n" - "Usage: %s [options] file\n" + "Usage: %s [options] [file]\n" "Options are:\n" #ifdef WITH_MAILRECEIVE " -m Parse mail, put received letter to $mail:received\n"