--- parser3/src/main/pa_request.C 2013/10/21 20:49:21 1.337 +++ parser3/src/main/pa_request.C 2015/04/08 18:08:53 1.342 @@ -32,7 +32,7 @@ #include "pa_vconsole.h" #include "pa_vdate.h" -volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.337 2013/10/21 20:49:21 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; +volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.342 2015/04/08 18:08:53 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; // consts @@ -156,7 +156,7 @@ Request::Request(SAPI_Info& asapi_info, // status class classes().put(String::Body(STATUS_CLASS_NAME), new VStatus()); // request class - classes().put(String::Body(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets, form)); + classes().put(String::Body(REQUEST_CLASS_NAME), new VRequest(arequest_info, charsets, form, asapi_info)); // cookie class classes().put(String::Body(COOKIE_CLASS_NAME), &cookie); // console class @@ -187,7 +187,7 @@ Request::~Request() { // if for some strange reason xml generic errors failed to be reported, free them up if(const char* xml_generic_errors=xmlGenericErrors()) { SAPI::log(sapi_info, "warning: unreported xmlGenericErrors: %s", xml_generic_errors); - free((void *)xml_generic_errors); + pa_free((void *)xml_generic_errors); } #endif } @@ -235,13 +235,14 @@ void Request::configure_admin(VStateless ] */ if(Value* vcharsets=conf_class.get_element(charsets_name)) { - if(!vcharsets->is_string()) + if(!vcharsets->is_string()) { if(HashStringValue* charsets=vcharsets->get_hash()) charsets->for_each(load_charset, &this->charsets); else throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":" CHARSETS_NAME " must be hash"); + } } #ifdef STRICT_VARS @@ -327,9 +328,6 @@ void Request::configure() { */ void Request::core(const char* config_filespec, bool config_fail_on_read_problem, bool header_only) { try { - // filling mail received - mail.fill_received(*this); - // loading config if(config_filespec) { const String& filespec=*new String(config_filespec); @@ -339,6 +337,9 @@ void Request::core(const char* config_fi true /*file must exist if 'fail on read problem' not set*/); } + // filling mail received + mail.fill_received(*this); + // loading auto.p files from document_root/.. // to the one beside requested file. // all assigned bases from upper dir @@ -385,7 +386,7 @@ void Request::core(const char* config_fi if(!body_string) throw Exception(PARSER_RUNTIME, 0, - "'"MAIN_METHOD_NAME"' method not found"); + "'" MAIN_METHOD_NAME "' method not found"); // extract response body Value* body_value=response.fields().get(download_name); // $response:download? @@ -620,7 +621,7 @@ void Request::use_buf(VStateless_class& } const String& Request::relative(const char* apath, const String& relative_name) { - char *hpath=strdup(apath); + char *hpath=pa_strdup(apath); String& result=*new String; if(rsplit(hpath, '/')) // if something/splitted result << hpath << "/"; @@ -630,7 +631,7 @@ const String& Request::relative(const ch const String& Request::absolute(const String& relative_name) { if(relative_name.first_char()=='/') { - String& result=*new String(strdup(request_info.document_root)); + String& result=*new String(pa_strdup(request_info.document_root)); result << relative_name; return result; } else @@ -737,7 +738,7 @@ static void output_pieces(Request& r, const size_t BUFSIZE = 10*0x400; char buf[BUFSIZE]; - const char *range = SAPI::get_env(r.sapi_info, "HTTP_RANGE"); + const char *range = SAPI::Env::get(r.sapi_info, "HTTP_RANGE"); size_t offset=0; size_t part_length=content_length; if(range){ @@ -897,13 +898,14 @@ const String& Request::mime_type_of(cons if(const char* cext=strrchr(user_file_name_cstr, '.')) { String sext(++cext); Table::Action_options options; - if(mime_types->locate(0, sext.change_case(charsets.source(), String::CC_LOWER), options)) + if(mime_types->locate(0, sext.change_case(charsets.source(), String::CC_LOWER), options)) { if(const String* result=mime_types->item(1)) return *result; else throw Exception(PARSER_RUNTIME, 0, MIME_TYPES_NAME " table column elements must not be empty"); + } } return *new String("application/octet-stream");