--- parser3/src/targets/cgi/parser3.C 2016/11/28 00:37:16 1.274 +++ parser3/src/targets/cgi/parser3.C 2019/12/27 13:48:47 1.282 @@ -1,11 +1,11 @@ /** @file Parser: scripting and CGI main. - Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.274 2016/11/28 00:37:16 moko Exp $"; +volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.282 2019/12/27 13:48:47 moko Exp $"; #include "pa_config_includes.h" @@ -13,7 +13,6 @@ volatile const char * IDENT_PARSER3_C="$ #include "classes.h" #include "pa_common.h" #include "pa_request.h" -#include "pa_socks.h" #include "pa_version.h" #include "pa_vconsole.h" @@ -26,9 +25,9 @@ volatile const char * IDENT_PARSER3_C="$ // defines // comment remove me after debugging -//#define PA_DEBUG_CGI_ENTRY_EXIT "c:\\parser\\debug-parser3.log" +//#define PA_DEBUG_CGI_ENTRY_EXIT "parser3-debug.log" -#if _MSC_VER && !defined(_DEBUG) +#if defined(_MSC_VER) && !defined(_DEBUG) # define PA_SUPPRESS_SYSTEM_EXCEPTION #endif @@ -58,7 +57,8 @@ bool execution_canceled=false; // SAPI -struct SAPI_Info { +class SAPI_Info { +public: int http_response_code; } SAPI_info = { 0 }; @@ -257,9 +257,9 @@ static void full_file_spec(const char* f #ifdef WIN32 || file_name[0] && file_name[1]==':' #endif - ) - strncpy(buf, file_name, buf_size); - else { + ){ + strncpy(buf, file_name, buf_size-1); buf[buf_size-1]=0; + } else { char cwd[MAX_STRING]; snprintf(buf, buf_size, "%s/%s", getcwd(cwd, MAX_STRING) ? cwd : "", file_name); } @@ -301,7 +301,7 @@ static void SIGPIPE_handler(int /*sig*/) execution_canceled=true; if(request) - request->set_interrupted(true); + request->set_skip(Request::SKIP_INTERRUPTED); } #endif @@ -361,18 +361,12 @@ main workhorse wich is tested but seems slow. */ static void real_parser_handler(const char* filespec_to_process, const char* request_method, bool header_only) { - // init socks - pa_socks_init(); - // init global variables + // init libraries pa_globals_init(); if(!filespec_to_process || !*filespec_to_process) - SAPI::die("Parser/%s" -#ifdef PA_DEBUG_CGI_ENTRY_EXIT - " with entry/exit tracing" -#endif - , PARSER_VERSION); + SAPI::die("Parser/%s", PARSER_VERSION); // Request info Request_info request_info; memset(&request_info, 0, sizeof(request_info)); @@ -519,11 +513,8 @@ static void real_parser_handler(const ch // ::request cleared in RequestController desctructor to prevent signal handlers from accessing invalid memory } - // finalize global variables + // finalize libraries pa_globals_done(); - - // - pa_socks_done(); } #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION @@ -569,7 +560,7 @@ static void call_real_parser_handler__su static void usage(const char* program) { printf( "Parser/%s\n" - "Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)\n" + "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" @@ -589,14 +580,6 @@ int main(int argc, char *argv[]) { log("main: entry"); #endif -#ifndef PA_DEBUG_DISABLE_GC - GC_java_finalization=0; - // Dont collect unless explicitly requested - // this is quicker (~30% ), but less memory-efficient(~8%) - // so deciding for speed - GC_dont_gc=1; -#endif - #ifdef SIGUSR1 if(signal(SIGUSR1, SIGUSR1_handler)==SIG_ERR) SAPI::die("Can not set handler for SIGUSR1");