--- parser3/src/main/pa_request.C 2007/10/17 07:59:55 1.287 +++ parser3/src/main/pa_request.C 2008/06/11 11:38:41 1.296 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_REQUEST_C="$Date: 2007/10/17 07:59:55 $"; +static const char * const IDENT_REQUEST_C="$Date: 2008/06/11 11:38:41 $"; #include "pa_sapi.h" #include "pa_common.h" @@ -14,7 +14,7 @@ static const char * const IDENT_REQUEST_ #include "pa_vclass.h" #include "pa_globals.h" #include "pa_vint.h" -#include "pa_vmethod_frame.h" +#include "pa_vmethod_frame_global.h" #include "pa_types.h" #include "pa_venv.h" #include "pa_vmath.h" @@ -58,9 +58,10 @@ const char* ORIGINS_CONTENT_TYPE="text/p const String main_method_name(MAIN_METHOD_NAME); const String auto_method_name(AUTO_METHOD_NAME); +const String content_transfer_encoding_name(CONTENT_TRANSFER_ENCODING_NAME); const String content_disposition_name(CONTENT_DISPOSITION_NAME); const String content_disposition_inline(CONTENT_DISPOSITION_INLINE); -const String content_disposition_value(CONTENT_DISPOSITION_VALUE); +const String content_disposition_attachment(CONTENT_DISPOSITION_ATTACHMENT); const String content_disposition_filename_name(CONTENT_DISPOSITION_FILENAME_NAME); const String body_name(BODY_NAME); const String exception_type_part_name(EXCEPTION_TYPE_PART_NAME); @@ -159,7 +160,7 @@ Request::Request(SAPI_Info& asapi_info, if(status_allowed) classes().put(String::Body(STATUS_CLASS_NAME), new VStatus()); // request class - classes().put(String::Body(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets)); + classes().put(String::Body(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets, form)); // cookie class classes().put(String::Body(COOKIE_CLASS_NAME), &cookie); // console class @@ -404,7 +405,7 @@ gettimeofday(&mt[2],NULL); if(const Method *method=junction->method) { // preparing to pass parameters to // @postprocess[data] - VMethodFrame frame(/*method->name, */ *junction, 0/*no parent*/); + VMethodFrameGlobal frame(/*method->name, */ *junction, 0/*no parent*/); frame.set_self(main_class); frame.store_param(*body_value); @@ -466,7 +467,7 @@ t[9]-t[3] if(const Method *method=junction->method) { // preparing to pass parameters to // @unhandled_exception[exception;stack] - VMethodFrame frame(/*method->name, */ *junction, 0/*no caller*/); + VMethodFrameGlobal frame(/*method->name, */ *junction, 0/*no caller*/); frame.set_self(main_class); // $exception @@ -604,22 +605,27 @@ void Request::use_buf(VStateless_class& // temporary zero @auto so to maybe-replace it in compiled code Temp_method temp_method_auto(aclass, auto_method_name, 0); - // compile loaded class - VStateless_class& cclass=compile(&aclass, source, main_alias, file_no, line_no_offset); + // compile loaded classes + ArrayClass& cclasses=compile(&aclass, source, main_alias, file_no, line_no_offset); - // locate and execute possible @conf[] static VString* vfilespec= new VString(*new String(file_list[file_no], String::L_TAINTED)); - Execute_nonvirtual_method_result executed=execute_nonvirtual_method(cclass, - conf_method_name, vfilespec, - false/*no string result needed*/); - if(executed.method) - configure_admin(cclass/*, executed.method->name*/); - - // locate and execute possible @auto[] static - execute_nonvirtual_method(cclass, - auto_method_name, vfilespec, - false/*no result needed*/); + + for(size_t i=0; iname*/); + + // locate and execute possible @auto[] static + execute_nonvirtual_method(cclass, + auto_method_name, vfilespec, + false/*no result needed*/); + } } const String& Request::relative(const char* apath, const String& relative_name) { @@ -659,21 +665,21 @@ public: }; #endif static void add_header_attribute( - HashStringValue::key_type aattribute, - HashStringValue::value_type ameaning, + HashStringValue::key_type name, + HashStringValue::value_type value, Add_header_attribute_info* info) { - if(aattribute==BODY_NAME - || aattribute==DOWNLOAD_NAME - || aattribute==CHARSET_NAME) + if(name==BODY_NAME + || name==DOWNLOAD_NAME + || name==CHARSET_NAME) return; + + const char* aname=String(name, String::L_URI).cstr(String::L_UNSPECIFIED, 0, &info->r.charsets); - const char* a=aattribute.cstr(); SAPI::add_header_attribute(info->r.sapi_info, - a, - attributed_meaning_to_string(*ameaning, String::L_HTTP_HEADER, false). - cstr(String::L_UNSPECIFIED)); + aname, + attributed_meaning_to_string(*value, String::L_URI, false).cstr(String::L_UNSPECIFIED, 0, &info->r.charsets)); - if(strcasecmp(a, "last-modified")==0) + if(strcasecmp(aname, "last-modified")==0) info->add_last_modified = false; } @@ -841,7 +847,7 @@ void Request::output_result(VFile* body_ if(sfile_name!=NONAME_DAT) { VHash& hash=*new VHash(); HashStringValue &h=hash.hash(); - h.put(value_name, new VString( as_attachment ? content_disposition_value : content_disposition_inline )); + h.put(value_name, new VString( as_attachment ? content_disposition_attachment : content_disposition_inline )); h.put(content_disposition_filename_name, vfile_name); response.fields().put(content_disposition_name, &hash);