--- parser3/src/targets/cgi/parser3.C 2016/11/28 00:37:16 1.274 +++ parser3/src/targets/cgi/parser3.C 2019/12/25 22:01:03 1.280 @@ -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.280 2019/12/25 22:01:03 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" @@ -28,7 +27,7 @@ volatile const char * IDENT_PARSER3_C="$ // comment remove me after debugging //#define PA_DEBUG_CGI_ENTRY_EXIT "c:\\parser\\debug-parser3.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,10 +361,8 @@ 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) @@ -519,11 +517,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 +564,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"