summaryrefslogtreecommitdiff
path: root/ext/curl/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r--ext/curl/interface.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 35cc1d996..610861eb5 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c 298299 2010-04-22 08:58:07Z pajoye $ */
+/* $Id: interface.c 305850 2010-11-30 13:40:02Z iliaa $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -1252,7 +1252,6 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
/* }}} */
#endif
-#if LIBCURL_VERSION_NUM < 0x071101
/* {{{ curl_free_string
*/
static void curl_free_string(void **string)
@@ -1260,7 +1259,6 @@ static void curl_free_string(void **string)
efree(*string);
}
/* }}} */
-#endif
/* {{{ curl_free_post
*/
@@ -1337,9 +1335,7 @@ static void alloc_curl_handle(php_curl **ch)
memset(&(*ch)->err, 0, sizeof((*ch)->err));
-#if LIBCURL_VERSION_NUM < 0x071101
zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
-#endif
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);
}
@@ -1556,11 +1552,10 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_INFILE, (void *) dupch);
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
-#if LIBCURL_VERSION_NUM < 0x071101
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;
-#endif
+
zend_llist_copy(&dupch->to_free.slist, &ch->to_free.slist);
zend_llist_copy(&dupch->to_free.post, &ch->to_free.post);
@@ -1742,14 +1737,22 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
return 1;
}
} else {
+ if (option == CURLOPT_PRIVATE) {
+ char *copystr;
+#if LIBCURL_VERSION_NUM < 0x071100
+string_copy:
+#endif
+ copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
+ error = curl_easy_setopt(ch->cp, option, copystr);
+ zend_llist_add_element(&ch->to_free.str, &copystr);
+ } else {
#if LIBCURL_VERSION_NUM >= 0x071100
- /* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
- error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
-#else
- copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
- error = curl_easy_setopt(ch->cp, option, copystr);
- zend_llist_add_element(&ch->to_free.str, &copystr);
+ /* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
+ error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
+#else
+ goto string_copy;
#endif
+ }
}
break;
}
@@ -1761,7 +1764,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
int type;
void * what;
- what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
+ what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream());
if (!what) {
RETVAL_FALSE;
return 1;
@@ -1816,7 +1819,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
}
zval_add_ref(zvalue);
ch->handlers->std_err = *zvalue;
- zend_list_addref(Z_LVAL_PP(zvalue));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
RETVAL_FALSE;
@@ -2457,9 +2459,7 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
}
curl_easy_cleanup(ch->cp);
-#if LIBCURL_VERSION_NUM < 0x071101
zend_llist_clean(&ch->to_free.str);
-#endif
/* cURL destructors should be invoked only by last curl handle */
if (Z_REFCOUNT_P(ch->clone) <= 1) {