--- parser3/src/classes/file.C 2003/03/24 09:39:53 1.107.2.16.2.6 +++ parser3/src/classes/file.C 2003/03/24 17:12:33 1.107.2.16.2.10 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_FILE_C="$Date: 2003/03/24 09:39:53 $"; +static const char* IDENT_FILE_C="$Date: 2003/03/24 17:12:33 $"; #include "pa_config_includes.h" @@ -213,7 +213,7 @@ static void append_env_pair( throw Exception("parser.runtime", new String(akey, String::L_TAINTED), "not safe environment variable"); - info->env->put(akey, &(StringBody)avalue->as_string()); + info->env->put(akey, avalue->as_string()); } } #ifndef DOXYGEN @@ -224,10 +224,10 @@ struct Pass_cgi_header_attribute_info { }; #endif static void pass_cgi_header_attribute( - ArrayString::element_type astring, - Pass_cgi_header_attribute_info* info) { - int colon_pos=astring->pos(":", 1); - if(colon_pos>0) { + ArrayString::element_type astring, + Pass_cgi_header_attribute_info* info) { + size_t colon_pos=astring->pos(':'); + if(colon_pos==STRING_NOT_FOUND) { const String& key=astring->mid(0, colon_pos).change_case( *info->charset, String::CC_UPPER); Value* value=new VString(astring->mid(colon_pos+1, astring->length())); @@ -248,15 +248,15 @@ static void _exec_cgi(Request& r, Method #define ECSTR(name, value_cstr) \ if(value_cstr) \ env.put( \ - *new StringBody(#name), \ - new StringBody(value_cstr)); \ + StringBody(#name), \ + StringBody(value_cstr)); \ // passing SAPI::environment if(const char *const *pairs=SAPI::environment(r.sapi_info)) { while(const char* pair=*pairs++) if(const char* eq_at=strchr(pair, '=')) env.put( - *new StringBody(pair, eq_at-pair), - new StringBody(eq_at+1)); + StringBody(pair, eq_at-pair), + StringBody(eq_at+1)); } // const @@ -273,8 +273,8 @@ static void _exec_cgi(Request& r, Method //String content_length(content_length_cstr); ECSTR(CONTENT_LENGTH, content_length_cstr); // SCRIPT_* - env.put(*new StringBody("SCRIPT_NAME"), &(StringBody)script_name); - //env.put(*new String("SCRIPT_FILENAME"), ??&script_name); + env.put(StringBody("SCRIPT_NAME"), script_name); + //env.put(StringBody("SCRIPT_FILENAME"), ??&script_name); bool stdin_specified=false; // environment & stdin from param @@ -323,11 +323,11 @@ static void _exec_cgi(Request& r, Method const String* header=0; if(cgi) { // ^file:cgi // construct with 'out' body and header - int dos_pos=execution.out.pos("\r\n\r\n", 4); - int unix_pos=execution.out.pos("\n\n", 2); + size_t dos_pos=execution.out.pos("\r\n\r\n", 4); + size_t unix_pos=execution.out.pos("\n\n", 2); bool unix_header_break; - switch((dos_pos >= 0?10:00) + (unix_pos >= 0?01:00)) { + switch((dos_pos!=STRING_NOT_FOUND?10:00) + (unix_pos!=STRING_NOT_FOUND?01:00)) { case 10: // dos unix_header_break=false; break; @@ -383,7 +383,7 @@ static void _exec_cgi(Request& r, Method // $stderr if(execution.err.length()) self.fields().put( - *new StringBody("stderr"), + StringBody("stderr"), new VString(execution.err)); } static void _exec(Request& r, MethodParams* params) {