summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierrick Charron <pierrick@php.net>2012-12-23 17:13:49 -0500
committerPierrick Charron <pierrick@php.net>2012-12-23 17:13:49 -0500
commit33f44af1a773d271ec96bbec445d625313195176 (patch)
treee9df7f0bb52bfaf971d13bccdff03555fd50fcb4
parent4b4f3db73142799da71be14d73938456e918b3ac (diff)
downloadphp-git-33f44af1a773d271ec96bbec445d625313195176.tar.gz
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.
-rw-r--r--ext/curl/interface.c39
-rw-r--r--ext/curl/php_curl.h4
2 files changed, 43 insertions, 0 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 21d4bb187c..06e5eb2ac5 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 2c97bcaca4..de8eb7efa5 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);