|
|
| version 1.71, 2002/02/08 07:27:40 | version 1.76, 2002/04/15 11:34:24 |
|---|---|
| Line 2 | Line 2 |
| Parser: @b file parser class. | Parser: @b file parser class. |
| Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| $Id$ | $Id$ |
| */ | */ |
| Line 85 static void _find(Request& r, const Stri | Line 85 static void _find(Request& r, const Stri |
| // passed file name simply exists in current dir | // passed file name simply exists in current dir |
| if(file_readable(r.absolute(lfile_name))) { | if(file_readable(r.absolute(lfile_name))) { |
| r.write_no_lang(*new(pool) VString(lfile_name)); | r.write_no_lang(lfile_name); |
| return; | return; |
| } | } |
| // scan .. dirs for result | // scan .. dirs for result |
| for(int i=0; i<FIND_MONKEY_MAX_HOPS; i++) { | for(int i=0; i<FIND_MONKEY_MAX_HOPS; i++) { |
| String test_name(pool); | String local_test_name(pool); |
| for(int j=0; j<i; j++) | for(int j=0; j<i; j++) |
| test_name.APPEND_CONST("../"); | local_test_name.APPEND_CONST("../"); |
| test_name.append(lfile_name, String::UL_CLEAN); | local_test_name.append(lfile_name, String::UL_CLEAN); |
| if(file_readable(r.absolute(test_name))) { | if(file_readable(r.absolute(local_test_name))) { |
| r.write_no_lang(*new(pool) VString(*new(pool) String(test_name))); | r.write_no_lang(*new(pool) String(local_test_name)); |
| return; | return; |
| } | } |
| } | } |
| Line 104 static void _find(Request& r, const Stri | Line 104 static void _find(Request& r, const Stri |
| // not found | // not found |
| if(params->size()==2) { | if(params->size()==2) { |
| Value& not_found_code=params->as_junction(1, "not-found param must be code"); | Value& not_found_code=params->as_junction(1, "not-found param must be code"); |
| r.write_pass_lang(r.process(not_found_code)); | r.write_pass_lang(r.process_to_value(not_found_code)); |
| } | } |
| } | } |
| Line 236 static void _exec_cgi(Request& r, const | Line 236 static void _exec_cgi(Request& r, const |
| //out.APPEND_CONST("content-type:text/plain\nheader:test-header\n\ntest-body"); | //out.APPEND_CONST("content-type:text/plain\nheader:test-header\n\ntest-body"); |
| //out<<in; | //out<<in; |
| String& err=*new(pool) String(pool); | String& err=*new(pool) String(pool); |
| int status=pa_exec(script_name, &env, argv, in, out, err); | int status=pa_exec(false/*forced_allow*/, script_name, &env, argv, in, out, err); |
| VFile& self=*static_cast<VFile *>(r.self); | VFile& self=*static_cast<VFile *>(r.self); |
| Line 252 static void _exec_cgi(Request& r, const | Line 252 static void _exec_cgi(Request& r, const |
| } | } |
| if(pos<0) { | if(pos<0) { |
| delim_size=0; // calm down, compiler | delim_size=0; // calm down, compiler |
| throw Exception(0, 0, | throw Exception(0, |
| &method_name, | &method_name, |
| "output does not contain CGI header; exit code=%d; outsize=%u; out: \"%s\"; errsize=%u; err: \"%s\"", | "output does not contain CGI header; exit code=%d; outsize=%u; out: \"%s\"; errsize=%u; err: \"%s\"", |
| status, | status, |
| Line 314 static void _list(Request& r, const Stri | Line 314 static void _list(Request& r, const Stri |
| pool.get_client_charset().pcre_tables); | pool.get_client_charset().pcre_tables); |
| if(!regexp_code) | if(!regexp_code) |
| throw Exception(0, 0, | throw Exception(0, |
| ®exp->mid(erroffset, regexp->size()), | ®exp->mid(erroffset, regexp->size()), |
| "regular expression syntax error - %s", errptr); | "regular expression syntax error - %s", errptr); |
| Line 342 static void _list(Request& r, const Stri | Line 342 static void _list(Request& r, const Stri |
| suits=false; | suits=false; |
| else if(exec_result<0) { | else if(exec_result<0) { |
| (*pcre_free)(regexp_code); | (*pcre_free)(regexp_code); |
| throw Exception(0, 0, | throw Exception(0, |
| regexp, | regexp, |
| "regular expression execute (%d)", | "regular expression execute (%d)", |
| exec_result); | exec_result); |
| Line 381 static void lock_execute_body(int , void | Line 381 static void lock_execute_body(int , void |
| Lock_execute_body_info& info=*static_cast<Lock_execute_body_info *>(context); | Lock_execute_body_info& info=*static_cast<Lock_execute_body_info *>(context); |
| // execute body | // execute body |
| info.r->write_assign_lang(info.r->process(*info.body_code)); | info.r->write_assign_lang(info.r->process_to_string(*info.body_code)); |
| }; | }; |
| static void _lock(Request& r, const String& method_name, MethodParams *params) { | static void _lock(Request& r, const String& method_name, MethodParams *params) { |
| const String& file_spec=r.absolute(params->as_string(0, "file name must be string")); | const String& file_spec=r.absolute(params->as_string(0, "file name must be string")); |