+ if (name_str && name_len) {
+ if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, HTTP_ZAPI_CONST_CAST(char *) name_str, name_len+1, (void *) &provider)) {
+ if (current_ident_only) {
+ if ((list = http_persistent_handle_list_find(provider TSRMLS_CC))) {
+ http_persistent_handle_list_dtor(list, provider->dtor);
+ http_persistent_handle_list_init(list);
+ }
+ } else {
+ FOREACH_HASH_VAL(pos1, &provider->list.free, listp) {
+ http_persistent_handle_list_dtor(*listp, provider->dtor);
+ http_persistent_handle_list_init(*listp);
+ }
+ }
+ }
+ } else {
+ FOREACH_HASH_VAL(pos1, &http_persistent_handles_hash, provider) {
+ if (current_ident_only) {
+ if ((list = http_persistent_handle_list_find(provider TSRMLS_CC))) {
+ http_persistent_handle_list_dtor(list, provider->dtor);
+ http_persistent_handle_list_init(list);
+ }
+ } else {
+ FOREACH_HASH_VAL(pos2, &provider->list.free, listp) {
+ http_persistent_handle_list_dtor(*listp, provider->dtor);
+ http_persistent_handle_list_init(*listp);
+ }
+ }
+ }
+ }
+ UNLOCK();
+}
+
+PHP_HTTP_API HashTable *_http_persistent_handle_statall_ex(HashTable *ht TSRMLS_DC)
+{
+ zval *zentry[2];
+ HashPosition pos1, pos2;
+ HashKey key1 = initHashKey(0), key2 = initHashKey(0);
+ http_persistent_handle_provider *provider;
+ http_persistent_handle_list **list;
+
+ LOCK();
+ if (zend_hash_num_elements(&http_persistent_handles_hash)) {
+ if (!ht) {
+ ALLOC_HASHTABLE(ht);
+ zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ }
+
+ FOREACH_HASH_KEYVAL(pos1, &http_persistent_handles_hash, key1, provider) {
+ MAKE_STD_ZVAL(zentry[0]);
+ array_init(zentry[0]);
+
+ FOREACH_HASH_KEYVAL(pos2, &provider->list.free, key2, list) {
+ MAKE_STD_ZVAL(zentry[1]);
+ array_init(zentry[1]);
+ add_assoc_long_ex(zentry[1], ZEND_STRS("used"), (*list)->used);
+ add_assoc_long_ex(zentry[1], ZEND_STRS("free"), zend_hash_num_elements(&(*list)->free));
+
+ /* use zend_hash_* not add_assoc_* (which is zend_symtable_*) as we want a string even for numbers */
+ zend_hash_add(Z_ARRVAL_P(zentry[0]), key2.str, key2.len, &zentry[1], sizeof(zval *), NULL);
+ }
+
+ zend_hash_add(ht, key1.str, key1.len, &zentry[0], sizeof(zval *), NULL);