--- parser3/src/main/pa_request.C 2012/05/24 12:50:20 1.331 +++ parser3/src/main/pa_request.C 2013/10/21 20:49:21 1.337 @@ -32,7 +32,7 @@ #include "pa_vconsole.h" #include "pa_vdate.h" -volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.331 2012/05/24 12:50:20 misha Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; +volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.337 2013/10/21 20:49:21 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; // consts @@ -102,9 +102,9 @@ Request::Request(SAPI_Info& asapi_info, String::Language adefault_lang): // private anti_endless_execute_recoursion(0), - anti_endless_json_string_recoursion(0), // public + allow_class_replace(false), method_frame(0), rcontext(0), wcontext(0), @@ -115,12 +115,6 @@ Request::Request(SAPI_Info& asapi_info, fin_cycle(0), // public -#ifdef RESOURCES_DEBUG - sql_connect_time(0), - sql_request_time(0), -#endif - - // public request_info(arequest_info), sapi_info(asapi_info), charsets(UTF8_charset, UTF8_charset, UTF8_charset), // default charsets @@ -251,6 +245,7 @@ void Request::configure_admin(VStateless } #ifdef STRICT_VARS + VVoid::strict_vars=false; if(Value* strict_vars=conf_class.get_element(strict_vars_name)) { if(strict_vars->is_bool()) VVoid::strict_vars=strict_vars->as_bool(); @@ -331,12 +326,6 @@ void Request::configure() { */ void Request::core(const char* config_filespec, bool config_fail_on_read_problem, bool header_only) { -#ifdef RESOURCES_DEBUG -//measures -struct timeval mt[10]; -//measure:before all -gettimeofday(&mt[0],NULL); -#endif try { // filling mail received mail.fill_received(*this); @@ -391,10 +380,6 @@ gettimeofday(&mt[0],NULL); rethrow; } -#ifdef RESOURCES_DEBUG -//measure:after compile -gettimeofday(&mt[1],NULL); -#endif // execute @main[] const String* body_string=execute_virtual_method(main_class, main_method_name); if(!body_string) @@ -402,11 +387,6 @@ gettimeofday(&mt[1],NULL); 0, "'"MAIN_METHOD_NAME"' method not found"); -#ifdef RESOURCES_DEBUG - //measure:after main -gettimeofday(&mt[2],NULL); -#endif - // extract response body Value* body_value=response.fields().get(download_name); // $response:download? bool as_attachment=body_value!=0; @@ -431,32 +411,9 @@ gettimeofday(&mt[2],NULL); VFile* body_file=body_value->as_vfile(flang, &charsets); -#ifdef RESOURCES_DEBUG -//measure:after postprocess -gettimeofday(&mt[3],NULL); -#endif - // OK. write out the result output_result(body_file, header_only, as_attachment); -#ifdef RESOURCES_DEBUG - //measure:after output_result -gettimeofday(&mt[9],NULL); -t[9]=mt[9].tv_sec+mt[9].tv_usec/1000000.0; - -double t[10]; -for(int i=0;i<10;i++) - t[i]=mt[i].tv_sec+mt[i].tv_usec/1000000.0; -//measure:log2 compile,main,postprocess,output -SAPI::log("rmeasure: %s,%.2f,%.2f,%.2f %.2f,%.2f %.2f", -request_info.uri, -t[1]-t[0], -t[2]-t[1], -t[3]-t[2], -sql_connect_time,sql_request_time, -t[9]-t[3] -); -#endif } catch(const Exception& e) { // request handling problem try { // we're returning not result, but error explanation @@ -657,6 +614,8 @@ void Request::use_buf(VStateless_class& execute_nonvirtual_method(cclass, auto_method_name, vfilespec, false/*no result needed*/); + + cclass.enable_default_setter(); } } @@ -1025,3 +984,19 @@ Request::Exception_details Request::get_ return Request::Exception_details(trace, problem_source, vhash); } + +Temp_value_element::Temp_value_element(Request& arequest, Value& awhere, const String& aname, Value* awhat) : + frequest(arequest), + fwhere(awhere), + fname(aname), + saved(awhere.get_element(aname)) +{ + Junction* junction; + if(saved && (junction=saved->get_junction()) && junction->is_getter) + saved=0; + frequest.put_element(fwhere, aname, awhat); +} + +Temp_value_element::~Temp_value_element() { + frequest.put_element(fwhere, fname, saved ? saved : VVoid::get()); +}