X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_functions.c;h=c4e358d2fe2939501fcde5c8fad0b3cf4b3898ff;hp=c156c8a3f794ac761cc08821a83e741b7f246fa3;hb=fa6e9a361695e1c273266c79d0d27ff19059bb8a;hpb=a0c54cae89e6c61a7f76037aa891898e6bd86e15 diff --git a/http_functions.c b/http_functions.c index c156c8a..c4e358d 100644 --- a/http_functions.c +++ b/http_functions.c @@ -34,6 +34,7 @@ #include "php_http_message_api.h" #include "php_http_request_api.h" #include "php_http_request_method_api.h" +#include "php_http_persistent_handle_api.h" #include "php_http_send_api.h" #include "php_http_url_api.h" @@ -807,6 +808,42 @@ PHP_FUNCTION(http_match_request_header) /* {{{ HAVE_CURL */ #ifdef HTTP_HAVE_CURL +#ifdef HTTP_HAVE_PERSISTENT_HANDLES + +/* {{{ proto object http_persistent_handles_count() */ +PHP_FUNCTION(http_persistent_handles_count) +{ + char **names; + int *counts; + int i, n; + + NO_ARGS; + + if ((n = http_persistent_handle_statall(&names, &counts))) { + object_init(return_value); + for (i = 0; i < n; ++i) { + add_property_long(return_value, names[i], counts[i]); + efree(names[i]); + } + efree(names); + efree(counts); + } +} +/* }}} */ + +/* {{{ proto void http_persistent_handles_clean([string name]) */ +PHP_FUNCTION(http_persistent_handles_clean) +{ + char *name_str = NULL; + int name_len = 0; + + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name_str, &name_len)) { + http_persistent_handle_cleanup_ex(name_str, name_len); + } +} +/* }}} */ + +#endif /* HTTP_HAVE_PERSISTENT_HANDLES */ #define RETVAL_RESPONSE_OR_BODY(request) \ { \