|
|
| version 1.245.2.37.2.31, 2003/04/11 08:45:51 | version 1.251, 2003/10/02 07:26:47 |
|---|---|
| Line 132 Request::Request(SAPI_Info& asapi_info, | Line 132 Request::Request(SAPI_Info& asapi_info, |
| mime_types(0) | mime_types(0) |
| { | { |
| // file_no=0 => unknown | // file_no=0 => unknown |
| file_list+=StringBody("UNKNOWN"); | file_list+=String::Body("UNKNOWN"); |
| file_list+=StringBody("-body of process-"); // pseudo_file_no__process | file_list+=String::Body("-body of process-"); // pseudo_file_no__process |
| // maybe expire old caches | // maybe expire old caches |
| cache_managers.maybe_expire(); | cache_managers.maybe_expire(); |
| Line 147 Request::Request(SAPI_Info& asapi_info, | Line 147 Request::Request(SAPI_Info& asapi_info, |
| /// methodless | /// methodless |
| // env class | // env class |
| classes().put(StringBody(ENV_CLASS_NAME), new VEnv(asapi_info)); | classes().put(String::Body(ENV_CLASS_NAME), new VEnv(asapi_info)); |
| // status class | // status class |
| if(status_allowed) | if(status_allowed) |
| classes().put(StringBody(STATUS_CLASS_NAME), new VStatus()); | classes().put(String::Body(STATUS_CLASS_NAME), new VStatus()); |
| // request class | // request class |
| classes().put(StringBody(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets)); | classes().put(String::Body(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets)); |
| // cookie class | // cookie class |
| classes().put(StringBody(COOKIE_CLASS_NAME), &cookie); | classes().put(String::Body(COOKIE_CLASS_NAME), &cookie); |
| /// methoded | /// methoded |
| // response class | // response class |
| Line 192 Value& Request::get_self() { return meth | Line 192 Value& Request::get_self() { return meth |
| static void load_charset(HashStringValue::key_type akey, | static void load_charset(HashStringValue::key_type akey, |
| HashStringValue::value_type avalue, | HashStringValue::value_type avalue, |
| Request_charsets* charsets) { | Request_charsets* charsets) { |
| const StringBody NAME=String(akey, String::L_CLEAN).change_case(charsets->source(), String::CC_UPPER); | const String::Body NAME=String(akey, String::L_CLEAN).change_case(charsets->source(), String::CC_UPPER); |
| ::charsets.load_charset(*charsets, NAME, avalue->as_string()); | ::charsets.load_charset(*charsets, NAME, avalue->as_string()); |
| } | } |
| void Request::configure_admin(VStateless_class& conf_class) { | void Request::configure_admin(VStateless_class& conf_class) { |
| Line 332 gettimeofday(&mt[1],NULL); | Line 332 gettimeofday(&mt[1],NULL); |
| gettimeofday(&mt[2],NULL); | gettimeofday(&mt[2],NULL); |
| #endif | #endif |
| VString& body_vstring_before_post_process=*new VString(*body_string); | // extract response body |
| VString* body_vstring_after_post_process=&body_vstring_before_post_process; | Value* body_value=response.fields().get(download_name); // $response:download? |
| bool as_attachment=body_value!=0; | |
| if(!body_value) | |
| body_value=response.fields().get(body_name); // $response:body | |
| if(!body_value) | |
| body_value=new VString(*body_string); // just result of ^main[] | |
| // @postprocess | // @postprocess |
| if(Value* value=main_class.get_element(post_process_method_name, main_class, false)) | if(Value* value=main_class.get_element(post_process_method_name, main_class, false)) |
| if(Junction* junction=value->get_junction()) | if(Junction* junction=value->get_junction()) |
| Line 343 gettimeofday(&mt[2],NULL); | Line 349 gettimeofday(&mt[2],NULL); |
| VMethodFrame frame(/*method->name, */ *junction, 0/*no parent*/); | VMethodFrame frame(/*method->name, */ *junction, 0/*no parent*/); |
| frame.set_self(main_class); | frame.set_self(main_class); |
| frame.store_param(body_vstring_before_post_process); | frame.store_param(*body_value); |
| body_vstring_after_post_process= | body_value=&execute_method(frame, *method).as_value(); |
| new VString(execute_method(frame, *method)); | |
| } | } |
| VFile* body_file=body_vstring_after_post_process->as_vfile( | VFile* body_file=body_value->as_vfile( |
| String::L_UNSPECIFIED, &charsets); | String::L_UNSPECIFIED, &charsets); |
| // extract response body | |
| Value* body_value=response.fields().get(download_name); | |
| bool as_attachment=body_value!=0; | |
| if(!body_value) | |
| body_value=response.fields().get(body_name); | |
| if(body_value) // there is some $response:body | |
| body_file=body_value->as_vfile(String::L_UNSPECIFIED, &charsets); | |
| #ifdef RESOURCES_DEBUG | #ifdef RESOURCES_DEBUG |
| //measure:after postprocess | //measure:after postprocess |
| gettimeofday(&mt[3],NULL); | gettimeofday(&mt[3],NULL); |
| Line 456 Table::columns_type stack_trace_columns( | Line 452 Table::columns_type stack_trace_columns( |
| *stack_trace_columns+=new String("colno"); | *stack_trace_columns+=new String("colno"); |
| Table& stack_trace=*new Table(stack_trace_columns); | Table& stack_trace=*new Table(stack_trace_columns); |
| if(!exception_trace.is_empty()/*signed!*/) | if(!exception_trace.is_empty()/*signed!*/) |
| for(size_t i=exception_trace.bottom_index(); i<=exception_trace.top_index(); i++) { | for(size_t i=exception_trace.bottom_index(); i<exception_trace.top_index(); i++) { |
| Trace trace=exception_trace.get(i); | Trace trace=exception_trace.get(i); |
| Table::element_type row(new ArrayString); | Table::element_type row(new ArrayString); |
| Line 464 if(!exception_trace.is_empty()/*signed!* | Line 460 if(!exception_trace.is_empty()/*signed!* |
| Operation::Origin origin=trace.origin(); | Operation::Origin origin=trace.origin(); |
| if(origin.file_no) { | if(origin.file_no) { |
| *row+=new String(file_list[origin.file_no], String::L_TAINTED); // 'file' column | *row+=new String(file_list[origin.file_no], String::L_TAINTED); // 'file' column |
| *row+=new String(StringBody::Format(1+origin.line), String::L_CLEAN); // 'lineno' column | *row+=new String(String::Body::Format(1+origin.line), String::L_CLEAN); // 'lineno' column |
| *row+=new String(StringBody::Format(1+origin.col), String::L_CLEAN); // 'colno' column | *row+=new String(String::Body::Format(1+origin.col), String::L_CLEAN); // 'colno' column |
| } | } |
| stack_trace+=row; | stack_trace+=row; |
| } | } |
| Line 473 frame.store_param(*new VTable(&stack_tra | Line 469 frame.store_param(*new VTable(&stack_tra |
| // future $response:body= | // future $response:body= |
| // execute ^unhandled_exception[exception;stack] | // execute ^unhandled_exception[exception;stack] |
| body_string=&execute_method(frame, *method); | body_string=&execute_method(frame, *method).as_string(); |
| } | } |
| } | } |
| } | } |
| Line 518 body_string=&execute_method(frame, *meth | Line 514 body_string=&execute_method(frame, *meth |
| } | } |
| } | } |
| size_t Request::register_file(StringBody file_spec) { | size_t Request::register_file(String::Body file_spec) { |
| file_list+=file_spec; | file_list+=file_spec; |
| return file_list.count()-1; | return file_list.count()-1; |
| } | } |
| Line 615 const String& Request::absolute(const St | Line 611 const String& Request::absolute(const St |
| result << relative_name; | result << relative_name; |
| return result; | return result; |
| } else | } else |
| return relative_name.pos("://")==STRING_NOT_FOUND? | if(relative_name.pos("://")!=STRING_NOT_FOUND // something like "http://xxx" |
| relative(request_info.path_translated, relative_name) | #ifdef WIN32 |
| :relative_name; // something like "http://xxx" | || relative_name.pos(":")==1 // DRIVE: |
| || relative_name.starts_with("\\\\") // UNC1 | |
| || relative_name.starts_with("//") // UNC2 | |
| #endif | |
| ) | |
| return relative_name; | |
| else | |
| return relative(request_info.path_translated, relative_name); | |
| } | } |
| static void add_header_attribute( | static void add_header_attribute( |
| Line 690 const String& Request::mime_type_of(cons | Line 693 const String& Request::mime_type_of(cons |
| if(mime_types) | if(mime_types) |
| if(const char* cext=strrchr(user_file_name_cstr, '.')) { | if(const char* cext=strrchr(user_file_name_cstr, '.')) { |
| String sext(++cext); | String sext(++cext); |
| if(mime_types->locate(0, sext.change_case(charsets.source(), String::CC_LOWER))) | Table::Action_options options; |
| if(mime_types->locate(0, sext.change_case(charsets.source(), String::CC_LOWER), options)) | |
| if(const String* result=mime_types->item(1)) | if(const String* result=mime_types->item(1)) |
| return *result; | return *result; |
| else | else |
| Line 707 GdomeDOMString_auto_ptr Request::transco | Line 711 GdomeDOMString_auto_ptr Request::transco |
| return charsets.source().transcode(s); | return charsets.source().transcode(s); |
| } | } |
| GdomeDOMString_auto_ptr Request::transcode(const StringBody s) { | GdomeDOMString_auto_ptr Request::transcode(const String::Body s) { |
| return charsets.source().transcode(s); | return charsets.source().transcode(s); |
| } | } |
| Line 759 Request::Exception_details Request::get_ | Line 763 Request::Exception_details Request::get_ |
| // $.file lineno colno | // $.file lineno colno |
| if(trace) { | if(trace) { |
| const Operation::Origin origin=trace.origin(); | const Operation::Origin origin=trace.origin(); |
| hash.put(StringBody("file"), | hash.put(String::Body("file"), |
| new VString(*new String(file_list[origin.file_no], String::L_TAINTED))); | new VString(*new String(file_list[origin.file_no], String::L_TAINTED))); |
| hash.put(StringBody("lineno"), new VInt(1+origin.line)); | hash.put(String::Body("lineno"), new VInt(1+origin.line)); |
| hash.put(StringBody("colno"), new VInt(1+origin.col)); | hash.put(String::Body("colno"), new VInt(1+origin.col)); |
| } | } |
| // $.comment | // $.comment |