iliaa           Thu Nov 27 17:01:29 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/curl   interface.c 
    /php-src    NEWS 
  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.62.2.14.2.36&r2=1.62.2.14.2.37&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.62.2.14.2.36 
php-src/ext/curl/interface.c:1.62.2.14.2.37
--- php-src/ext/curl/interface.c:1.62.2.14.2.36 Tue Jul 29 10:42:59 2008
+++ php-src/ext/curl/interface.c        Thu Nov 27 17:01:29 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: interface.c,v 1.62.2.14.2.36 2008/07/29 10:42:59 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.37 2008/11/27 17:01:29 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -1481,17 +1481,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,
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1334&r2=1.2027.2.547.2.1335&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1334 php-src/NEWS:1.2027.2.547.2.1335
--- php-src/NEWS:1.2027.2.547.2.1334    Thu Nov 27 14:49:45 2008
+++ php-src/NEWS        Thu Nov 27 17:01:29 2008
@@ -4,6 +4,8 @@
 - Upgraded PCRE to version 7.8 (Ilia)
 
 - Fixed memory leak inside readline_callback_handler_remove() function. 
(Felipe)
+- Fixed bug #46696 (cURL fails in upload files with specified content-type).
+  (Ilia)
 - Fixed bug #46673 (stream_lock call with wrong paramater). (Arnaud)
 - Fixed bug #46649 (Setting array element with that same array produces 
   inconsistent results). (Arnaud)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to