cvs: php-src /ext/curl interface.c
| From: | Ilia Alshanetsky | Date: | Thu, 27 Nov 2008 17:03:22 +0000 |
| Subject: | cvs: php-src /ext/curl interface.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-54508@lists.php.net to get a copy of this message | ||
iliaa Thu Nov 27 17:03:22 2008 UTC
Modified files:
/php-src/ext/curl interface.c
Log:
MFB: 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.133&r2=1.134&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.133 php-src/ext/curl/interface.c:1.134
--- php-src/ext/curl/interface.c:1.133 Sat Nov 22 14:41:21 2008
+++ php-src/ext/curl/interface.c Thu Nov 27 17:03:22 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.133 2008/11/22 14:41:21 felipe Exp $ */
+/* $Id: interface.c,v 1.134 2008/11/27 17:03:22 iliaa Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -1639,17 +1639,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';
+ }
/* open_basedir check */
if (php_check_open_basedir(postval TSRMLS_CC)) {
+ if (type) {
+ *type = ';';
+ }
RETVAL_FALSE;
return 1;
}
- error = curl_formadd(&first, &last,
+ if (type) {
+ type++;
+ error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, key,
CURLFORM_NAMELENGTH, l,
- CURLFORM_FILE, postval,
+ CURLFORM_FILE, postval,
+ CURLFORM_CONTENTTYPE, type,
CURLFORM_END);
+ *(type - 1) = ';';
+ } else {
+ error = curl_formadd(&first, &last,
+ CURLFORM_COPYNAME, key,
+ CURLFORM_NAMELENGTH, l,
+ CURLFORM_FILE, postval,
+ CURLFORM_END);
+
+ }
} else {
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, key,