diff options
| author | Pierrick Charron <pierrick@php.net> | 2012-12-23 14:59:41 -0500 |
|---|---|---|
| committer | Pierrick Charron <pierrick@php.net> | 2012-12-23 14:59:41 -0500 |
| commit | 64595a5d1a51417ae518e124c61e1a9840d221a8 (patch) | |
| tree | 75a3933c4276026f4101047bccdc530f79e4d8c5 /ext/curl/multi.c | |
| parent | ded889e865825b41e9484a47bfbcbd4b6ed15d50 (diff) | |
| download | php-git-64595a5d1a51417ae518e124c61e1a9840d221a8.tar.gz | |
Add curl_multi_setopt and clean curl_share_setopt
curl_multi_setopt is now available and supports CURLMOPT_PIPELINING
and CURLMOPT_MAXCONNECTS
Diffstat (limited to 'ext/curl/multi.c')
| -rw-r--r-- | ext/curl/multi.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c index eedcb6abc3..48655ba6e4 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -359,6 +359,60 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ } /* }}} */ +#if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */ +static int _php_curl_multi_setopt(php_curlm *mh, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */ +{ + CURLMcode error = CURLM_OK; + + switch (option) { +#if LIBCURL_VERSION_NUM >= 0x071000 /* 7.16.0 */ + case CURLMOPT_PIPELINING: +#endif +#if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */ + case CURLMOPT_MAXCONNECTS: +#endif + convert_to_long_ex(zvalue); + error = curl_multi_setopt(mh->multi, option, Z_LVAL_PP(zvalue)); + break; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid curl multi configuration option"); + error = CURLM_UNKNOWN_OPTION; + break; + } + + if (error != CURLM_OK) { + return 1; + } else { + return 0; + } +} +/* }}} */ + + +/* {{{ proto int curl_multi_setopt(resource mh, int option, mixed value) + Set an option for the curl multi handle */ +PHP_FUNCTION(curl_multi_setopt) +{ + zval *z_mh, **zvalue; + long options; + php_curlm *mh; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlZ", &z_mh, &options, &zvalue) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); + + if (!_php_curl_multi_setopt(mh, options, zvalue, return_value TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ +#endif + #endif /* |
