--- parser3/src/classes/file.C 2009/11/09 00:28:45 1.203 +++ parser3/src/classes/file.C 2010/07/05 05:54:46 1.207 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_FILE_C="$Date: 2009/11/09 00:28:45 $"; +static const char * const IDENT_FILE_C="$Date: 2010/07/05 05:54:46 $"; #include "pa_config_includes.h" @@ -115,7 +115,7 @@ static bool is_valid_mode (const String& return (mode==text_mode_name || mode==binary_mode_name); } -static bool is_text_mode(const String& mode) { +bool is_text_mode(const String& mode) { if(mode==text_mode_name) return true; if(mode==binary_mode_name) @@ -138,9 +138,7 @@ static void _save(Request& r, MethodPara valid_options++; } if(valid_options != options->count()) - throw Exception(PARSER_RUNTIME, - 0, - INVALID_OPTION_PASSED); + throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } // save @@ -301,7 +299,7 @@ static void _create(Request& r, MethodPa valid_options++; } if(valid_options != options->count()) - throw Exception(PARSER_RUNTIME, 0, INVALID_OPTION_PASSED); + throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } if(asked_charset != 0) @@ -344,6 +342,7 @@ static bool is_safe_env_key(const char* if(!(c>='A' && c<='Z' || c>='0' && c<='9' || c=='_' || c=='-')) return false; } +#ifdef PA_SAFE_MODE if(strncasecmp(key, "HTTP_", 5)==0) return true; if(strncasecmp(key, "CGI_", 4)==0) @@ -353,6 +352,9 @@ static bool is_safe_env_key(const char* return true; } return false; +#else + return true; +#endif } #ifndef DOXYGEN struct Append_env_pair_info { @@ -705,21 +707,6 @@ static void _lock(Request& r, MethodPara &info); } -static int lastposafter(const String& s, size_t after, const char* substr, size_t substr_size, bool beforelast=false) { - size_t size=0; // just to calm down compiler - if(beforelast) - size=s.length(); - size_t at; - while((at=s.pos(String::Body(substr), after))!=STRING_NOT_FOUND) { - size_t newafter=at+substr_size/*skip substr*/; - if(beforelast && newafter==size) - break; - after=newafter; - } - - return after; -} - static void _find(Request& r, MethodParams& params) { const String& file_name=params.as_no_junction(0, FILE_NAME_MUST_NOT_BE_CODE).as_string(); const String* file_spec; @@ -902,9 +889,7 @@ static void _sql(Request& r, MethodParam offset=(ulong)r.process_to_value(*voffset).as_double(); } if(valid_options!=options->count()) - throw Exception(PARSER_RUNTIME, - 0, - "called with invalid option"); + throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); }