From: Travis Cross Date: Wed, 20 Aug 2014 10:22:27 +0000 (+0000) Subject: Decode params to `curl_sendfile` X-Git-Tag: v1.4.8~5^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2ca3c5211815645425a98466d65c02d19d0f8b8;p=thirdparty%2Ffreeswitch.git Decode params to `curl_sendfile` `curl_sendfile` generates a multipart message with Content-Type: multipart/form-data with no separate Content-Type headers in the parts for each non-file argument. These parts therefore default to text/plain. However, prior to this commit, we were putting the URL encoded POST data into these parts, which is not correct. We should be putting raw text into the parts. With this commit, we urldecode each argument key and value before composing the multipart message. See: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 --- diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 03c0eda5c8..61f9a78d2a 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -400,8 +400,11 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) char *argv2[4] = { 0 }; uint32_t argc2 = switch_separate_string(argv[count], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))); - if(argc2 == 2) + if(argc2 == 2) { + switch_url_decode(argv2[0]); + switch_url_decode(argv2[1]); curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, argv2[0], CURLFORM_COPYCONTENTS, argv2[1], CURLFORM_END); + } } }