|
|
| version 1.76, 2002/03/26 13:08:30 | version 1.78, 2002/03/27 15:30:34 |
|---|---|
| Line 59 static void _untaint(Request& r, const S | Line 59 static void _untaint(Request& r, const S |
| const String& lang_name=params->as_string(0, "lang must be string"); | const String& lang_name=params->as_string(0, "lang must be string"); |
| lang=untaint_lang_name2enum->get_int(lang_name); | lang=untaint_lang_name2enum->get_int(lang_name); |
| if(!lang) | if(!lang) |
| throw Exception(0, 0, | throw Exception(0, |
| &lang_name, | &lang_name, |
| "invalid taint language"); | "invalid taint language"); |
| } | } |
| Line 82 static void _taint(Request& r, const Str | Line 82 static void _taint(Request& r, const Str |
| const String& lang_name=params->as_string(0, "lang must be string"); | const String& lang_name=params->as_string(0, "lang must be string"); |
| lang=untaint_lang_name2enum->get_int(lang_name); | lang=untaint_lang_name2enum->get_int(lang_name); |
| if(!lang) | if(!lang) |
| throw Exception(0, 0, | throw Exception(0, |
| &lang_name, | &lang_name, |
| "invalid taint language"); | "invalid taint language"); |
| } | } |
| Line 157 static void _while(Request& r, const Str | Line 157 static void _while(Request& r, const Str |
| int endless_loop_count=0; | int endless_loop_count=0; |
| while(true) { | while(true) { |
| if(++endless_loop_count>=MAX_LOOPS) // endless loop? | if(++endless_loop_count>=MAX_LOOPS) // endless loop? |
| throw Exception(0, 0, | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| "endless loop detected"); | "endless loop detected"); |
| Line 188 static void _for(Request& r, const Strin | Line 188 static void _for(Request& r, const Strin |
| Value *delim_maybe_code=params->size()>4?¶ms->get(4):0; | Value *delim_maybe_code=params->size()>4?¶ms->get(4):0; |
| if(to-from>=MAX_LOOPS) // too long loop? | if(to-from>=MAX_LOOPS) // too long loop? |
| throw Exception(0, 0, | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| "endless loop detected"); | "endless loop detected"); |
| Line 291 static void _case(Request& r, const Stri | Line 291 static void _case(Request& r, const Stri |
| Switch_data *data=static_cast<Switch_data *>(r.classes_conf.get(*switch_data_name)); | Switch_data *data=static_cast<Switch_data *>(r.classes_conf.get(*switch_data_name)); |
| if(!data) | if(!data) |
| throw Exception(0, 0, | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| "without switch"); | "without switch"); |
| Line 459 static void _cache(Request& r, const Str | Line 459 static void _cache(Request& r, const Str |
| retry=0; // prolonging our wait, than could cache_get it, without processing body_code | retry=0; // prolonging our wait, than could cache_get it, without processing body_code |
| } | } |
| } | } |
| throw Exception(0, 0, | throw Exception(0, |
| &file_spec, | &file_spec, |
| "locking problem"); | "locking problem"); |
| } else { | } else { |
| Line 479 static void _cache(Request& r, const Str | Line 479 static void _cache(Request& r, const Str |
| VHash& exception2vhash(Pool& pool, const Exception& e) { | VHash& exception2vhash(Pool& pool, const Exception& e) { |
| VHash& result=*new(pool) VHash(pool); | VHash& result=*new(pool) VHash(pool); |
| Hash& hash=result.hash(0); | Hash& hash=result.hash(0); |
| if(const String *type=e.type()) | if(const char *type=e.type()) |
| hash.put(*exception_type_part_name, new(pool) VString(*type)); | hash.put(*exception_type_part_name, new(pool) VString(*new(pool) String(pool, type))); |
| if(const String *asource=e.problem_source()) { | if(const String *asource=e.problem_source()) { |
| String& source=*new(pool) String(pool); | String& source=*new(pool) String(pool); |
| source.append(*asource, String::UL_TAINTED, true/*forced*/); | source.append(*asource, String::UL_TAINTED, true/*forced*/); |
| Line 517 static void _try_operator(Request& r, co | Line 517 static void _try_operator(Request& r, co |
| Value *result; | Value *result; |
| // taking snapshot of request processing status | // taking snapshot of request processing status |
| int stop_index=r.stack.top_index(); | //int ssexception_trace=r.exception_trace.top_index(); |
| int sstack=r.stack.top_index(); | |
| Value *sself=r.self, *sroot=r.root, *srcontext=r.rcontext; | Value *sself=r.self, *sroot=r.root, *srcontext=r.rcontext; |
| WContext *swcontext=r.wcontext; | WContext *swcontext=r.wcontext; |
| try { | try { |
| result=&r.process(body_code); | result=&r.process(body_code); |
| } catch(const Exception& e) { | } catch(const Exception& e) { |
| // restoring request processing status | // restoring request processing status |
| r.stack.top_index(stop_index); | //r.exception_trace.top_index(ssexception_trace); |
| r.stack.top_index(sstack); | |
| r.self=sself; r.root=sroot, r.rcontext=srcontext; r.wcontext=swcontext; | r.self=sself; r.root=sroot, r.rcontext=srcontext; r.wcontext=swcontext; |
| VHash& vhash=exception2vhash(pool, e); | VHash& vhash=exception2vhash(pool, e); |
| Junction *junction=catch_code.get_junction(); | Junction *junction=catch_code.get_junction(); |
| Line 551 static void _throw_operator(Request& r, | Line 554 static void _throw_operator(Request& r, |
| if(params->size()==1) { | if(params->size()==1) { |
| Value& param0=params->get(0); | Value& param0=params->get(0); |
| if(Hash *hash=param0.get_hash(&method_name)) { | if(Hash *hash=param0.get_hash(&method_name)) { |
| const String *type=0; | const char *type=0; |
| if(Value *value=static_cast<Value *>(hash->get(*exception_type_part_name))) | if(Value *value=static_cast<Value *>(hash->get(*exception_type_part_name))) |
| type=&value->as_string(); | type=value->as_string().cstr(); |
| const String *source=0; | const String *source=0; |
| if(Value *value=static_cast<Value *>(hash->get(*exception_source_part_name))) | if(Value *value=static_cast<Value *>(hash->get(*exception_source_part_name))) |
| source=&value->as_string(); | source=&value->as_string(); |
| Line 562 static void _throw_operator(Request& r, | Line 565 static void _throw_operator(Request& r, |
| static_cast<Value *>(hash->get(*exception_comment_part_name))) | static_cast<Value *>(hash->get(*exception_comment_part_name))) |
| comment=value->as_string().cstr(); | comment=value->as_string().cstr(); |
| throw Exception(type, 0, | throw Exception(type, |
| source?source:&method_name, | source?source:&method_name, |
| comment); | comment); |
| } else | } else |
| throw Exception(0, 0, | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| "one-param version has hash param"); | "one-param version has hash param"); |
| } else { | } else { |
| const String& type=params->as_string(0, "type must be string"); | const char *type=params->as_string(0, "type must be string").cstr(); |
| const String& source=params->as_string(1, "source must be string"); | const String& source=params->as_string(1, "source must be string"); |
| const char *comment=params->as_string(2, "comment must be string").cstr(); | const char *comment=params->as_string(2, "comment must be string").cstr(); |
| throw Exception(&type, 0, | throw Exception(type, &source, comment); |
| &source, | |
| comment); | |
| } | } |
| } | } |