com php-src: New curl_pause() function: ext/curl/in terface.c ext/curl/php_curl.h
| From: | Pierrick Charron | Date: | Sun, 23 Dec 2012 22:13:49 +0000 |
| Subject: | com php-src: New curl_pause() function: ext/curl/in terface.c ext/curl/php_curl.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70803@lists.php.net to get a copy of this message | ||
Commit: 33f44af1a773d271ec96bbec445d625313195176
Author: Pierrick Charron <pierrick@php.net> Sun, 23 Dec 2012 17:13:49 -0500
Parents: 4b4f3db73142799da71be14d73938456e918b3ac
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=33f44af1a773d271ec96bbec445d625313195176
Log:
New curl_pause() function
Add the curl_pause function (binding of curl_easy_pause).
Using this function, you can explicitly mark a running connection
to get paused, and you can unpause a connection that was
previously paused.
Changed paths:
M ext/curl/interface.c
M ext/curl/php_curl.h
Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 21d4bb1...06e5eb2 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -396,6 +396,13 @@ ZEND_BEGIN_ARG_INFO(arginfo_curl_share_setopt, 0)
ZEND_ARG_INFO(0, option)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7..18.0 */
+ZEND_BEGIN_ARG_INFO(arginfo_curl_pause, 0)
+ ZEND_ARG_INFO(0, ch)
+ ZEND_ARG_INFO(0, bitmask)
+ZEND_END_ARG_INFO()
+#endif
/* }}} */
/* {{{ curl_functions[]
@@ -422,6 +429,9 @@ const zend_function_entry curl_functions[] = {
PHP_FE(curl_escape, arginfo_curl_escape)
PHP_FE(curl_unescape, arginfo_curl_unescape)
#endif
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+ PHP_FE(curl_pause, arginfo_curl_pause)
+#endif
PHP_FE(curl_multi_init, arginfo_curl_multi_init)
PHP_FE(curl_multi_add_handle, arginfo_curl_multi_add_handle)
PHP_FE(curl_multi_remove_handle, arginfo_curl_multi_remove_handle)
@@ -999,6 +1009,14 @@ PHP_MINIT_FUNCTION(curl)
#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TRANSFER_MODE);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_ALL);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_CONT);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_RECV);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_RECV_CONT);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_SEND);
+ REGISTER_CURL_CONSTANT(CURLPAUSE_SEND_CONT);
+ REGISTER_CURL_CONSTANT(CURL_READFUNC_PAUSE);
+ REGISTER_CURL_CONSTANT(CURL_WRITEFUNC_PAUSE);
#endif
#if LIBCURL_VERSION_NUM >= 0x071202 /* Available since 7.18.2 */
@@ -3417,8 +3435,29 @@ PHP_FUNCTION(curl_unescape)
RETURN_FALSE;
}
}
+/* }}} */
#endif
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+/* {{{ proto void curl_pause(resource ch, int bitmask)
+ pause and unpause a connection */
+PHP_FUNCTION(curl_pause)
+{
+ long bitmask;
+ zval *zid;
+ php_curl *ch;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zid, &bitmask) ==
FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
+
+ RETURN_LONG(curl_easy_pause(ch->cp, bitmask));
+}
/* }}} */
+#endif
+
#endif /* HAVE_CURL */
/*
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 2c97bca..de8eb7e 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -100,6 +100,10 @@ PHP_FUNCTION(curl_unescape);
PHP_FUNCTION(curl_multi_setopt);
#endif
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+PHP_FUNCTION(curl_pause);
+#endif
+
void _php_curl_multi_close(zend_rsrc_list_entry * TSRMLS_DC);
void _php_curl_share_close(zend_rsrc_list_entry * TSRMLS_DC);