--- parser3/src/classes/file.C 2015/09/22 23:49:29 1.237 +++ parser3/src/classes/file.C 2016/07/21 18:30:10 1.243 @@ -1,7 +1,7 @@ /** @file Parser: @b file parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -25,7 +25,7 @@ #include "pa_vregex.h" #include "pa_version.h" -volatile const char * IDENT_FILE_C="$Id: file.C,v 1.237 2015/09/22 23:49:29 moko Exp $"; +volatile const char * IDENT_FILE_C="$Id: file.C,v 1.243 2016/07/21 18:30:10 moko Exp $"; // defines @@ -68,7 +68,7 @@ public: // global variable -DECLARE_CLASS_VAR(file, new MFile, 0); +DECLARE_CLASS_VAR(file, new MFile); // consts @@ -191,11 +191,7 @@ static void _move(Request& r, MethodPara keep_empty_dirs); } -static void copy_process_source( - struct stat& , - int from_file, - const String& , const char* /*fname*/, bool, - void *context) { +static void copy_process_source(struct stat& , int from_file, const String&, void *context) { int& to_file=*static_cast(context); int nCount=0; @@ -469,17 +465,10 @@ static void _exec_cgi(Request& r, Method const String& script_name=r.absolute(params.as_string(param_index++, FILE_NAME_MUST_NOT_BE_CODE)); HashStringString env; - #define ECSTR(name, value_cstr) \ - if(value_cstr) \ - env.put( \ - String::Body(#name), \ - String::Body(*value_cstr?value_cstr:0)); \ + #define ECSTR(name, value_cstr) if(value_cstr) env.put(#name, value_cstr); // passing environment for(SAPI::Env::Iterator i(r.sapi_info); i; i.next() ) - env.put( - i.key(), - i.value() - ); + env.put(i.key(), i.value() ); // const ECSTR(GATEWAY_INTERFACE, "CGI/1.1"); @@ -493,8 +482,7 @@ static void _exec_cgi(Request& r, Method ECSTR(CONTENT_TYPE, r.request_info.content_type); ECSTR(CONTENT_LENGTH, format(r.request_info.content_length, "%u")); // SCRIPT_* - env.put(String::Body("SCRIPT_NAME"), script_name); - //env.put(String::Body("SCRIPT_FILENAME"), ??&script_name); + env.put("SCRIPT_NAME", script_name); // environment & stdin from param String *in=new String(); @@ -666,9 +654,7 @@ static void _exec_cgi(Request& r, Method // $stderr if(!real_err->is_empty()) - self.fields().put( - String::Body("stderr"), - new VString(*real_err)); + self.fields().put("stderr", new VString(*real_err)); } static void _exec(Request& r, MethodParams& params) { _exec_cgi(r, params, false); @@ -1031,10 +1017,8 @@ static void _sql(Request& r, MethodParam handlers, statement_string); - if(!handlers.value) - throw Exception(PARSER_RUNTIME, - 0, - "produced no result"); + if(!handlers.value.str) + throw Exception(PARSER_RUNTIME, 0, "produced no result"); VFile& self=GET_SELF(r, VFile); @@ -1124,11 +1108,7 @@ static void _crc32(Request& r, MethodPar } -static void file_md5_file_action( - struct stat& finfo, - int f, - const String& , const char* /*fname*/, bool, - void *context) +static void file_md5_file_action(struct stat& finfo, int f, const String&, void *context) { PA_MD5_CTX& md5context=*static_cast(context); if(finfo.st_size) {