summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
commit993e1866df547532a05ab6db76c9ff5aefc9a3df (patch)
tree169d3bde0974235d3cde164786ef6f381a4749a7 /ext/curl
parent1f589a2bd44ba835ad1b009a5d83abd453724829 (diff)
downloadphp-upstream/5.2.6.tar.gz
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/interface.c22
-rw-r--r--ext/curl/multi.c14
-rw-r--r--ext/curl/php_curl.h4
-rw-r--r--ext/curl/streams.c4
4 files changed, 25 insertions, 19 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 683c36aec..ff702f20b 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.62.2.14.2.29 2007/10/13 11:35:35 bjori Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.34 2008/01/06 17:12:29 iliaa Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -153,7 +153,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v);
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v);
-#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
+#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ""), 1);
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#if defined(PHP_WIN32) || defined(__GNUC__)
@@ -173,7 +173,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
php_curl_ret(__ret); \
} \
\
- if (!php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
+ if (tmp_url->host || !php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL '%s' contains unencoded control characters", str); \
php_url_free(tmp_url); \
php_curl_ret(__ret); \
@@ -931,7 +931,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
}
/* }}} */
-static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx)
+static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx) /* {{{ */
{
php_curl *ch = (php_curl *) ctx;
@@ -947,6 +947,7 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v
return 0;
}
+/* }}} */
#if CURLOPT_PASSWDFUNCTION != 0
/* {{{ curl_passwd
@@ -1074,9 +1075,9 @@ static void alloc_curl_handle(php_curl **ch)
memset(&(*ch)->err, 0, sizeof((*ch)->err));
- zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (void(*)(void *)) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (void(*)(void *)) curl_free_slist, 0);
- zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (void(*)(void *)) curl_free_post, 0);
+ zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
+ zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
+ zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
}
/* }}} */
@@ -1204,6 +1205,8 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
zend_llist_copy(&dupch->to_free.str, &ch->to_free.str);
+ /* Don't try to free copied strings, they're free'd when the original handle is destroyed */
+ dupch->to_free.str.dtor = NULL;
zend_llist_copy(&dupch->to_free.slist, &ch->to_free.slist);
zend_llist_copy(&dupch->to_free.post, &ch->to_free.post);
@@ -1212,7 +1215,7 @@ PHP_FUNCTION(curl_copy_handle)
}
/* }}} */
-static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC)
+static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
CURLcode error=CURLE_OK;
@@ -1601,6 +1604,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
return 0;
}
}
+/* }}} */
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
Set an option for a cURL transfer */
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 6d66b5fad..cefc5f441 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: multi.c,v 1.19.2.3.2.7 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: multi.c,v 1.19.2.3.2.9 2007/12/31 07:20:05 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -122,13 +122,13 @@ void _php_curl_multi_cleanup_list(void *data) /* {{{ */
/* }}} */
/* 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_P( z1 ) == Z_TYPE_PP( z2 ) &&
Z_TYPE_P( z1 ) == IS_RESOURCE &&
Z_LVAL_P( z1 ) == Z_LVAL_PP( z2 ) );
}
-
+/* }}} */
/* {{{ proto int curl_multi_remove_handle(resource mh, resource ch)
Remove a multi handle from a set of cURL handles */
@@ -155,7 +155,7 @@ PHP_FUNCTION(curl_multi_remove_handle)
}
/* }}} */
-static void _make_timeval_struct(struct timeval *to, double timeout)
+static void _make_timeval_struct(struct timeval *to, double timeout) /* {{{ */
{
unsigned long conv;
@@ -163,6 +163,7 @@ static void _make_timeval_struct(struct timeval *to, double timeout)
to->tv_sec = conv / 1000000;
to->tv_usec = conv % 1000000;
}
+/* }}} */
/* {{{ proto int curl_multi_select(resource mh[, double timeout])
Get all the sockets associated with the cURL extension, which can then be "selected" */
@@ -319,7 +320,7 @@ PHP_FUNCTION(curl_multi_close)
}
/* }}} */
-void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
{
php_curlm *mh = (php_curlm *) rsrc->ptr;
if (mh) {
@@ -329,6 +330,7 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
rsrc->ptr = NULL;
}
}
+/* }}} */
#endif
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 676671c4d..b17df0a77 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_curl.h,v 1.44.2.2.2.2 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_curl.h,v 1.44.2.2.2.3 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef _PHP_CURL_H
#define _PHP_CURL_H
diff --git a/ext/curl/streams.c b/ext/curl/streams.c
index b112bae83..2d73f25c8 100644
--- a/ext/curl/streams.c
+++ b/ext/curl/streams.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.14.2.2.2.11 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: streams.c,v 1.14.2.2.2.12 2007/12/31 07:20:05 sebastian Exp $ */
/* This file implements cURL based wrappers.
* NOTE: If you are implementing your own streams that are intended to