--- parser3/src/main/pa_request.C 2003/03/24 13:43:41 1.245.2.37.2.11 +++ parser3/src/main/pa_request.C 2003/03/27 14:51:28 1.245.2.37.2.18 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_REQUEST_C="$Date: 2003/03/24 13:43:41 $"; +static const char* IDENT_REQUEST_C="$Date: 2003/03/27 14:51:28 $"; #include "pa_sapi.h" #include "pa_common.h" @@ -30,6 +30,7 @@ static const char* IDENT_REQUEST_C="$Dat #include "pa_vform.h" #include "pa_vcookie.h" #include "pa_vresponse.h" +#include "pa_vmemory.h" // consts @@ -96,7 +97,7 @@ Request::Request(SAPI_Info& asapi_info, rcontext(0), wcontext(0), flang(adefault_lang), - fconnection(), + fconnection(0), finterrupted(false), // public @@ -159,6 +160,11 @@ Request::Request(SAPI_Info& asapi_info, Value& math=*new VMath; classes().put(math.get_class()->base_class()->name(), &math); } + // memory class + { + Value& memory=*new VMemory; + classes().put(memory.get_class()->base_class()->name(), &memory); + } } Request::~Request() { @@ -250,7 +256,7 @@ gettimeofday(&mt[0],NULL); while(const char* before=strchr(after, '/')) { String& sfile_spec=*new String; if(after!=request_info.path_translated) { - sfile_spec.append( + sfile_spec.append_strdup( request_info.path_translated, before-request_info.path_translated, String::L_CLEAN); sfile_spec << "/" AUTO_FILE_NAME; @@ -265,7 +271,7 @@ gettimeofday(&mt[0],NULL); // compile requested file String& spath_translated=*new String; - spath_translated.append(request_info.path_translated, 0, String::L_TAINTED); + spath_translated.append_help_length(request_info.path_translated, 0, String::L_TAINTED); use_file(main_class, spath_translated, true/* ignore class_path */, true/* fail on read problem*/, true/* fail on abscence */); @@ -324,7 +330,7 @@ gettimeofday(&mt[2],NULL); } VFile* body_file=body_vstring_after_post_process->as_vfile( - String::L_UNSPECIFIED); + String::L_UNSPECIFIED, &charsets); // extract response body Value* body_value=response.fields().get(download_name); @@ -333,7 +339,7 @@ gettimeofday(&mt[2],NULL); body_value=response.fields().get(body_name); if(body_value) // there is some $response:body - body_file=body_value->as_vfile(); + body_file=body_value->as_vfile(String::L_UNSPECIFIED, &charsets); #ifdef RESOURCES_DEBUG //measure:after postprocess @@ -468,7 +474,7 @@ t[9]-t[3] } VString body_vstring(*body_string); - VFile* body_file=body_vstring.as_vfile(); + VFile* body_file=body_vstring.as_vfile(String::L_UNSPECIFIED, &charsets); // ERROR. write it out output_result(body_file, header_only, false); @@ -567,7 +573,8 @@ const String& Request::absolute(const St result << relative_name; return result; } else - return relative_name.pos("://")<0? relative(request_info.path_translated, relative_name) + return relative_name.pos("://")==STRING_NOT_FOUND? + relative(request_info.path_translated, relative_name) :relative_name; // something like "http://xxx" } @@ -660,32 +667,19 @@ const String& Request::mime_type_of(cons } #ifdef XML - GdomeDOMString_auto_ptr Request::transcode(const String& s) { return charsets.source().transcode(s); } -const String& Request::transcode(GdomeDOMString* s -#ifndef NO_STRING_ORIGIN - , const String& origin -#endif - ) { - return charsets.source().transcode(s -#ifndef NO_STRING_ORIGIN - , origin -#endif - ); +GdomeDOMString_auto_ptr Request::transcode(const StringBody s) { + return charsets.source().transcode(s); } -const String& Request::transcode(xmlChar* s -#ifndef NO_STRING_ORIGIN - , const String& origin -#endif - ) { - return charsets.source().transcode(s -#ifndef NO_STRING_ORIGIN - , origin -#endif - ); +const String& Request::transcode(GdomeDOMString* s) { + return charsets.source().transcode(s); +} + +const String& Request::transcode(xmlChar* s) { + return charsets.source().transcode(s); } #endif