--- parser3/src/classes/file.C 2005/11/24 14:05:04 1.133.6.7 +++ parser3/src/classes/file.C 2005/11/21 12:50:23 1.138 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_FILE_C="$Date: 2005/11/24 14:05:04 $"; +static const char * const IDENT_FILE_C="$Date: 2005/11/21 12:50:23 $"; #include "pa_config_includes.h" @@ -45,7 +45,7 @@ extern String sql_offset_name; class MFile: public Methoded { public: // VStateless_class - Value* create_new_value(Pool&) { return new VFile(); } + Value* create_new_value(Pool&, HashStringValue&) { return new VFile(); } public: // Methoded bool used_directly() { return true; } @@ -259,9 +259,9 @@ static bool is_safe_env_key(const char* } #ifndef DOXYGEN struct Append_env_pair_info { - Request_charsets* charsets; HashStringString* env; Value* vstdin; + Value* vcharset; }; #endif static void append_env_pair( @@ -271,13 +271,13 @@ static void append_env_pair( if(akey==STDIN_EXEC_PARAM_NAME) { info->vstdin=avalue; } else if(akey==CHARSET_EXEC_PARAM_NAME) { - // ignore, already processed + info->vcharset=avalue; } else { if(!is_safe_env_key(akey.cstr())) throw Exception("parser.runtime", new String(akey, String::L_TAINTED), "not safe environment variable"); - info->env->put(akey, avalue->as_string().cstr_to_string_body(String::L_UNSPECIFIED, 0, info->charsets)); + info->env->put(akey, avalue->as_string().cstr_to_string_body(String::L_UNSPECIFIED)); } } #ifndef DOXYGEN @@ -348,19 +348,8 @@ static void _exec_cgi(Request& r, Method if(params.count()>1) { Value& venv=params.as_no_junction(1, "env must not be code"); if(HashStringValue* user_env=venv.get_hash()) { - // $.charset [previewing to handle URI pieces] - if(Value* vcharset=user_env->get(CHARSET_EXEC_PARAM_NAME)) - charset=&charsets.get(vcharset->as_string() - .change_case(r.charsets.source(), String::CC_UPPER)); - - // $.others - Append_env_pair_info info={&r.charsets, &env, 0}; - { - // influence URLencoding of tainted pieces to String::L_URI lang - // main target -- $.QUERY_STRING - Temp_client_charset temp(r.charsets, charset? *charset: r.charsets.source()); + Append_env_pair_info info={&env, 0, 0}; user_env->for_each(append_env_pair, &info); - } // $.stdin if(info.vstdin) { stdin_specified=true; @@ -374,6 +363,10 @@ static void _exec_cgi(Request& r, Method 0, STDIN_EXEC_PARAM_NAME " parameter must be string or file"); } + // $.charset + if(info.vcharset) + charset=&charsets.get(info.vcharset->as_string() + .change_case(r.charsets.source(), String::CC_UPPER)); } } @@ -595,7 +588,7 @@ static void _find(Request& r, MethodPara file_spec=&r.relative(r.request_info.uri, file_name); // easy way - if(file_exist(r.absolute(*file_spec))) { + if(file_readable(r.absolute(*file_spec))) { r.write_assign_lang(*file_spec); return; } @@ -610,7 +603,7 @@ static void _find(Request& r, MethodPara String test_name; test_name<<*(dirname=&dirname->mid(0, after_monkey_slash)); test_name<