--- parser3/src/main/pa_request.C 2002/08/01 11:26:50 1.218 +++ parser3/src/main/pa_request.C 2002/08/06 09:07:59 1.222 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_REQUEST_C="$Id: pa_request.C,v 1.218 2002/08/01 11:26:50 paf Exp $"; +static const char* IDENT_REQUEST_C="$Date: 2002/08/06 09:07:59 $"; #include "pa_sapi.h" #include "pa_common.h" @@ -553,9 +553,10 @@ void Request::output_result(const VFile& // header: cookies cookie.output_result(); + VString *body_file_content_type; // set content-type - if(String *body_file_content_type=static_cast( - body_file.fields().get(*vfile_mime_type_name))) { + if(body_file_content_type=static_cast( + body_file.fields().get(*content_type_name))) { // body file content type response.fields().put(*content_type_name, body_file_content_type); } else { @@ -576,13 +577,18 @@ void Request::output_result(const VFile& // prepare header: $response:fields without :body response.fields().for_each(add_header_attribute, this); - // transcode const void *client_body; size_t client_content_length; - Charset::transcode(pool(), - pool().get_source_charset(), body_file.value_ptr(), body_file.value_size(), - pool().get_client_charset(), client_body, client_content_length - ); + // transcode text body when "text/*" or simple result + if(!body_file_content_type/*vstring.as_vfile*/ || body_file_content_type->as_string().pos("text/")==0) { + Charset::transcode(pool(), + pool().get_source_charset(), body_file.value_ptr(), body_file.value_size(), + pool().get_client_charset(), client_body, client_content_length + ); + } else { + client_body=body_file.value_ptr(); + client_content_length=body_file.value_size(); + } // prepare header: content-length char content_length_cstr[MAX_NUMBER]; @@ -601,7 +607,7 @@ const String& Request::mime_type_of(cons if(mime_types) if(const char *cext=strrchr(user_file_name_cstr, '.')) { String sext(pool(), ++cext); - if(mime_types->locate(0, sext)) + if(mime_types->locate(0, sext.change_case(pool(), String::CC_LOWER))) if(const String *result=mime_types->item(1)) return *result; else