--- parser3/src/classes/curl.C 2013/07/22 20:06:50 1.29 +++ parser3/src/classes/curl.C 2015/04/08 18:08:52 1.31 @@ -16,7 +16,7 @@ #include "pa_http.h" #include "ltdl.h" -volatile const char * IDENT_CURL_C="$Id: curl.C,v 1.29 2013/07/22 20:06:50 moko Exp $"; +volatile const char * IDENT_CURL_C="$Id: curl.C,v 1.31 2015/04/08 18:08:52 moko Exp $"; class MCurl: public Methoded { public: @@ -474,8 +474,7 @@ static void curl_setopt(HashStringValue: break; } case CurlOption::PARSER_CHARSET:{ - // 'charset' parser option - options().charset=&::charsets.get(v.as_string().change_case(r.charsets.source(), String::CC_UPPER)); + // 'charset' parser option should be processed before other options break; } case CurlOption::PARSER_RESPONSE_CHARSET:{ @@ -493,8 +492,14 @@ static void _curl_options(Request& r, Me if(curl_options==0) curl_options=new CurlOptionHash(); - if(HashStringValue* options=params.as_hash(0)) - options->for_each(curl_setopt, r); + if(HashStringValue* options_hash=params.as_hash(0)){ + if(Value* value=options_hash->get("charset")){ + // charset should be handled first as params may require transcode + Value &v=r.process_to_value(*value); + options().charset=&::charsets.get(v.as_string().change_case(r.charsets.source(), String::CC_UPPER)); + } + options_hash->for_each(curl_setopt, r); + } } @@ -585,6 +590,7 @@ static void _curl_load_action(Request& r case CURLE_SSL_CACERT: case CURLE_SSL_ENGINE_INITFAILED: ex_type = "curl.ssl"; break; + default: break; } throw Exception( ex_type ? ex_type : "curl.fail", 0, "%s", f_curl_easy_strerror(res)); }