--- parser3/src/classes/file.C 2001/09/14 15:41:59 1.53 +++ parser3/src/classes/file.C 2001/10/29 13:04:45 1.61 @@ -2,12 +2,10 @@ Parser: @b file parser class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) - $Id: file.C,v 1.53 2001/09/14 15:41:59 parser Exp $ + $Id: file.C,v 1.61 2001/10/29 13:04:45 paf Exp $ */ -static const char *RCSId="$Id: file.C,v 1.53 2001/09/14 15:41:59 parser Exp $"; #include "pa_config_includes.h" @@ -122,7 +120,8 @@ static void _load(Request& r, const Stri file_read(pool, r.absolute(lfile_name), data, size, vmode_name.as_string()==TEXT_MODE_NAME); - char *user_file_name=params->size()>2?params->get(2).as_string().cstr() + char *user_file_name=params->size()>2? + params->as_string(2, "filename must be string").cstr(String::UL_FILE_SPEC) :lfile_name.cstr(String::UL_FILE_SPEC); static_cast(r.self)->set(true/*tainted*/, data, size, @@ -217,7 +216,7 @@ static void _exec_cgi(Request& r, const if(params->size()>1) { Value& venv=params->as_no_junction(1, "env must not be code"); - if(Hash *user_env=venv.get_hash()) + if(Hash *user_env=venv.get_hash(&method_name)) user_env->for_each(append_env_pair, &env); } @@ -225,10 +224,11 @@ static void _exec_cgi(Request& r, const if(params->size()>2) { argv=new(pool) Array(pool, params->size()-2); for(int i=2; isize(); i++) - *argv+=¶ms->get(i).as_string(); + *argv+=¶ms->as_string(i, "parameter must be string"); } - const String in(pool, r.post_data, r.post_size); + String in(pool); + in.APPEND(r.post_data, r.post_size, String::UL_CLEAN, "passing post data", 0); String out(pool); //out.APPEND_CONST("content-type:text/plain\nheader:test-header\n\ntest-body"); //out<mid(erroffset, regexp->size()), "regular expression syntax error - %s", errptr); @@ -339,7 +339,7 @@ static void _list(Request& r, const Stri suits=false; else if(exec_result<0) { (*pcre_free)(regexp_code); - PTHROW(0, 0, + throw Exception(0, 0, regexp, "regular expression execute (%d)", exec_result); @@ -362,6 +362,7 @@ static void _list(Request& r, const Stri if(regexp_code) (*pcre_free)(regexp_code); + // write out result VTable& result=*new(pool) VTable(pool, &table); result.set_name(method_name); r.write_no_lang(result);