--- parser3/src/main/pa_http.C 2007/03/22 18:58:52 1.6 +++ parser3/src/main/pa_http.C 2008/02/15 11:51:22 1.9 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_HTTP_C="$Date: 2007/03/22 18:58:52 $"; +static const char * const IDENT_HTTP_C="$Date: 2008/02/15 11:51:22 $"; #include "pa_http.h" #include "pa_common.h" @@ -285,15 +285,18 @@ struct Http_pass_header_info { bool user_agent_specified; }; #endif -static void http_pass_header(HashStringValue::key_type key, +static void http_pass_header(HashStringValue::key_type name, HashStringValue::value_type value, Http_pass_header_info *info) { - *info->request <request <charsets->source(), String::CC_UPPER)=="USER-AGENT") - info->user_agent_specified=true; + if(aname.change_case(info->charsets->source(), String::CC_UPPER)=="USER-AGENT") + info->user_agent_specified=true; } @@ -464,7 +467,7 @@ File_read_http_result pa_internal_file_r } if(valid_options!=options->count()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "invalid option passed"); } @@ -473,7 +476,7 @@ File_read_http_result pa_internal_file_r method_is_get=strcmp(method, "GET")==0; if(method_is_get && body_cstr) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "you can not use $."HTTP_BODY_NAME" option with method GET"); @@ -530,7 +533,7 @@ File_read_http_result pa_internal_file_r headers->for_each(http_pass_header, &info); user_agent_specified=info.user_agent_specified; } else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &connect_string, "headers param must be hash"); }; @@ -538,29 +541,14 @@ File_read_http_result pa_internal_file_r head << "user-agent: " DEFAULT_USER_AGENT CRLF; if(body_cstr) { - // recode those pieces which are not in String::L_URI lang - // [those violating HTTP standard, but widly used] -/* - body_cstr=Charset::transcode( - String::C(body_cstr, strlen(body_cstr)), - charsets.source(), - *asked_remote_charset); -*/ head << "content-length: " << format(strlen(body_cstr), "%u") << CRLF; } const char* head_cstr=head.cstr(String::L_UNSPECIFIED, 0, &charsets); - // recode those pieces which are not in String::L_URI lang - // [those violating HTTP standard, but widly used] -/* - head_cstr=Charset::transcode( - String::C(head_cstr, strlen(head_cstr)), - charsets.source(), - *asked_remote_charset); -*/ // head + end of header request_head_and_body << head_cstr << CRLF; + // body if(body_cstr) request_head_and_body << body_cstr;