[PHP-CVS] svn: /php/php-src/trunk/ext/curl/tests/ curl_reset.phpt
pierrick Sat, 03 Dec 2011 20:14:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320313 Log: Fix test for libcurl 7.12.1 Changed paths: U php/php-src/trunk/ext/curl/tests/curl_reset.phpt Modified: php/php-src/trunk/ext/curl/tests/curl_reset.phpt === --- php/php-src/trunk/ext/curl/tests/curl_reset.phpt2011-12-03 19:41:28 UTC (rev 320312) +++ php/php-src/trunk/ext/curl/tests/curl_reset.phpt2011-12-03 20:14:06 UTC (rev 320313) @@ -1,7 +1,9 @@ --TEST-- Test curl_reset --SKIPIF-- -?php if (!extension_loaded(curl)) print skip; ? +?php if (!extension_loaded(curl)) print skip; +if (!function_exists(curl_reset)) exit(skip curl_reset doesn't exists (require libcurl = 7.12.1)); +? --FILE-- ?php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c
pierrick Sat, 03 Dec 2011 20:16:32 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320314 Log: Clean curl_getinfo and add new constants from newer libcurl versions Changed paths: U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-03 20:14:06 UTC (rev 320313) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-03 20:16:32 UTC (rev 320314) @@ -832,7 +832,8 @@ REGISTER_CURL_CONSTANT(CURLAUTH_NTLM); #endif -#if LIBCURL_VERSION_NUM = 0x070a07 /* Available since 7.10.7 */ +#if LIBCURL_VERSION_NUM = 0x070a07 /* Available since 7.10.7 */ + REGISTER_CURL_CONSTANT(CURLINFO_HTTP_CONNECTCODE); REGISTER_CURL_CONSTANT(CURLOPT_FTP_CREATE_MISSING_DIRS); REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH); #endif @@ -840,7 +841,9 @@ #if LIBCURL_VERSION_NUM = 0x070a08 /* Available since 7.10.8 */ REGISTER_CURL_CONSTANT(CURLE_FILESIZE_EXCEEDED); REGISTER_CURL_CONSTANT(CURLE_LDAP_INVALID_URL); + REGISTER_CURL_CONSTANT(CURLINFO_HTTPAUTH_AVAIL); REGISTER_CURL_CONSTANT(CURLINFO_RESPONSE_CODE); + REGISTER_CURL_CONSTANT(CURLINFO_PROXYAUTH_AVAIL); REGISTER_CURL_CONSTANT(CURLOPT_FTP_RESPONSE_TIMEOUT); REGISTER_CURL_CONSTANT(CURLOPT_IPRESOLVE); REGISTER_CURL_CONSTANT(CURLOPT_MAXFILESIZE); @@ -874,7 +877,17 @@ REGISTER_CURL_CONSTANT(CURLOPT_TCP_NODELAY); #endif +#if LIBCURL_VERSION_NUM = 0x070c02 /* Available since 7.12.2 */ + REGISTER_CURL_CONSTANT(CURLINFO_OS_ERRNO); +#endif + +#if LIBCURL_VERSION_NUM = 0x070c03 /* Available since 7.12.3 */ + REGISTER_CURL_CONSTANT(CURLINFO_NUM_CONNECTS); + REGISTER_CURL_CONSTANT(CURLINFO_SSL_ENGINES); +#endif + #if LIBCURL_VERSION_NUM = 0x070e01 /* Available since 7.14.1 */ + REGISTER_CURL_CONSTANT(CURLINFO_COOKIELIST); REGISTER_CURL_CONSTANT(CURLOPT_COOKIELIST); REGISTER_CURL_CONSTANT(CURLOPT_IGNORE_CONTENT_LENGTH); #endif @@ -899,6 +912,10 @@ REGISTER_CURL_CONSTANT(CURLFTPMETHOD_SINGLECWD); #endif +#if LIBCURL_VERSION_NUM - 0x070f04 /* Available since 7.15.4 */ + REGISTER_CURL_CONSTANT(CURLINFO_FTP_ENTRY_PATH); +#endif + #if LIBCURL_VERSION_NUM = 0x070f05 /* Available since 7.15.5 */ REGISTER_CURL_CONSTANT(CURLOPT_FTP_ALTERNATIVE_TO_USER); REGISTER_CURL_CONSTANT(CURLOPT_MAX_RECV_SPEED_LARGE); @@ -950,15 +967,18 @@ #if LIBCURL_VERSION_NUM = 0x071300 /* Available since 7.19.0 */ REGISTER_CURL_CONSTANT(CURLE_SSH); + REGISTER_CURL_CONSTANT(CURLINFO_APPCONNECT_TIME); + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP); + REGISTER_CURL_CONSTANT(CURLOPT_ADDRESS_SCOPE); REGISTER_CURL_CONSTANT(CURLOPT_CRLFILE); REGISTER_CURL_CONSTANT(CURLOPT_ISSUERCERT); REGISTER_CURL_CONSTANT(CURLOPT_KEYPASSWD); + REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES); REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5); REGISTER_CURL_CONSTANT(CURLOPT_SSH_PRIVATE_KEYFILE); REGISTER_CURL_CONSTANT(CURLOPT_SSH_PUBLIC_KEYFILE); - REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES); REGISTER_CURL_CONSTANT(CURLSSH_AUTH_ANY); REGISTER_CURL_CONSTANT(CURLSSH_AUTH_DEFAULT); REGISTER_CURL_CONSTANT(CURLSSH_AUTH_HOST); @@ -983,12 +1003,15 @@ #endif #if LIBCURL_VERSION_NUM = 0x071304 /* Available since 7.19.4 */ + REGISTER_CURL_CONSTANT(CURLINFO_CONDITION_UNMET); + REGISTER_CURL_CONSTANT(CURLOPT_NOPROXY); REGISTER_CURL_CONSTANT(CURLOPT_PROTOCOLS); REGISTER_CURL_CONSTANT(CURLOPT_REDIR_PROTOCOLS); REGISTER_CURL_CONSTANT(CURLOPT_SOCKS5_GSSAPI_NEC); REGISTER_CURL_CONSTANT(CURLOPT_SOCKS5_GSSAPI_SERVICE); REGISTER_CURL_CONSTANT(CURLOPT_TFTP_BLKSIZE); + REGISTER_CURL_CONSTANT(CURLPROTO_ALL); REGISTER_CURL_CONSTANT(CURLPROTO_DICT); REGISTER_CURL_CONSTANT(CURLPROTO_FILE); @@ -1009,6 +1032,10 @@ #endif #if LIBCURL_VERSION_NUM = 0x071400 /* Available since 7.20.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_RTSP_CLIENT_CSEQ); + REGISTER_CURL_CONSTANT(CURLINFO_RTSP_CSEQ_RECV); + REGISTER_CURL_CONSTANT(CURLINFO_RTSP_SERVER_CSEQ); + REGISTER_CURL_CONSTANT(CURLINFO_RTSP_SESSION_ID); REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_PRET); REGISTER_CURL_CONSTANT(CURLOPT_MAIL_FROM); REGISTER_CURL_CONSTANT(CURLOPT_MAIL_RCPT); @@ -1039,6 +1066,9 @@ #endif #if LIBCURL_VERSION_NUM = 0x071500 /* Available since 7.21.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP); + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT); + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT); REGISTER_CURL_CONSTANT(CURLPROTO_RTMP); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPE); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPS); @@ -2786,18 +2816,25 @@ if (curl_easy_getinfo(ch-cp, CURLINFO_REDIRECT_TIME, d_code) == CURLE_OK) { CAAD(redirect_time, d_code); } -#if LIBCURL_VERSION_NUM 0x071301 +#if LIBCURL_VERSION_NUM = 0x071202 /* Available since 7.18.2 */ + if (curl_easy_getinfo(ch-cp, CURLINFO_REDIRECT_URL, s_code) == CURLE_OK) { + CAAS(redirect_url, s_code); + } +#endif +#if LIBCURL_VERSION_NUM = 0x071300 /* Available
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/tests/ curl_basic_022.phpt
pierrick Sat, 03 Dec 2011 20:19:53 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320316 Log: Test curl_getinfo() function with CURLINFO_EFFECTIVE_URL parameter Changed paths: A php/php-src/trunk/ext/curl/tests/curl_basic_022.phpt Added: php/php-src/trunk/ext/curl/tests/curl_basic_022.phpt === --- php/php-src/trunk/ext/curl/tests/curl_basic_022.phpt (rev 0) +++ php/php-src/trunk/ext/curl/tests/curl_basic_022.phpt2011-12-03 20:19:53 UTC (rev 320316) @@ -0,0 +1,25 @@ +--TEST-- +Test curl_getinfo() function with CURLINFO_COOKIELIST parameter +--SKIPIF-- +?php if (!extension_loaded(curl)) print skip; +$curl_version = curl_version(); +if ($curl_version['version_number'] 0x070e01) { + exit(skip: test works only with curl = 7.14.1); +} +? +--FILE-- +?php + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C1=v1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net'); +curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C2=v2; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net'); +var_dump(curl_getinfo($ch, CURLINFO_COOKIELIST)); + +? +--EXPECT-- +array(2) { + [0]= + string(38) .php.net TRUE/ FALSE 2147368447 C1 v1 + [1]= + string(38) .php.net TRUE/ FALSE 2147368447 C2 v2 +} -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c
pierrick Sat, 03 Dec 2011 23:21:43 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320329 Log: useless variable Changed paths: U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:08:55 UTC (rev 320328) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:21:43 UTC (rev 320329) @@ -1281,7 +1281,6 @@ { php_curl *ch = (php_curl *) clientp; php_curl_progress *t = ch-handlers-progress; - int length = -1; size_t rval = 0; #if PHP_CURL_DEBUG @@ -1331,7 +1330,6 @@ ch-in_callback = 0; if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot call the CURLOPT_PROGRESSFUNCTION); - length = -1; } else if (retval_ptr) { if (Z_TYPE_P(retval_ptr) != IS_LONG) { convert_to_long_ex(retval_ptr); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c
pierrick Sat, 03 Dec 2011 23:43:44 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320332 Log: The progress handle don't need to be allocated unless curl_setopt with CURLOPT_PROGRESSFUNCTION is called Changed paths: U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:40:38 UTC (rev 320331) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:43:44 UTC (rev 320332) @@ -1643,7 +1643,7 @@ (*ch)-handlers-write= ecalloc(1, sizeof(php_curl_write)); (*ch)-handlers-write_header = ecalloc(1, sizeof(php_curl_write)); (*ch)-handlers-read = ecalloc(1, sizeof(php_curl_read)); - (*ch)-handlers-progress = ecalloc(1, sizeof(php_curl_progress)); + (*ch)-handlers-progress = NULL; (*ch)-in_callback = 0; (*ch)-header.str_len = 0; @@ -2447,7 +2447,9 @@ case CURLOPT_PROGRESSFUNCTION: curl_easy_setopt(ch-cp, CURLOPT_PROGRESSFUNCTION, curl_progress); curl_easy_setopt(ch-cp, CURLOPT_PROGRESSDATA, ch); - if (ch-handlers-progress-func_name) { + if (NULL == ch-handlers-progress) { + ch-handlers-progress = ecalloc(1, sizeof(php_curl_progress)); + } else if (ch-handlers-progress-func_name) { zval_ptr_dtor(ch-handlers-progress-func_name); ch-handlers-progress-fci_cache = empty_fcall_info_cache; } @@ -3020,9 +3022,6 @@ if (ch-handlers-write_header-func_name) { zval_ptr_dtor(ch-handlers-write_header-func_name); } - if (ch-handlers-progress-func_name) { - zval_ptr_dtor(ch-handlers-progress-func_name); - } if (ch-handlers-passwd) { zval_ptr_dtor(ch-handlers-passwd); } @@ -3046,7 +3045,14 @@ efree(ch-handlers-write); efree(ch-handlers-write_header); efree(ch-handlers-read); - efree(ch-handlers-progress); + + if (ch-handlers-progress) { + if (ch-handlers-progress-func_name) { + zval_ptr_dtor(ch-handlers-progress-func_name); + } + efree(ch-handlers-progress); + } + efree(ch-handlers); efree(ch); } @@ -3093,12 +3099,13 @@ ch-handlers-std_err = NULL; } - if (ch-handlers-progress-func_name) { - zval_ptr_dtor(ch-handlers-progress-func_name); - ch-handlers-progress-fci_cache = empty_fcall_info_cache; - ch-handlers-progress-func_name = NULL; + if (ch-handlers-progress) { + if (ch-handlers-progress-func_name) { + zval_ptr_dtor(ch-handlers-progress-func_name); + } + efree(ch-handlers-progress); + ch-handlers-progress = NULL; } - ch-handlers-progress-method = 0; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c
pierrick Sat, 03 Dec 2011 23:53:27 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320335 Log: Add the curl handle to the progress callback function Changed paths: U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:53:05 UTC (rev 320334) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-03 23:53:27 UTC (rev 320335) @@ -1290,7 +1290,8 @@ switch (t-method) { case PHP_CURL_USER: { - zval **argv[4]; + zval **argv[5]; + zval *handle = NULL; zval *zdltotal = NULL; zval *zdlnow = NULL; zval *zultotal = NULL; @@ -1300,27 +1301,31 @@ zend_fcall_info fci; TSRMLS_FETCH_FROM_CTX(ch-thread_ctx); + MAKE_STD_ZVAL(handle); MAKE_STD_ZVAL(zdltotal); MAKE_STD_ZVAL(zdlnow); MAKE_STD_ZVAL(zultotal); MAKE_STD_ZVAL(zulnow); + ZVAL_RESOURCE(handle, ch-id); + zend_list_addref(ch-id); ZVAL_LONG(zdltotal, (long) dltotal); ZVAL_LONG(zdlnow, (long) dlnow); ZVAL_LONG(zultotal, (long) ultotal); ZVAL_LONG(zulnow, (long) ulnow); - argv[0] = zdltotal; - argv[1] = zdlnow; - argv[2] = zultotal; - argv[3] = zulnow; + argv[0] = handle; + argv[1] = zdltotal; + argv[2] = zdlnow; + argv[3] = zultotal; + argv[4] = zulnow; fci.size = sizeof(fci); fci.function_table = EG(function_table); fci.function_name = t-func_name; fci.object_ptr = NULL; fci.retval_ptr_ptr = retval_ptr; - fci.param_count = 4; + fci.param_count = 5; fci.params = argv; fci.no_separation = 0; fci.symbol_table = NULL; @@ -1343,6 +1348,7 @@ zval_ptr_dtor(argv[1]); zval_ptr_dtor(argv[2]); zval_ptr_dtor(argv[3]); + zval_ptr_dtor(argv[4]); break; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c php_curl.h
pierrick Sun, 04 Dec 2011 00:19:12 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320339 Log: add CURLOPT_WILDCARDMATCH and CURLOPT_FNMATCH_FUNCTION Changed paths: U php/php-src/trunk/ext/curl/interface.c U php/php-src/trunk/ext/curl/php_curl.h Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-04 00:03:56 UTC (rev 320338) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-04 00:19:12 UTC (rev 320339) @@ -1067,12 +1067,17 @@ REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP); REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT); REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT); + REGISTER_CURL_CONSTANT(CURLOPT_FNMATCH_FUNCTION); + REGISTER_CURL_CONSTANT(CURLOPT_WILDCARDMATCH); REGISTER_CURL_CONSTANT(CURLPROTO_RTMP); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPE); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPS); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPT); REGISTER_CURL_CONSTANT(CURLPROTO_RTMPTE); - REGISTER_CURL_CONSTANT(CURLPROTO_RTMPTS); + REGISTER_CURL_CONSTANT(CURLPROTO_RTMPTS); + REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_FAIL); + REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_MATCH); + REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_NOMATCH); #endif #if LIBCURL_VERSION_NUM = 0x071502 /* Available since 7.21.2 */ @@ -1275,6 +1280,71 @@ } /* }}} */ +#if LIBCURL_VERSION_NUM = 0x071500 /* Available since 7.21.0 */ +/* {{{ curl_fnmatch + */ +static int curl_fnmatch(void *ctx, const char *pattern, const char *string) +{ + php_curl *ch = (php_curl *) ctx; + php_curl_fnmatch *t = ch-handlers-fnmatch; + int rval = CURL_FNMATCHFUNC_FAIL; + switch (t-method) { + case PHP_CURL_USER: { + zval **argv[3]; + zval *zhandle = NULL; + zval *zpattern = NULL; + zval *zstring = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch-thread_ctx); + + MAKE_STD_ZVAL(zhandle); + MAKE_STD_ZVAL(zpattern); + MAKE_STD_ZVAL(zstring); + + ZVAL_RESOURCE(zhandle, ch-id); + zend_list_addref(ch-id); + ZVAL_STRING(zpattern, pattern, 1); + ZVAL_STRING(zstring, string, 1); + + argv[0] = zhandle; + argv[1] = zpattern; + argv[2] = zstring; + + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = t-func_name; + fci.object_ptr = NULL; + fci.retval_ptr_ptr = retval_ptr; + fci.param_count = 3; + fci.params = argv; + fci.no_separation = 0; + fci.symbol_table = NULL; + + ch-in_callback = 1; + error = zend_call_function(fci, t-fci_cache TSRMLS_CC); + ch-in_callback = 0; + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot call the CURLOPT_FNMATCH_FUNCTION); + } else if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) != IS_LONG) { + convert_to_long_ex(retval_ptr); + } + rval = Z_LVAL_P(retval_ptr); + zval_ptr_dtor(retval_ptr); + } + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + break; + } + } + return rval; +} +/* }}} */ +#endif + /* {{{ curl_progress */ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) @@ -1650,6 +1720,9 @@ (*ch)-handlers-write_header = ecalloc(1, sizeof(php_curl_write)); (*ch)-handlers-read = ecalloc(1, sizeof(php_curl_read)); (*ch)-handlers-progress = NULL; +#if LIBCURL_VERSION_NUM = 0x071500 /* Available since 7.21.0 */ + (*ch)-handlers-fnmatch = NULL; +#endif (*ch)-in_callback = 0; (*ch)-header.str_len = 0; @@ -2034,6 +2107,9 @@ case CURLOPT_RTSP_REQUEST: case CURLOPT_RTSP_SERVER_CSEQ: #endif +#if LIBCURL_VERSION_NUM = 0x071500 /* Available since 7.21.0 */ + case CURLOPT_WILDCARDMATCH: +#endif #if LIBCURL_VERSION_NUM = 0x071504 /*
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c tests/curl_copy_handle_basic_008.phpt
pierrick Sun, 04 Dec 2011 01:16:17 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320340 Log: Fix segfault when using curl_copy_handle with CURLOPT_PROGRESSFUNCTION Changed paths: U php/php-src/trunk/ext/curl/interface.c A php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_008.phpt Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-04 00:19:12 UTC (rev 320339) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-04 01:16:17 UTC (rev 320340) @@ -1965,6 +1965,26 @@ curl_easy_setopt(dupch-cp, CURLOPT_INFILE,(void *) dupch); curl_easy_setopt(dupch-cp, CURLOPT_WRITEHEADER, (void *) dupch); + if (ch-handlers-progress) { + dupch-handlers-progress = ecalloc(1, sizeof(php_curl_progress)); + if (ch-handlers-progress-func_name) { + zval_add_ref(ch-handlers-progress-func_name); + dupch-handlers-progress-func_name = ch-handlers-progress-func_name; + } + dupch-handlers-progress-method = ch-handlers-progress-method; + curl_easy_setopt(dupch-cp, CURLOPT_PROGRESSDATA, (void *) dupch); + } + + if (ch-handlers-fnmatch) { + dupch-handlers-fnmatch = ecalloc(1, sizeof(php_curl_fnmatch)); + if (ch-handlers-fnmatch-func_name) { + zval_add_ref(ch-handlers-fnmatch-func_name); + dupch-handlers-fnmatch-func_name = ch-handlers-fnmatch-func_name; + } + dupch-handlers-fnmatch-method = ch-handlers-fnmatch-method; + curl_easy_setopt(dupch-cp, CURLOPT_FNMATCH_DATA, (void *) dupch); + } + efree(dupch-to_free); dupch-to_free = ch-to_free; Added: php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_008.phpt === --- php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_008.phpt (rev 0) +++ php/php-src/trunk/ext/curl/tests/curl_copy_handle_basic_008.phpt 2011-12-04 01:16:17 UTC (rev 320340) @@ -0,0 +1,25 @@ +--TEST-- +Test curl_copy_handle() with CURLOPT_PROGRESSFUNCTION +--SKIPIF-- +?php if (!extension_loaded(curl) || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable; ? +--FILE-- +?php + $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER'); + + $url = {$host}/get.php; + $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_NOPROGRESS, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function() { }); + $ch2 = curl_copy_handle($ch); + echo curl_exec($ch), PHP_EOL; + unset($ch); + echo curl_exec($ch2); + +? +--EXPECTF-- +Hello World! +Hello World! +Hello World! +Hello World! -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_3/NEWS PHP_5_3/ext/curl/interface.c PHP_5_3/ext/curl/tests/curl_copy_handle_basic_008.phpt PHP_5_4/NEWS PHP_5_4/ext/curl/interface.c PHP_5_4/ext/curl/tests/
pierrick Sun, 04 Dec 2011 01:34:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320341 Log: Fixed bug #60439curl_copy_handle segfault when used with CURLOPT_PROGRESSFUNCTION Bug: https://bugs.php.net/60439 (Open) curl_copy_handle segfault when used with CURLOPT_PROGRESSFUNCTION Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/curl/interface.c A php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_008.phpt U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/ext/curl/interface.c A php/php-src/branches/PHP_5_4/ext/curl/tests/curl_copy_handle_basic_008.phpt Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-12-04 01:16:17 UTC (rev 320340) +++ php/php-src/branches/PHP_5_3/NEWS 2011-12-04 01:34:54 UTC (rev 320341) @@ -26,6 +26,10 @@ - BCmath: . Fixed bug #60377 (bcscale related crashes on 64bits platforms). (shm) +- cURL: + . Fixed bug #60439 (curl_copy_handle segfault when used with +CURLOPT_PROGRESSFUNCTION). (Pierrick) + - Date: . Fixed bug #60373 (Startup errors with log_errors on cause segfault). (Derick) Modified: php/php-src/branches/PHP_5_3/ext/curl/interface.c === --- php/php-src/branches/PHP_5_3/ext/curl/interface.c 2011-12-04 01:16:17 UTC (rev 320340) +++ php/php-src/branches/PHP_5_3/ext/curl/interface.c 2011-12-04 01:34:54 UTC (rev 320341) @@ -1649,11 +1649,18 @@ zval_add_ref(ch-handlers-write_header-func_name); dupch-handlers-write_header-func_name = ch-handlers-write_header-func_name; } + + if (ch-handlers-progress-func_name) { + zval_add_ref(ch-handlers-progress-func_name); + dupch-handlers-progress-func_name = ch-handlers-progress-func_name; + } + dupch-handlers-progress-method = ch-handlers-progress-method; curl_easy_setopt(dupch-cp, CURLOPT_ERRORBUFFER, dupch-err.str); curl_easy_setopt(dupch-cp, CURLOPT_FILE, (void *) dupch); curl_easy_setopt(dupch-cp, CURLOPT_INFILE,(void *) dupch); curl_easy_setopt(dupch-cp, CURLOPT_WRITEHEADER, (void *) dupch); + curl_easy_setopt(dupch-cp, CURLOPT_PROGRESSDATA, (void *) dupch); efree(dupch-to_free); dupch-to_free = ch-to_free; Added: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_008.phpt === --- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_008.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_copy_handle_basic_008.phpt 2011-12-04 01:34:54 UTC (rev 320341) @@ -0,0 +1,25 @@ +--TEST-- +Test curl_copy_handle() with CURLOPT_PROGRESSFUNCTION +--SKIPIF-- +?php if (!extension_loaded(curl) || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable; ? +--FILE-- +?php + $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER'); + + $url = {$host}/get.php; + $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_NOPROGRESS, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function() { }); + $ch2 = curl_copy_handle($ch); + echo curl_exec($ch), PHP_EOL; + unset($ch); + echo curl_exec($ch2); + +? +--EXPECTF-- +Hello World! +Hello World! +Hello World! +Hello World! Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-12-04 01:16:17 UTC (rev 320340) +++ php/php-src/branches/PHP_5_4/NEWS 2011-12-04 01:34:54 UTC (rev 320341) @@ -10,6 +10,10 @@ - CLI SAPI: . Implement FR #60390 (Missing $_SERVER['SERVER_PORT']). (Pierre) +- cURL: + . Fixed bug #60439 (curl_copy_handle segfault when used with +CURLOPT_PROGRESSFUNCTION). (Pierrick) + - Intl: . Added support for UTS #46. (Gustavo) Modified: php/php-src/branches/PHP_5_4/ext/curl/interface.c === --- php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-12-04 01:16:17 UTC (rev 320340) +++ php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-12-04 01:34:54 UTC (rev 320341) @@ -1645,11 +1645,18 @@ zval_add_ref(ch-handlers-write_header-func_name); dupch-handlers-write_header-func_name = ch-handlers-write_header-func_name; } + + if (ch-handlers-progress-func_name) { + zval_add_ref(ch-handlers-progress-func_name); + dupch-handlers-progress-func_name = ch-handlers-progress-func_name; + } + dupch-handlers-progress-method = ch-handlers-progress-method;
[PHP-CVS] svn: /php/php-src/trunk/ext/curl/ interface.c
pierrick Sat, 03 Dec 2011 21:24:19 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320321 Log: Update curl MINFO Changed paths: U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-12-03 21:24:03 UTC (rev 320320) +++ php/php-src/trunk/ext/curl/interface.c 2011-12-03 21:24:19 UTC (rev 320321) @@ -469,43 +469,41 @@ unsigned int i; static const struct feat feats[] = { -#if LIBCURL_VERSION_NUM 0x070a06 /* 7.10.7 */ +#if LIBCURL_VERSION_NUM = 0x070a07 /* 7.10.7 */ {AsynchDNS, CURL_VERSION_ASYNCHDNS}, #endif -#if LIBCURL_VERSION_NUM 0x070a05 /* 7.10.6 */ +#if LIBCURL_VERSION_NUM = 0x070f04 /* 7.15.4 */ + {CharConv, CURL_VERSION_CONV}, +#endif +#if LIBCURL_VERSION_NUM = 0x070a06 /* 7.10.6 */ {Debug, CURL_VERSION_DEBUG}, {GSS-Negotiate, CURL_VERSION_GSSNEGOTIATE}, #endif -#if LIBCURL_VERSION_NUM 0x070b02 /* 7.12.0 */ +#if LIBCURL_VERSION_NUM = 0x070c00 /* 7.12.0 */ {IDN, CURL_VERSION_IDN}, #endif -#ifdef CURL_VERSION_IPV6 {IPv6, CURL_VERSION_IPV6}, -#endif -#if LIBCURL_VERSION_NUM 0x070b00 /* 7.11.1 */ + {krb4, CURL_VERSION_KERBEROS4}, +#if LIBCURL_VERSION_NUM = 0x070b01 /* 7.11.1 */ {Largefile, CURL_VERSION_LARGEFILE}, #endif -#if LIBCURL_VERSION_NUM 0x070a05 /* 7.10.6 */ + {libz, CURL_VERSION_LIBZ}, +#if LIBCURL_VERSION_NUM = 0x070a06 /* 7.10.6 */ {NTLM, CURL_VERSION_NTLM}, #endif -#if LIBCURL_VERSION_NUM 0x070a07 /* 7.10.8 */ +#if LIBCURL_VERSION_NUM = 0x071600 /* 7.22.0 */ + {NTLMWB, CURL_VERSION_NTLM_WB}, +#endif +#if LIBCURL_VERSION_NUM = 0x070a08 /* 7.10.8 */ {SPNEGO, CURL_VERSION_SPNEGO}, #endif -#ifdef CURL_VERSION_SSL {SSL, CURL_VERSION_SSL}, -#endif -#if LIBCURL_VERSION_NUM 0x070d01 /* 7.13.2 */ +#if LIBCURL_VERSION_NUM = 0x070d02 /* 7.13.2 */ {SSPI, CURL_VERSION_SSPI}, #endif -#ifdef CURL_VERSION_KERBEROS4 - {krb4, CURL_VERSION_KERBEROS4}, +#if LIBCURL_VERSION_NUM = 0x071504 /* 7.21.4 */ + {TLS-SRP, CURL_VERSION_TLSAUTH_SRP}, #endif -#ifdef CURL_VERSION_LIBZ - {libz, CURL_VERSION_LIBZ}, -#endif -#if LIBCURL_VERSION_NUM 0x070f03 /* 7.15.4 */ - {CharConv, CURL_VERSION_CONV}, -#endif {NULL, 0} }; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php