--- parser3/src/main/pa_request.C 2005/11/24 14:05:05 1.274.6.4 +++ parser3/src/main/pa_request.C 2005/11/18 09:57:25 1.276 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_REQUEST_C="$Date: 2005/11/24 14:05:05 $"; +static const char * const IDENT_REQUEST_C="$Date: 2005/11/18 09:57:25 $"; #include "pa_sapi.h" #include "pa_common.h" @@ -53,6 +53,7 @@ const char* ORIGINS_CONTENT_TYPE="text/p #define EXCEPTION_TYPE_PART_NAME "type" #define EXCEPTION_SOURCE_PART_NAME "source" #define EXCEPTION_COMMENT_PART_NAME "comment" +#define RESPONSE_BODY_FILE_NAME "file" // globals @@ -66,6 +67,7 @@ const String exception_type_part_name(EX const String exception_source_part_name(EXCEPTION_SOURCE_PART_NAME); const String exception_comment_part_name(EXCEPTION_COMMENT_PART_NAME); const String exception_handled_part_name(EXCEPTION_HANDLED_PART_NAME); +const String response_body_file_name(RESPONSE_BODY_FILE_NAME); // defines for statics @@ -76,7 +78,6 @@ const String exception_handled_part_name #define POST_PROCESS_METHOD_NAME "postprocess" #define DOWNLOAD_NAME "download" #define CLASS_PATH_NAME "CLASS_PATH" -#define RESPONSE_BODY_FILE_NAME "file" // statics @@ -88,7 +89,6 @@ static const String conf_method_name(CON static const String post_process_method_name(POST_PROCESS_METHOD_NAME); static const String download_name(DOWNLOAD_NAME); static const String class_path_name(CLASS_PATH_NAME); -static const String response_body_file_name(RESPONSE_BODY_FILE_NAME); // defines @@ -559,12 +559,12 @@ void Request::use_file(VStateless_class& file_spec=0; if(Value* element=main_class.get_element(class_path_name, main_class, false)) { if(element->is_string()) { - file_spec=file_exist(absolute(element->as_string()), file_name); // found at class_path? + file_spec=file_readable(absolute(element->as_string()), file_name); // found at class_path? } else if(Table *table=element->get_table()) { int size=table->count(); for(int i=size; i--; ) { const String& path=*(*table->get(i))[0]; - if((file_spec=file_exist(absolute(path), file_name))) + if((file_spec=file_readable(absolute(path), file_name))) break; // found along class_path } } else @@ -835,14 +835,12 @@ void Request::output_result(VFile* body_ if(vfile_name) { const String& sfile_name=vfile_name->as_string(); if(sfile_name!=NONAME_DAT) { + VHash& hash=*new VHash(); + HashStringValue &h=hash.hash(); if(as_attachment) - { - VHash& hash=*new VHash(); - HashStringValue &h=hash.hash(); h.put(value_name, new VString(content_disposition_value)); - h.put(content_disposition_filename_name, vfile_name); - response.fields().put(content_disposition_name, &hash); - } + h.put(content_disposition_filename_name, vfile_name); + response.fields().put(content_disposition_name, &hash); if(!body_file_content_type) body_file_content_type=new VString(mime_type_of(sfile_name.cstr()));