- reimplement persistent handle code
authorMichael Wallner <mike@php.net>
Sun, 4 Feb 2007 22:10:51 +0000 (22:10 +0000)
committerMichael Wallner <mike@php.net>
Sun, 4 Feb 2007 22:10:51 +0000 (22:10 +0000)
http.c
http_api.c
http_functions.c
http_persistent_handle_api.c
http_request_api.c
php_http.h
php_http_api.h
php_http_persistent_handle_api.h
php_http_request_api.h

diff --git a/http.c b/http.c
index e55b35f..e57263c 100644 (file)
--- a/http.c
+++ b/http.c
@@ -108,6 +108,7 @@ zend_function_entry http_functions[] = {
 #      ifdef HTTP_HAVE_PERSISTENT_HANDLES
        PHP_FE(http_persistent_handles_count, NULL)
        PHP_FE(http_persistent_handles_clean, NULL)
+       PHP_FE(http_persistent_handles_ident, NULL)
 #      endif
        PHP_FE(http_get, http_arg_pass_ref_3)
        PHP_FE(http_head, http_arg_pass_ref_3)
@@ -199,7 +200,6 @@ static inline void _http_globals_init(zend_http_globals *G TSRMLS_DC)
        G->request.time = time(NULL);
 #endif
        G->send.buffer_size = 0;
-       G->send.not_found_404 = 1;
        G->read_post_data = 0;
 }
 
@@ -240,6 +240,13 @@ PHP_INI_MH(http_update_allowed_methods)
        http_check_allowed_methods(new_value, new_value_length);
        return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
 }
+#ifdef HTTP_HAVE_PERSISTENT_HANDLES
+PHP_INI_MH(http_update_persistent_handle_ident)
+{
+       HTTP_G->persistent.handles.ident.h = zend_get_hash_value(new_value, HTTP_G->persistent.handles.ident.l = new_value_length+1);
+       return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+}
+#endif
 
 #ifndef ZEND_ENGINE_2
 #      define OnUpdateLong OnUpdateInt
@@ -265,6 +272,9 @@ PHP_INI_BEGIN()
        HTTP_PHP_INI_ENTRY("http.send.inflate.start_flags", "0", PHP_INI_ALL, OnUpdateLong, send.inflate.start_flags)
        HTTP_PHP_INI_ENTRY("http.send.deflate.start_auto", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, send.deflate.start_auto)
        HTTP_PHP_INI_ENTRY("http.send.deflate.start_flags", "0", PHP_INI_ALL, OnUpdateLong, send.deflate.start_flags)
+#endif
+#ifdef HTTP_HAVE_PERSISTENT_HANDLES
+       HTTP_PHP_INI_ENTRY("http.persistent.handles.ident", "GLOBAL", PHP_INI_ALL, http_update_persistent_handle_ident, persistent.handles.ident.s)
 #endif
        HTTP_PHP_INI_ENTRY("http.send.not_found_404", "1", PHP_INI_ALL, OnUpdateBool, send.not_found_404)
 #ifdef ZEND_ENGINE_2
@@ -479,7 +489,7 @@ PHP_MINFO_FUNCTION(http)
 #else
                php_info_print_table_row(3, "libz", "disabled", "disabled");
 #endif
-#if defined(HTTP_HAVE_MAGIC) && !defined(WONKY)
+#if defined(HTTP_HAVE_MAGIC)
                php_info_print_table_row(3, "libmagic", "unknown", "unknown");
 #else
                php_info_print_table_row(3, "libmagic", "disabled", "disabled");
index 978d47a..ea3876f 100644 (file)
@@ -32,6 +32,7 @@ PHP_MINIT_FUNCTION(http_support)
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_MAGICMIME", HTTP_SUPPORT_MAGICMIME);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_ENCODINGS", HTTP_SUPPORT_ENCODINGS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_SSLREQUESTS", HTTP_SUPPORT_SSLREQUESTS);
+       HTTP_LONG_CONSTANT("HTTP_SUPPORT_PERSISTENCE", HTTP_SUPPORT_PERSISTENCE);
        
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_COMMA", HTTP_PARAMS_ALLOW_COMMA);
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_FAILURE", HTTP_PARAMS_ALLOW_FAILURE);
@@ -50,6 +51,9 @@ PHP_HTTP_API long _http_support(long feature)
 #      ifdef HTTP_HAVE_SSL
        support |= HTTP_SUPPORT_SSLREQUESTS;
 #      endif
+#      ifdef HTTP_HAVE_PERSISTENT_HANDLES
+       support |= HTTP_SUPPORT_PERSISTENCE;
+#      endif
 #endif
 #ifdef HTTP_HAVE_MAGIC
        support |= HTTP_SUPPORT_MAGICMIME;
index 511230e..83764e9 100644 (file)
@@ -810,7 +810,6 @@ PHP_FUNCTION(http_match_request_header)
 PHP_FUNCTION(http_persistent_handles_count)
 {
        NO_ARGS;
-       
        object_init(return_value);
        if (!http_persistent_handle_statall_ex(HASH_OF(return_value))) {
                zval_dtor(return_value);
@@ -826,7 +825,20 @@ PHP_FUNCTION(http_persistent_handles_clean)
        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);
+               http_persistent_handle_cleanup_ex(name_str, name_len, 1);
+       }
+}
+/* }}} */
+
+/* {{{ proto string http_persistent_handles_ident(string ident) */
+PHP_FUNCTION(http_persistent_handles_ident)
+{
+       char *ident_str = "";
+       int ident_len = 0;
+       
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ident_str, &ident_len)) {
+               RETVAL_STRING(zend_ini_string(ZEND_STRS("http.persistent.handles.ident"), 0), 1);
+               zend_alter_ini_entry(ZEND_STRS("http.persistent.handles.ident"), ident_str, ident_len, ZEND_INI_USER, PHP_INI_STAGE_RUNTIME);
        }
 }
 /* }}} */
index c89c539..a2e0ba9 100644 (file)
@@ -28,34 +28,34 @@ static MUTEX_T http_persistent_handles_lock;
 #      define UNLOCK()
 #endif
 
-typedef struct _http_persistent_handles_hash_entry_t {
-       HashTable list;
+typedef struct _http_persistent_handle_t {
+       void *ptr;
+} http_persistent_handle;
+
+typedef HashTable *http_persistent_handle_list;
+
+typedef struct _http_persistent_handle_provider_t {
+       http_persistent_handle_list list; /* "ident" => array(handles) entries */
        http_persistent_handle_ctor ctor;
        http_persistent_handle_dtor dtor;
-} http_persistent_handles_hash_entry;
+} http_persistent_handle_provider;
 
-typedef struct _http_persistent_handles_list_entry_t {
-       void *handle;
-} http_persistent_handles_list_entry;
-
-static inline void http_persistent_handles_hash_dtor_ex(http_persistent_handles_hash_entry *hentry, void (*list_dtor)(HashTable*))
+static void http_persistent_handles_hash_dtor(void *p)
 {
-       http_persistent_handles_list_entry *lentry;
+       http_persistent_handle_provider *provider = (http_persistent_handle_provider *) p;
+       http_persistent_handle_list *list;
+       http_persistent_handle *handle;
+       HashPosition pos1, pos2;
        
-       for (   zend_hash_internal_pointer_reset(&hentry->list);
-                       SUCCESS == zend_hash_get_current_data(&hentry->list, (void *) &lentry);
-                       zend_hash_move_forward(&hentry->list)) {
-               hentry->dtor(lentry->handle);
-       }
-       
-       if (list_dtor) {
-               list_dtor(&hentry->list);
+       FOREACH_HASH_VAL(pos1, provider->list, list) {
+               FOREACH_HASH_VAL(pos2, *list, handle) {
+                       provider->dtor(handle->ptr);
+               }
+               zend_hash_destroy(*list);
+               pefree(*list, 1);
        }
-}
-
-static void http_persistent_handles_hash_dtor(void *h)
-{
-       http_persistent_handles_hash_dtor_ex(h, zend_hash_destroy);
+       zend_hash_destroy(provider->list);
+       pefree(provider->list, 1);
 }
 
 PHP_MINIT_FUNCTION(http_persistent_handle)
@@ -78,109 +78,158 @@ PHP_MSHUTDOWN_FUNCTION(http_persistent_handle)
 
 PHP_HTTP_API STATUS _http_persistent_handle_provide_ex(const char *name_str, size_t name_len, http_persistent_handle_ctor ctor, http_persistent_handle_dtor dtor)
 {
-       STATUS status = SUCCESS;
-       http_persistent_handles_hash_entry e;
-       
-       zend_hash_init(&e.list, 0, NULL, NULL, 1);
-       e.ctor = ctor;
-       e.dtor = dtor;
+       STATUS status = FAILURE;
+       http_persistent_handle_provider provider;
        
        LOCK();
-       if (SUCCESS != zend_hash_add(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &e, sizeof(http_persistent_handles_hash_entry), NULL)) {
-               zend_hash_destroy(&e.list);
-               status = FAILURE;
+       provider.list = pemalloc(sizeof(HashTable), 1);
+       if (provider.list) {
+               provider.ctor = ctor;
+               provider.dtor = dtor;
+               zend_hash_init(provider.list, 0, NULL, NULL, 1);
+               if (SUCCESS == zend_hash_add(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &provider, sizeof(http_persistent_handle_provider), NULL)) {
+                       status = SUCCESS;
+               } else {
+                       pefree(provider.list, 1);
+               }
        }
        UNLOCK();
        
        return status;
 }
 
-PHP_HTTP_API void _http_persistent_handle_cleanup_ex(const char *name_str, size_t name_len)
+PHP_HTTP_API STATUS _http_persistent_handle_acquire_ex(const char *name_str, size_t name_len, void **handle_ptr TSRMLS_DC)
 {
-       http_persistent_handles_hash_entry *hentry;
+       STATUS status = FAILURE;
+       ulong index;
+       http_persistent_handle_provider *provider;
+       http_persistent_handle_list *list;
+       http_persistent_handle *handle;
        
+       *handle_ptr = NULL;
        LOCK();
-       if (name_str && name_len) {
-               if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &hentry)) {
-                       http_persistent_handles_hash_dtor_ex(hentry, zend_hash_clean);
+       if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &provider)) {
+               if (SUCCESS == zend_hash_quick_find(provider->list, HTTP_G->persistent.handles.ident.s, HTTP_G->persistent.handles.ident.l, HTTP_G->persistent.handles.ident.h, (void *) &list)) {
+                       zend_hash_internal_pointer_end(*list);
+                       if (HASH_KEY_NON_EXISTANT != zend_hash_get_current_key(*list, NULL, &index, 0) && SUCCESS == zend_hash_get_current_data(*list, (void *) &handle)) {
+                               *handle_ptr = handle->ptr;
+                               zend_hash_index_del(*list, index);
+                       }
                }
-       } else {
-               for (   zend_hash_internal_pointer_reset(&http_persistent_handles_hash);
-                               SUCCESS == zend_hash_get_current_data(&http_persistent_handles_hash, (void *) &hentry);
-                               zend_hash_move_forward(&http_persistent_handles_hash)) {
-                       http_persistent_handles_hash_dtor_ex(hentry, zend_hash_clean);
+               if (*handle_ptr || (*handle_ptr = provider->ctor())) {
+                       status = SUCCESS;
                }
        }
        UNLOCK();
+       
+       return status;
 }
 
-PHP_HTTP_API HashTable *_http_persistent_handle_statall_ex(HashTable *ht)
+PHP_HTTP_API STATUS _http_persistent_handle_release_ex(const char *name_str, size_t name_len, void **handle_ptr TSRMLS_DC)
 {
-       zval *tmp;
-       HashPosition pos;
-       HashKey key = initHashKey(0);
-       http_persistent_handles_hash_entry *hentry;
+       STATUS status = FAILURE;
+       http_persistent_handle_provider *provider;
+       http_persistent_handle_list *list, new_list;
+       http_persistent_handle handle = {*handle_ptr};
        
        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(pos, &http_persistent_handles_hash, key, hentry) {
-                       MAKE_STD_ZVAL(tmp);
-                       ZVAL_LONG(tmp, zend_hash_num_elements(&hentry->list));
-                       zend_hash_add(ht, key.str, key.len, (void *) &tmp, sizeof(zval *), NULL);
+       if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &provider)) {
+               if (SUCCESS == zend_hash_quick_find(provider->list, HTTP_G->persistent.handles.ident.s, HTTP_G->persistent.handles.ident.l, HTTP_G->persistent.handles.ident.h, (void *) &list)) {
+                       status = zend_hash_next_index_insert(*list, (void *) &handle, sizeof(http_persistent_handle), NULL);
+               } else if ((new_list = pemalloc(sizeof(HashTable), 1))) {
+                       zend_hash_init(new_list, 0, NULL, NULL, 1);
+                       if (    SUCCESS == zend_hash_next_index_insert(new_list, (void *) &handle, sizeof(http_persistent_handle), NULL) &&
+                                       SUCCESS == zend_hash_quick_add(provider->list, HTTP_G->persistent.handles.ident.s, HTTP_G->persistent.handles.ident.l, HTTP_G->persistent.handles.ident.h, (void *) &new_list, sizeof(http_persistent_handle_list *), NULL)) {
+                               status = SUCCESS;
+                       } else {
+                               pefree(new_list, 1);
+                       }
                }
-       } else if (ht) {
-               ht = NULL;
        }
        UNLOCK();
        
-       return ht;
+       return status;
 }
-
-PHP_HTTP_API STATUS _http_persistent_handle_acquire_ex(const char *name_str, size_t name_len, void **handle)
+       
+PHP_HTTP_API void _http_persistent_handle_cleanup_ex(const char *name_str, size_t name_len, int current_ident_only TSRMLS_DC)
 {
-       STATUS status = FAILURE;
-       ulong index;
-       http_persistent_handles_hash_entry *hentry;
-       http_persistent_handles_list_entry *lentry;
+       http_persistent_handle_provider *provider;
+       http_persistent_handle_list *list;
+       http_persistent_handle *handle;
+       HashPosition pos1, pos2, pos3;
        
        LOCK();
-       if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &hentry)) {
-               zend_hash_internal_pointer_end(&hentry->list);
-               if (    HASH_KEY_NON_EXISTANT != zend_hash_get_current_key(&hentry->list, NULL, &index, 0) &&
-                               SUCCESS == zend_hash_get_current_data(&hentry->list, (void *) &lentry)) {
-                       *handle = lentry->handle;
-                       zend_hash_index_del(&hentry->list, index);
-                       status = SUCCESS;
-               } else if ((*handle = hentry->ctor())) {
-                       status = SUCCESS;
+       if (name_str && name_len) {
+               if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &provider)) {
+                       if (current_ident_only) {
+                               if (SUCCESS == zend_hash_quick_find(provider->list, HTTP_G->persistent.handles.ident.s, HTTP_G->persistent.handles.ident.l, HTTP_G->persistent.handles.ident.h, (void *) &list)) {
+                                       FOREACH_HASH_VAL(pos1, *list, handle) {
+                                               provider->dtor(handle->ptr);
+                                       }
+                                       zend_hash_clean(*list);
+                               }
+                       } else {
+                               FOREACH_HASH_VAL(pos1, provider->list, list) {
+                                       FOREACH_HASH_VAL(pos2, *list, handle) {
+                                               provider->dtor(handle->ptr);
+                                       }
+                                       zend_hash_clean(*list);
+                               }
+                       }
+               }
+       } else {
+               FOREACH_HASH_VAL(pos1, &http_persistent_handles_hash, provider) {
+                       if (current_ident_only) {
+                               if (SUCCESS == zend_hash_quick_find(provider->list, HTTP_G->persistent.handles.ident.s, HTTP_G->persistent.handles.ident.l, HTTP_G->persistent.handles.ident.h, (void *) &list)) {
+                                       FOREACH_HASH_VAL(pos2, *list, handle) {
+                                               provider->dtor(handle->ptr);
+                                       }
+                                       zend_hash_clean(*list);
+                               }
+                       } else {
+                               FOREACH_HASH_VAL(pos2, provider->list, list) {
+                                       FOREACH_HASH_VAL(pos3, *list, handle) {
+                                               provider->dtor(handle->ptr);
+                                       }
+                                       zend_hash_clean(*list);
+                               }
+                       }
                }
        }
        UNLOCK();
-       
-       return status;
 }
 
-PHP_HTTP_API STATUS _http_persistent_handle_release_ex(const char *name_str, size_t name_len, void **handle)
+PHP_HTTP_API HashTable *_http_persistent_handle_statall_ex(HashTable *ht)
 {
-       STATUS status = FAILURE;
-       http_persistent_handles_hash_entry *hentry;
-       http_persistent_handles_list_entry lentry;
+       zval *zlist, *zentry;
+       HashPosition pos1, pos2;
+       HashKey key1 = initHashKey(0), key2 = initHashKey(0);
+       http_persistent_handle_provider *provider;
+       http_persistent_handle_list *list;
        
        LOCK();
-       if (SUCCESS == zend_hash_find(&http_persistent_handles_hash, (char *) name_str, name_len+1, (void *) &hentry)) {
-               lentry.handle = *handle;
-               if (SUCCESS == zend_hash_next_index_insert(&hentry->list, (void *) &lentry, sizeof(http_persistent_handles_list_entry), NULL)) {
-                       status = SUCCESS;
+       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(zlist);
+                       array_init(zlist);
+                       FOREACH_HASH_KEYVAL(pos2, provider->list, key2, list) {
+                               MAKE_STD_ZVAL(zentry);
+                               ZVAL_LONG(zentry, zend_hash_num_elements(*list));
+                               zend_hash_quick_add(Z_ARRVAL_P(zlist), key2.str, key2.len, key2.num, (void *) &zentry, sizeof(zval *), NULL);
+                       }
+                       zend_hash_quick_add(ht, key1.str, key1.len, key1.num, (void *) &zlist, sizeof(zval *), NULL);
                }
+       } else if (ht) {
+               ht = NULL;
        }
        UNLOCK();
        
-       return status;
+       return ht;
 }
 
 #endif /* HTTP_HAVE_PERSISTENT_HANDLES */
index 289cac4..7b6aee3 100644 (file)
@@ -194,7 +194,7 @@ static curlioerr http_curl_ioctl_callback(CURL *, curliocmd, void *);
 #endif
 
 /* {{{ CURL *http_curl_init(http_request *) */
-PHP_HTTP_API CURL * _http_curl_init_ex(CURL *ch, http_request *request)
+PHP_HTTP_API CURL * _http_curl_init_ex(CURL *ch, http_request *request TSRMLS_DC)
 {
        if (ch || HTTP_CURL_HANDLE_CTOR(ch)) {
 #if defined(ZTS)
@@ -228,7 +228,7 @@ PHP_HTTP_API CURL * _http_curl_init_ex(CURL *ch, http_request *request)
 /* }}} */
 
 /* {{{ void http_curl_free(CURL **) */
-PHP_HTTP_API void _http_curl_free(CURL **ch)
+PHP_HTTP_API void _http_curl_free(CURL **ch TSRMLS_DC)
 {
        if (*ch) {
                curl_easy_setopt(*ch, CURLOPT_NOPROGRESS, 1L);
@@ -271,6 +271,8 @@ PHP_HTTP_API http_request *_http_request_init_ex(http_request *request, CURL *ch
 /* {{{ void http_request_dtor(http_request *) */
 PHP_HTTP_API void _http_request_dtor(http_request *request)
 {
+       TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
+       
        http_curl_free(&request->ch);
        http_request_reset(request);
        
index a3d6bd8..c2e880f 100644 (file)
@@ -138,6 +138,17 @@ ZEND_BEGIN_MODULE_GLOBALS(http)
 #endif
        } request;
 
+#ifdef HTTP_HAVE_PERSISTENT_HANDLES
+       struct _http_globals_persistent {
+               struct _http_globals_persistent_handles {
+                       struct _http_globals_persistent_handles_ident {
+                               ulong h;
+                               char *s;
+                               size_t l;
+                       } ident;
+               } handles;
+       } persistent;
+#endif
 #ifdef ZEND_ENGINE_2
        zend_bool only_exceptions;
 #endif
@@ -206,6 +217,7 @@ PHP_FUNCTION(http_match_request_header);
 #      ifdef HTTP_HAVE_PERSISTENT_HANDLES
 PHP_FUNCTION(http_persistent_handles_count);
 PHP_FUNCTION(http_persistent_handles_clean);
+PHP_FUNCTION(http_persistent_handles_ident);
 #      endif
 PHP_FUNCTION(http_get);
 PHP_FUNCTION(http_head);
index 98038b3..e991044 100644 (file)
@@ -20,6 +20,7 @@
 #define HTTP_SUPPORT_MAGICMIME         0x04L
 #define HTTP_SUPPORT_ENCODINGS         0x08L
 #define HTTP_SUPPORT_SSLREQUESTS       0x20L
+#define HTTP_SUPPORT_PERSISTENCE       0x40L
 
 #define HTTP_PARAMS_ALLOW_COMMA                0x01
 #define HTTP_PARAMS_ALLOW_FAILURE      0x02
index 27d640f..93ca5e5 100644 (file)
@@ -26,21 +26,21 @@ PHP_MSHUTDOWN_FUNCTION(http_persistent_handle);
 #define http_persistent_handle_provide_ex(n, l, c, d) _http_persistent_handle_provide_ex((n), (l), (c), (d))
 PHP_HTTP_API STATUS _http_persistent_handle_provide_ex(const char *name_str, size_t name_len, http_persistent_handle_ctor ctor, http_persistent_handle_dtor dtor);
 
-#define http_persistent_handle_cleanup(n) _http_persistent_handle_cleanup_ex((n), strlen(n))
-#define http_persistent_handle_cleanup_ex(n, l) _http_persistent_handle_cleanup_ex((n), (l))
-PHP_HTTP_API void _http_persistent_handle_cleanup_ex(const char *name_str, size_t name_len);
+#define http_persistent_handle_cleanup(n, c) _http_persistent_handle_cleanup_ex((n), strlen(n), (c) TSRMLS_CC)
+#define http_persistent_handle_cleanup_ex(n, l,c ) _http_persistent_handle_cleanup_ex((n), (l), (c) TSRMLS_CC)
+PHP_HTTP_API void _http_persistent_handle_cleanup_ex(const char *name_str, size_t name_len, int current_ident_only TSRMLS_DC);
 
 #define http_persistent_handle_statall() _http_persistent_handle_statall_ex(NULL)
 #define http_persistent_handle_statall_ex(ht) _http_persistent_handle_statall_ex((ht))
 PHP_HTTP_API HashTable *_http_persistent_handle_statall_ex(HashTable *ht);
 
-#define http_persistent_handle_acquire(n, h) _http_persistent_handle_acquire_ex((n), strlen(n), (h))
-#define http_persistent_handle_acquire_ex(n, l, h) _http_persistent_handle_acquire_ex((n), (l), (h))
-PHP_HTTP_API STATUS _http_persistent_handle_acquire_ex(const char *name_str, size_t name_len, void **handle);
+#define http_persistent_handle_acquire(n, h) _http_persistent_handle_acquire_ex((n), strlen(n), (h) TSRMLS_CC)
+#define http_persistent_handle_acquire_ex(n, l, h) _http_persistent_handle_acquire_ex((n), (l), (h) TSRMLS_CC)
+PHP_HTTP_API STATUS _http_persistent_handle_acquire_ex(const char *name_str, size_t name_len, void **handle TSRMLS_DC);
 
-#define http_persistent_handle_release(n, h) _http_persistent_handle_release_ex((n), strlen(n), (h))
-#define http_persistent_handle_release_ex(n, l, h) _http_persistent_handle_release_ex((n), (l), (h))
-PHP_HTTP_API STATUS _http_persistent_handle_release_ex(const char *name_str, size_t name_len, void **handle);
+#define http_persistent_handle_release(n, h) _http_persistent_handle_release_ex((n), strlen(n), (h) TSRMLS_CC)
+#define http_persistent_handle_release_ex(n, l, h) _http_persistent_handle_release_ex((n), (l), (h) TSRMLS_CC)
+PHP_HTTP_API STATUS _http_persistent_handle_release_ex(const char *name_str, size_t name_len, void **handle TSRMLS_DC);
 
 #endif /* HTTP_HAVE_PERSISTENT_HANDLES */
 #endif /* HTTP_PERSISTENT_HANDLE_H */
index bc6e246..d8dac5e 100644 (file)
@@ -53,11 +53,11 @@ typedef struct _http_request_t {
 } http_request;
 
 #define http_curl_init(r) http_curl_init_ex(NULL, (r))
-#define http_curl_init_ex(c, r) _http_curl_init_ex((c), (r))
-PHP_HTTP_API CURL *_http_curl_init_ex(CURL *ch, http_request *request);
+#define http_curl_init_ex(c, r) _http_curl_init_ex((c), (r) TSRMLS_CC)
+PHP_HTTP_API CURL *_http_curl_init_ex(CURL *ch, http_request *request TSRMLS_DC);
 
-#define http_curl_free(c) _http_curl_free(c)
-PHP_HTTP_API void _http_curl_free(CURL **ch);
+#define http_curl_free(c) _http_curl_free((c) TSRMLS_CC)
+PHP_HTTP_API void _http_curl_free(CURL **ch TSRMLS_DC);
 
 #define http_request_new() _http_request_init_ex(NULL, NULL, 0, NULL ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC TSRMLS_CC)
 #define http_request_init(r) _http_request_init_ex((r), NULL, 0, NULL ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC TSRMLS_CC)