[PHP-DOC] cvs: php-src(PHP_5_3) /ext/curl interface.c php_curl.h
pajoye Sun May 3 14:59:46 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/curl interface.c php_curl.h Log: - [DOC] MFH: #41712, implement progress callback - add constants CURLOPT_PROGRESSFUNCTION http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.27.2.32&r2=1.62.2.14.2.27.2.33&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.32 php-src/ext/curl/interface.c:1.62.2.14.2.27.2.33 --- php-src/ext/curl/interface.c:1.62.2.14.2.27.2.32Mon Mar 16 15:08:56 2009 +++ php-src/ext/curl/interface.cSun May 3 14:59:46 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.62.2.14.2.27.2.32 2009/03/16 15:08:56 felipe Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.27.2.33 2009/05/03 14:59:46 pajoye Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -457,6 +457,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -902,6 +903,87 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + size_t rval = 0; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &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.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_READFUNCTION"); + length = -1; + } else if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) != IS_LONG) { + convert_to_long_ex(&retval_ptr); + } + if(0 != Z_LVAL_P(retval_ptr)) + rval = 1; + zval_ptr_dtor(&retval_ptr); + } + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return rval; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1195,6 +1277,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
[PHP-DOC] cvs: php-src /ext/curl interface.c php_curl.h
pajoye Sun May 3 14:58:06 2009 UTC Modified files: /php-src/ext/curl interface.c php_curl.h Log: - [DOC] #41712, implement progress callback - add constants CURLOPT_NOPROGRESS and CURLOPT_PROGRESSFUNCTION http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.149&r2=1.150&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.149 php-src/ext/curl/interface.c:1.150 --- php-src/ext/curl/interface.c:1.149 Mon Mar 16 15:05:21 2009 +++ php-src/ext/curl/interface.cSun May 3 14:58:06 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.149 2009/03/16 15:05:21 felipe Exp $ */ +/* $Id: interface.c,v 1.150 2009/05/03 14:58:06 pajoye Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -456,6 +456,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -902,6 +903,87 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + size_t rval = 0; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &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.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_READFUNCTION"); + length = -1; + } else if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) != IS_LONG) { + convert_to_long_ex(&retval_ptr); + } + if(0 != Z_LVAL_P(retval_ptr)) + rval = 1; + zval_ptr_dtor(&retval_ptr); + } + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return rval; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1199,6 +1281,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)); (*c
[PHP-DOC] Notes Status, 22308 total
Following are the top 20 pages of the manual, sorted by the number of user notes contributed. These sections could use a polish, those notes represent 7.2% of the 22308 total user notes. Notes | Page ---+- 90 | http://php.net/manual/en/function.strip-tags.php 88 | http://php.net/manual/en/function.round.php 86 | http://php.net/manual/en/function.strpos.php 85 | http://php.net/manual/en/function.htmlentities.php 84 | http://php.net/manual/en/function.curl-setopt.php 84 | http://php.net/manual/en/function.setcookie.php 83 | http://php.net/manual/en/function.fgetcsv.php 81 | http://php.net/manual/en/function.wordwrap.php 81 | http://php.net/manual/en/features.file-upload.php 80 | http://php.net/manual/en/function.date.php 80 | http://php.net/manual/en/ref.curl.php 79 | http://php.net/manual/en/function.flock.php 79 | http://php.net/manual/en/ref.mail.php 78 | http://php.net/manual/en/function.include.php 77 | http://php.net/manual/en/language.variables.scope.php 77 | http://php.net/manual/en/function.fsockopen.php 77 | http://php.net/manual/en/function.eval.php 77 | http://php.net/manual/en/ref.simplexml.php 76 | http://php.net/manual/en/ref.mssql.php 74 | http://php.net/manual/en/features.http-auth.php