[PHP-CVS] cvs: php-src /ext/curl multi.c

2006-12-06 Thread Ilia Alshanetsky
iliaa   Wed Dec  6 16:25:17 2006 UTC

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  Make functions as being unicode safe
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/multi.c?r1=1.28&r2=1.29&diff_format=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.28 php-src/ext/curl/multi.c:1.29
--- php-src/ext/curl/multi.c:1.28   Fri Oct  6 03:49:04 2006
+++ php-src/ext/curl/multi.cWed Dec  6 16:25:17 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.28 2006/10/06 03:49:04 sebastian Exp $ */
+/* $Id: multi.c,v 1.29 2006/12/06 16:25:17 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -49,7 +49,7 @@
 #include 
 #endif
 
-/* {{{ proto resource curl_multi_init(void)
+/* {{{ proto resource curl_multi_init(void) U
Returns a new cURL multi handle */
 PHP_FUNCTION(curl_multi_init)
 {
@@ -68,7 +68,7 @@
 }
 /* }}} */
 
-/* {{{ proto int curl_multi_add_handle(resource mh, resource ch)
+/* {{{ proto int curl_multi_add_handle(resource mh, resource ch) U
Add a normal cURL handle to a cURL multi handle */
 PHP_FUNCTION(curl_multi_add_handle)
 {
@@ -130,7 +130,7 @@
 }
 
 
-/* {{{ proto int curl_multi_remove_handle(resource mh, resource ch)
+/* {{{ proto int curl_multi_remove_handle(resource mh, resource ch) U
Remove a multi handle from a set of cURL handles */
 PHP_FUNCTION(curl_multi_remove_handle)
 {
@@ -164,7 +164,7 @@
to->tv_usec = conv % 100;
 }
 
-/* {{{ proto int curl_multi_select(resource mh[, double timeout])
+/* {{{ proto int curl_multi_select(resource mh[, double timeout]) U
Get all the sockets associated with the cURL extension, which can then be 
"selected" */
 PHP_FUNCTION(curl_multi_select)
 {
@@ -194,7 +194,7 @@
 }
 /* }}} */
 
-/* {{{ proto int curl_multi_exec(resource mh, int &still_running) 
+/* {{{ proto int curl_multi_exec(resource mh, int &still_running) U
Run the sub-connections of the current cURL handle */
 PHP_FUNCTION(curl_multi_exec)
 {
@@ -219,7 +219,7 @@
 }
 /* }}} */
 
-/* {{{ proto string curl_multi_getcontent(resource ch)
+/* {{{ proto string curl_multi_getcontent(resource ch) U
Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set */
 PHP_FUNCTION(curl_multi_getcontent)
 {
@@ -239,7 +239,7 @@
 }
 /* }}} */
 
-/* {{{ proto array curl_multi_info_read(resource mh [, long msgs_in_queue])
+/* {{{ proto array curl_multi_info_read(resource mh [, long msgs_in_queue]) U
Get information about the current transfers */
 PHP_FUNCTION(curl_multi_info_read)
 {
@@ -302,7 +302,7 @@
 }
 /* }}} */
 
-/* {{{ proto void curl_multi_close(resource mh)
+/* {{{ proto void curl_multi_close(resource mh) U
Close a set of cURL handles */
 PHP_FUNCTION(curl_multi_close)
 {

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2006-10-05 Thread Sebastian Bergmann
sebastian   Fri Oct  6 03:49:04 2006 UTC

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  MFB: Fix ZTS build.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/multi.c?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.27 php-src/ext/curl/multi.c:1.28
--- php-src/ext/curl/multi.c:1.27   Thu Oct  5 15:06:11 2006
+++ php-src/ext/curl/multi.cFri Oct  6 03:49:04 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.27 2006/10/05 15:06:11 tony2001 Exp $ */
+/* $Id: multi.c,v 1.28 2006/10/06 03:49:04 sebastian Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -102,6 +102,7 @@
 {
zval *z_ch = (zval *)data;
php_curl *ch;
+   TSRMLS_FETCH();
 
if (!z_ch) {
return;

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



[PHP-CVS] cvs: php-src /ext/curl multi.c php_curl.h

2006-10-05 Thread Antony Dovgal
tony2001Thu Oct  5 15:06:11 2006 UTC

  Modified files:  
/php-src/ext/curl   multi.c php_curl.h 
  Log:
  decrement ch->uses (or destroy handle) when destroying multi handle
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/multi.c?r1=1.26&r2=1.27&diff_format=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.26 php-src/ext/curl/multi.c:1.27
--- php-src/ext/curl/multi.c:1.26   Fri Sep 15 15:04:03 2006
+++ php-src/ext/curl/multi.cThu Oct  5 15:06:11 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.26 2006/09/15 15:04:03 tony2001 Exp $ */
+/* $Id: multi.c,v 1.27 2006/10/05 15:06:11 tony2001 Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -62,7 +62,7 @@
mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
 
-   zend_llist_init(&mh->easyh, sizeof(zval), (llist_dtor_func_t) NULL, 0);
+   zend_llist_init(&mh->easyh, sizeof(zval), _php_curl_multi_cleanup_list, 
0);
 
ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
 }
@@ -98,6 +98,27 @@
 }
 /* }}} */
 
+void _php_curl_multi_cleanup_list(void *data) /* {{{ */
+{
+   zval *z_ch = (zval *)data;
+   php_curl *ch;
+
+   if (!z_ch) {
+   return;
+   }
+   
+   ch = (php_curl *) zend_fetch_resource(&z_ch TSRMLS_CC, -1, 
le_curl_name, NULL, 1, le_curl);
+   if (!ch) {
+   return;
+   }
+
+   if (ch->uses) { 
+   ch->uses--;
+   } else {
+   zend_list_delete(Z_LVAL_P(z_ch));
+   }
+}
+/* }}} */
 
 /* Used internally as comparison routine passed to zend_list_del_element */
 static int curl_compare_resources( zval *z1, zval **z2 )
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/php_curl.h?r1=1.46&r2=1.47&diff_format=u
Index: php-src/ext/curl/php_curl.h
diff -u php-src/ext/curl/php_curl.h:1.46 php-src/ext/curl/php_curl.h:1.47
--- php-src/ext/curl/php_curl.h:1.46Sun Jan  1 13:09:48 2006
+++ php-src/ext/curl/php_curl.h Thu Oct  5 15:06:11 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_curl.h,v 1.46 2006/01/01 13:09:48 sniper Exp $ */
+/* $Id: php_curl.h,v 1.47 2006/10/05 15:06:11 tony2001 Exp $ */
 
 #ifndef _PHP_CURL_H
 #define _PHP_CURL_H
@@ -138,6 +138,7 @@
 } php_curlm;
 
 void _php_curl_cleanup_handle(php_curl *);
+void _php_curl_multi_cleanup_list(void *data);
 
 /* streams support */
 

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2006-09-15 Thread Antony Dovgal
tony2001Fri Sep 15 15:04:03 2006 UTC

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  fix segfault in curl_multi_info_read()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/multi.c?r1=1.25&r2=1.26&diff_format=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.25 php-src/ext/curl/multi.c:1.26
--- php-src/ext/curl/multi.c:1.25   Mon Sep  4 16:31:38 2006
+++ php-src/ext/curl/multi.cFri Sep 15 15:04:03 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.25 2006/09/04 16:31:38 iliaa Exp $ */
+/* $Id: multi.c,v 1.26 2006/09/15 15:04:03 tony2001 Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -62,7 +62,7 @@
mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
 
-   zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) NULL, 
0);
+   zend_llist_init(&mh->easyh, sizeof(zval), (llist_dtor_func_t) NULL, 0);
 
ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
 }
@@ -250,12 +250,12 @@
{
zend_llist_position pos;
php_curl *ch;
-   zval**pz_ch;
+   zval*pz_ch;
 
/* search the list of easy handles hanging off the multi-handle 
*/
-   for(pz_ch = (zval **)zend_llist_get_first_ex(&mh->easyh, &pos); 
pz_ch;
-   pz_ch = (zval **)zend_llist_get_next_ex(&mh->easyh, 
&pos)) {
-   ZEND_FETCH_RESOURCE(ch, php_curl *, pz_ch, -1, 
le_curl_name, le_curl);
+   for(pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); 
pz_ch;
+   pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, 
&pos)) {
+   ZEND_FETCH_RESOURCE(ch, php_curl *, &pz_ch, -1, 
le_curl_name, le_curl);
if (ch->cp == tmp_msg->easy_handle) {
 
/* we are adding a reference to the underlying 
php_curl
@@ -266,12 +266,12 @@
   SEPARATE_ZVAL, but those create new zvals, 
which is already
   being done in add_assoc_resource */
 
-   zend_list_addref( Z_RESVAL_PP( pz_ch ) );
+   zend_list_addref( Z_RESVAL_P( pz_ch ) );
 
/* add_assoc_resource automatically creates a 
new zval to 
   wrap the "resource" represented by the 
current pz_ch */
 
-   add_assoc_resource(return_value, "handle", 
Z_RESVAL_PP(pz_ch));
+   add_assoc_resource(return_value, "handle", 
Z_RESVAL_P(pz_ch));
 
break;
}

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2006-09-04 Thread Ilia Alshanetsky
iliaa   Mon Sep  4 16:31:38 2006 UTC

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  MFB: Fixed bug #38693 (curl_multi_add_handle() set curl handle to null).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/multi.c?r1=1.24&r2=1.25&diff_format=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.24 php-src/ext/curl/multi.c:1.25
--- php-src/ext/curl/multi.c:1.24   Sat Jun 10 22:59:40 2006
+++ php-src/ext/curl/multi.cMon Sep  4 16:31:38 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.24 2006/06/10 22:59:40 bjori Exp $ */
+/* $Id: multi.c,v 1.25 2006/09/04 16:31:38 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -62,7 +62,7 @@
mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
 
-   zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) 
ZVAL_PTR_DTOR, 0);
+   zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) NULL, 
0);
 
ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
 }
@@ -76,6 +76,7 @@
zval  *z_ch;
php_curlm *mh;
php_curl  *ch;
+   zval tmp_val;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &z_mh, 
&z_ch) == FAILURE) {
return;
@@ -87,11 +88,11 @@
_php_curl_cleanup_handle(ch);
ch->uses++;
 
-   /* we want to create a copy of this zval that we store in the 
multihandle
-  structure element "easyh" - so we separate it from the original
-  input zval to this function using SEPARATE_ZVAL */
-   SEPARATE_ZVAL( &z_ch );
-   zend_llist_add_element(&mh->easyh, &z_ch);
+   /* we want to create a copy of this zval that we store in the 
multihandle structure element "easyh" */
+   tmp_val = *z_ch;
+   zval_copy_ctor(&tmp_val);
+
+   zend_llist_add_element(&mh->easyh, &tmp_val);
 
RETURN_LONG((long) curl_multi_add_handle(mh->multi, ch->cp));   
 }
@@ -99,11 +100,11 @@
 
 
 /* Used internally as comparison routine passed to zend_list_del_element */
-static int curl_compare_resources( zval **z1, zval **z2 )
+static int curl_compare_resources( zval *z1, zval **z2 )
 {
-   return (Z_TYPE_PP( z1 ) == Z_TYPE_PP( z2 ) && 
-Z_TYPE_PP( z1 ) == IS_RESOURCE &&
-Z_LVAL_PP( z1 ) == Z_LVAL_PP( z2 ) );
+   return (Z_TYPE_P( z1 ) == Z_TYPE_PP( z2 ) && 
+Z_TYPE_P( z1 ) == IS_RESOURCE &&
+Z_LVAL_P( z1 ) == Z_LVAL_PP( z2 ) );
 }
 
 

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2005-09-08 Thread Ilia Alshanetsky
iliaa   Thu Sep  8 10:50:00 2005 EDT

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  Fixed bug #34420 (Possible crash inside curl_multi_remove_handle()).
  
  
http://cvs.php.net/diff.php/php-src/ext/curl/multi.c?r1=1.19&r2=1.20&ty=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.19 php-src/ext/curl/multi.c:1.20
--- php-src/ext/curl/multi.c:1.19   Wed Aug  3 10:06:44 2005
+++ php-src/ext/curl/multi.cThu Sep  8 10:49:58 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.19 2005/08/03 14:06:44 sniper Exp $ */
+/* $Id: multi.c,v 1.20 2005/09/08 14:49:58 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -111,8 +111,6 @@
ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, 
le_curl_multi_handle_name, le_curl_multi_handle);
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
 
-   zval_ptr_dtor(&z_ch);
-
--ch->uses;

RETURN_LONG((long) curl_multi_remove_handle(mh->multi, ch->cp));

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2004-09-10 Thread Sterling Hughes
sterlingFri Sep 10 16:36:46 2004 EDT

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  fix wrong check from return value, binary content should not be \0'd, 
  non-binary content should be \0'd.
  
  
http://cvs.php.net/diff.php/php-src/ext/curl/multi.c?r1=1.16&r2=1.17&ty=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.16 php-src/ext/curl/multi.c:1.17
--- php-src/ext/curl/multi.c:1.16   Wed Mar 10 19:27:16 2004
+++ php-src/ext/curl/multi.cFri Sep 10 16:36:45 2004
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.16 2004/03/11 00:27:16 iliaa Exp $ */
+/* $Id: multi.c,v 1.17 2004/09/10 20:36:45 sterling Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -195,7 +195,7 @@
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
 
if (ch->handlers->write->method == PHP_CURL_RETURN && 
ch->handlers->write->buf.len > 0) {
-   if (ch->handlers->write->type == PHP_CURL_BINARY) {
+   if (ch->handlers->write->type != PHP_CURL_BINARY) {
smart_str_0(&ch->handlers->write->buf);
}


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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2004-03-10 Thread Ilia Alshanetsky
iliaa   Wed Mar 10 19:27:17 2004 EDT

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  Readability++
  
  
http://cvs.php.net/diff.php/php-src/ext/curl/multi.c?r1=1.15&r2=1.16&ty=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.15 php-src/ext/curl/multi.c:1.16
--- php-src/ext/curl/multi.c:1.15   Wed Mar 10 19:11:18 2004
+++ php-src/ext/curl/multi.cWed Mar 10 19:27:16 2004
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.15 2004/03/11 00:11:18 iliaa Exp $ */
+/* $Id: multi.c,v 1.16 2004/03/11 00:27:16 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -62,7 +62,7 @@
mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
 
-   zend_llist_init(&(*mh).easyh, sizeof(zval *), (llist_dtor_func_t) 
ZVAL_PTR_DTOR, 0);
+   zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) ZVAL_PTR_DTOR, 
0);
 
ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
 }
@@ -89,7 +89,7 @@
_php_curl_cleanup_handle(ch);
ch->uses++;
 
-   zend_llist_add_element(&(*mh).easyh, &z_ch);
+   zend_llist_add_element(&mh->easyh, &z_ch);
 
RETURN_LONG((long) curl_multi_add_handle(mh->multi, ch->cp));   
 }
@@ -256,7 +256,7 @@
php_curlm *mh = (php_curlm *) rsrc->ptr;
if (mh) {
curl_multi_cleanup(mh->multi);
-   zend_llist_clean(&(*mh).easyh);
+   zend_llist_clean(&mh->easyh);
efree(mh);
rsrc->ptr = NULL;
}

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



[PHP-CVS] cvs: php-src /ext/curl multi.c

2004-03-09 Thread Ilia Alshanetsky
iliaa   Tue Mar  9 10:04:17 2004 EDT

  Modified files:  
/php-src/ext/curl   multi.c 
  Log:
  Fixed memory leak with curl_multi_init() de-initialization.
  
  
http://cvs.php.net/diff.php/php-src/ext/curl/multi.c?r1=1.13&r2=1.14&ty=u
Index: php-src/ext/curl/multi.c
diff -u php-src/ext/curl/multi.c:1.13 php-src/ext/curl/multi.c:1.14
--- php-src/ext/curl/multi.c:1.13   Thu Jan  8 03:14:37 2004
+++ php-src/ext/curl/multi.cTue Mar  9 10:04:16 2004
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: multi.c,v 1.13 2004/01/08 08:14:37 andi Exp $ */
+/* $Id: multi.c,v 1.14 2004/03/09 15:04:16 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -250,7 +250,11 @@
 void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
php_curlm *mh = (php_curlm *) rsrc->ptr;
-   curl_multi_cleanup(mh->multi);
+   if (mh) {
+   curl_multi_cleanup(mh->multi);
+   efree(mh);
+   rsrc->ptr = NULL;
+   }
/* XXX: keep track of all curl handles and zval_ptr_dtor them here */
 }
 

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