iliaa Thu Nov 27 17:00:04 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/curl interface.c Log: Fixed bug #46696 (cURL fails in upload files with specified content-type) http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.27.2.19&r2=1.62.2.14.2.27.2.20&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.62.2.14.2.27.2.19 php-src/ext/curl/interface.c:1.62.2.14.2.27.2.20 --- php-src/ext/curl/interface.c:1.62.2.14.2.27.2.19 Mon Nov 17 11:27:53 2008 +++ php-src/ext/curl/interface.c Thu Nov 27 17:00:04 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.62.2.14.2.27.2.19 2008/11/17 11:27:53 felipe Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.27.2.20 2008/11/27 17:00:04 iliaa Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -1582,17 +1582,37 @@ * must be explicitly cast to long in curl_formadd * use since curl needs a long not an int. */ if (*postval == '@') { + char *type; ++postval; + + if ((type = php_memnstr(postval, ";type=", sizeof(";type=") - 1, postval + strlen(postval)))) { + *type = '\0'; + } /* safe_mode / open_basedir check */ if (php_check_open_basedir(postval TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(postval, "rb+", CHECKUID_CHECK_MODE_PARAM))) { + if (type) { + *type = ';'; + } RETVAL_FALSE; return 1; } - error = curl_formadd(&first, &last, + if (type) { + type++; + error = curl_formadd(&first, &last, + CURLFORM_COPYNAME, string_key, + CURLFORM_NAMELENGTH, (long)string_key_len - 1, + CURLFORM_FILE, postval, + CURLFORM_CONTENTTYPE, type, + CURLFORM_END); + *(type - 1) = ';'; + } else { + error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key, CURLFORM_NAMELENGTH, (long)string_key_len - 1, - CURLFORM_FILE, postval, + CURLFORM_FILE, postval, CURLFORM_END); + + } } else { error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key,
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php