From 2769c041b77a0aaba7acbee4ae469571eaeb2b0a Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 30 Mar 2012 12:14:01 +0000 Subject: [PATCH] batch renaming: client*curl curl*client --- config9.m4 | 12 +- php_http.c | 8 +- php_http_api.h | 6 +- php_http_curl.c | 6 +- ...tp_client_curl.c => php_http_curl_client.c | 182 +++++++++--------- ...tp_client_curl.h => php_http_curl_client.h | 32 +-- ...curl.c => php_http_curl_client_datashare.c | 64 +++--- ...curl.h => php_http_curl_client_datashare.h | 18 +- ...pool_curl.c => php_http_curl_client_pool.c | 132 ++++++------- ...pool_curl.h => php_http_curl_client_pool.h | 20 +- 10 files changed, 240 insertions(+), 240 deletions(-) rename php_http_client_curl.c => php_http_curl_client.c (89%) rename php_http_client_curl.h => php_http_curl_client.h (67%) rename php_http_client_datashare_curl.c => php_http_curl_client_datashare.c (73%) rename php_http_client_datashare_curl.h => php_http_curl_client_datashare.h (66%) rename php_http_client_pool_curl.c => php_http_curl_client_pool.c (77%) rename php_http_client_pool_curl.h => php_http_curl_client_pool.h (67%) diff --git a/config9.m4 b/config9.m4 index 9cce66b..9f800a1 100644 --- a/config9.m4 +++ b/config9.m4 @@ -395,13 +395,13 @@ dnl ---- php_http_buffer.c \ php_http.c \ php_http_client.c \ - php_http_client_curl.c \ + php_http_curl_client.c \ php_http_client_datashare.c \ - php_http_client_datashare_curl.c \ + php_http_curl_client_datashare.c \ php_http_client_factory.c \ php_http_client_interface.c \ php_http_client_pool.c \ - php_http_client_pool_curl.c \ + php_http_curl_client_pool.c \ php_http_client_request.c \ php_http_client_response.c \ php_http_cookie.c \ @@ -442,13 +442,13 @@ dnl ---- PHP_HTTP_HEADERS=" php_http_api.h \ php_http_buffer.h \ - php_http_client_curl.h \ - php_http_client_datashare_curl.h \ + php_http_curl_client.h \ + php_http_curl_client_datashare.h \ php_http_client_datashare.h \ php_http_client_factory.h \ php_http_client.h \ php_http_client_interface.h \ - php_http_client_pool_curl.h \ + php_http_curl_client_pool.h \ php_http_client_pool.h \ php_http_client_request.h \ php_http_client_response.h \ diff --git a/php_http.c b/php_http.c index bad11c0..e3ee6ab 100644 --- a/php_http.c +++ b/php_http.c @@ -150,9 +150,9 @@ PHP_MINIT_FUNCTION(http) #if PHP_HTTP_HAVE_CURL || SUCCESS != PHP_MINIT_CALL(http_curl) #endif - || SUCCESS != PHP_MINIT_CALL(http_client_curl) - || SUCCESS != PHP_MINIT_CALL(http_client_pool_curl) - || SUCCESS != PHP_MINIT_CALL(http_client_datashare_curl) + || SUCCESS != PHP_MINIT_CALL(http_curl_client) + || SUCCESS != PHP_MINIT_CALL(http_curl_client_pool) + || SUCCESS != PHP_MINIT_CALL(http_curl_client_datashare) || SUCCESS != PHP_MINIT_CALL(http_url) || SUCCESS != PHP_MINIT_CALL(http_env) || SUCCESS != PHP_MINIT_CALL(http_env_request) @@ -190,7 +190,7 @@ PHP_RINIT_FUNCTION(http) if (0 || SUCCESS != PHP_RINIT_CALL(http_env) #if PHP_HTTP_HAVE_CURL && PHP_HTTP_HAVE_EVENT - || SUCCESS != PHP_RINIT_CALL(http_client_pool_curl) + || SUCCESS != PHP_RINIT_CALL(http_curl_client_pool) #endif ) { return FAILURE; diff --git a/php_http_api.h b/php_http_api.h index a754267..2334404 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -99,11 +99,11 @@ typedef int STATUS; #include "php_http_client.h" #include "php_http_client_request.h" #include "php_http_client_response.h" -#include "php_http_client_curl.h" +#include "php_http_curl_client.h" #include "php_http_client_pool.h" -#include "php_http_client_pool_curl.h" +#include "php_http_curl_client_pool.h" #include "php_http_client_datashare.h" -#include "php_http_client_datashare_curl.h" +#include "php_http_curl_client_datashare.h" #include "php_http_client_factory.h" #include "php_http_url.h" #include "php_http_version.h" diff --git a/php_http_curl.c b/php_http_curl.c index 866f2d8..f6641dc 100644 --- a/php_http_curl.c +++ b/php_http_curl.c @@ -91,9 +91,9 @@ static struct gcry_thread_cbs php_http_gnutls_tsl = { PHP_MINIT_FUNCTION(http_curl) { php_http_client_factory_driver_t driver = { - php_http_client_curl_get_ops(), - php_http_client_pool_curl_get_ops(), - php_http_client_datashare_curl_get_ops() + php_http_curl_client_get_ops(), + php_http_curl_client_pool_get_ops(), + php_http_curl_client_datashare_get_ops() }; #ifdef PHP_HTTP_NEED_OPENSSL_TSL diff --git a/php_http_client_curl.c b/php_http_curl_client.c similarity index 89% rename from php_http_client_curl.c rename to php_http_curl_client.c index 194afc0..a285397 100644 --- a/php_http_client_curl.c +++ b/php_http_curl_client.c @@ -70,7 +70,7 @@ static void *php_http_curl_copy(void *opaque, void *handle TSRMLS_DC) static void php_http_curl_dtor(void *opaque, void *handle TSRMLS_DC) { - php_http_client_curl_storage_t *st = get_storage(handle); + php_http_curl_client_storage_t *st = get_storage(handle); curl_easy_cleanup(handle); @@ -87,7 +87,7 @@ static void php_http_curl_dtor(void *opaque, void *handle TSRMLS_DC) /* callbacks */ -static size_t php_http_client_curl_read_callback(void *data, size_t len, size_t n, void *ctx) +static size_t php_http_curl_client_read_callback(void *data, size_t len, size_t n, void *ctx) { php_http_message_body_t *body = ctx; @@ -98,10 +98,10 @@ static size_t php_http_client_curl_read_callback(void *data, size_t len, size_t return 0; } -static int php_http_client_curl_progress_callback(void *ctx, double dltotal, double dlnow, double ultotal, double ulnow) +static int php_http_curl_client_progress_callback(void *ctx, double dltotal, double dlnow, double ultotal, double ulnow) { php_http_client_t *h = ctx; - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); curl->progress.state.dl.total = dltotal; @@ -114,7 +114,7 @@ static int php_http_client_curl_progress_callback(void *ctx, double dltotal, dou return 0; } -static curlioerr php_http_client_curl_ioctl_callback(CURL *ch, curliocmd cmd, void *ctx) +static curlioerr php_http_curl_client_ioctl_callback(CURL *ch, curliocmd cmd, void *ctx) { php_http_message_body_t *body = ctx; @@ -133,10 +133,10 @@ static curlioerr php_http_client_curl_ioctl_callback(CURL *ch, curliocmd cmd, vo return CURLIOE_FAILRESTART; } -static int php_http_client_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size_t length, void *ctx) +static int php_http_curl_client_raw_callback(CURL *ch, curl_infotype type, char *data, size_t length, void *ctx) { php_http_client_t *h = ctx; - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; unsigned flags = 0; TSRMLS_FETCH_FROM_CTX(h->ts); @@ -199,7 +199,7 @@ static int php_http_client_curl_raw_callback(CURL *ch, curl_infotype type, char return 0; } -static int php_http_client_curl_dummy_callback(char *data, size_t n, size_t l, void *s) +static int php_http_curl_client_dummy_callback(char *data, size_t n, size_t l, void *s) { return n*l; } @@ -242,7 +242,7 @@ static inline zval *get_option(HashTable *cache, HashTable *options, char *key, static STATUS set_options(php_http_client_t *h, HashTable *options) { zval *zoption; - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; CURL *ch = curl->handle; TSRMLS_FETCH_FROM_CTX(h->ts); @@ -532,7 +532,7 @@ static STATUS set_options(php_http_client_t *h, HashTable *options) /* cookiestore, read initial cookies from that file and store cookies back into that file */ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("cookiestore"), IS_STRING))) { - php_http_client_curl_storage_t *storage = get_storage(curl->handle); + php_http_curl_client_storage_t *storage = get_storage(curl->handle); if (Z_STRLEN_P(zoption)) { if (SUCCESS != php_check_open_basedir(Z_STRVAL_P(zoption) TSRMLS_CC)) { @@ -792,11 +792,11 @@ static STATUS get_info(CURL *ch, HashTable *info) /* request handler ops */ -static STATUS php_http_client_curl_reset(php_http_client_t *h); +static STATUS php_http_curl_client_reset(php_http_client_t *h); -static php_http_client_t *php_http_client_curl_init(php_http_client_t *h, void *handle) +static php_http_client_t *php_http_curl_client_init(php_http_client_t *h, void *handle) { - php_http_client_curl_t *ctx; + php_http_curl_client_t *ctx; TSRMLS_FETCH_FROM_CTX(h->ts); if (!handle && !(handle = php_http_resource_factory_handle_ctor(h->rf TSRMLS_CC))) { @@ -819,22 +819,22 @@ static php_http_client_t *php_http_client_curl_init(php_http_client_t *h, void * curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, NULL); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, php_http_client_curl_dummy_callback); - curl_easy_setopt(handle, CURLOPT_DEBUGFUNCTION, php_http_client_curl_raw_callback); - curl_easy_setopt(handle, CURLOPT_READFUNCTION, php_http_client_curl_read_callback); - curl_easy_setopt(handle, CURLOPT_IOCTLFUNCTION, php_http_client_curl_ioctl_callback); - curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, php_http_client_curl_progress_callback); + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, php_http_curl_client_dummy_callback); + curl_easy_setopt(handle, CURLOPT_DEBUGFUNCTION, php_http_curl_client_raw_callback); + curl_easy_setopt(handle, CURLOPT_READFUNCTION, php_http_curl_client_read_callback); + curl_easy_setopt(handle, CURLOPT_IOCTLFUNCTION, php_http_curl_client_ioctl_callback); + curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, php_http_curl_client_progress_callback); curl_easy_setopt(handle, CURLOPT_DEBUGDATA, h); curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, h); - php_http_client_curl_reset(h); + php_http_curl_client_reset(h); return h; } -static php_http_client_t *php_http_client_curl_copy(php_http_client_t *from, php_http_client_t *to) +static php_http_client_t *php_http_curl_client_copy(php_http_client_t *from, php_http_client_t *to) { - php_http_client_curl_t *ctx = from->ctx; + php_http_curl_client_t *ctx = from->ctx; void *copy; TSRMLS_FETCH_FROM_CTX(from->ts); @@ -843,15 +843,15 @@ static php_http_client_t *php_http_client_curl_copy(php_http_client_t *from, php } if (to) { - return php_http_client_curl_init(to, copy); + return php_http_curl_client_init(to, copy); } else { return php_http_client_init(NULL, from->ops, from->rf, copy TSRMLS_CC); } } -static void php_http_client_curl_dtor(php_http_client_t *h) +static void php_http_curl_client_dtor(php_http_client_t *h) { - php_http_client_curl_t *ctx = h->ctx; + php_http_curl_client_t *ctx = h->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); curl_easy_setopt(ctx->handle, CURLOPT_NOPROGRESS, 1L); @@ -873,11 +873,11 @@ static void php_http_client_curl_dtor(php_http_client_t *h) efree(ctx); h->ctx = NULL; } -static STATUS php_http_client_curl_reset(php_http_client_t *h) +static STATUS php_http_curl_client_reset(php_http_client_t *h) { - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; CURL *ch = curl->handle; - php_http_client_curl_storage_t *st; + php_http_curl_client_storage_t *st; if ((st = get_storage(ch))) { if (st->url) { @@ -1024,10 +1024,10 @@ static STATUS php_http_client_curl_reset(php_http_client_t *h) return SUCCESS; } -STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *msg) +STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg) { - php_http_client_curl_t *curl = h->ctx; - php_http_client_curl_storage_t *storage = get_storage(curl->handle); + php_http_curl_client_t *curl = h->ctx; + php_http_curl_client_storage_t *storage = get_storage(curl->handle); TSRMLS_FETCH_FROM_CTX(h->ts); /* request url */ @@ -1114,15 +1114,15 @@ STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *ms return SUCCESS; } -static STATUS php_http_client_curl_exec(php_http_client_t *h, php_http_message_t *msg) +static STATUS php_http_curl_client_exec(php_http_client_t *h, php_http_message_t *msg) { uint tries = 0; CURLcode result; - php_http_client_curl_t *curl = h->ctx; - php_http_client_curl_storage_t *storage = get_storage(curl->handle); + php_http_curl_client_t *curl = h->ctx; + php_http_curl_client_storage_t *storage = get_storage(curl->handle); TSRMLS_FETCH_FROM_CTX(h->ts); - if (SUCCESS != php_http_client_curl_prepare(h, msg)) { + if (SUCCESS != php_http_curl_client_prepare(h, msg)) { return FAILURE; } @@ -1164,9 +1164,9 @@ retry: return SUCCESS; } -static STATUS php_http_client_curl_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) +static STATUS php_http_curl_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) { - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); switch (opt) { @@ -1219,9 +1219,9 @@ static STATUS php_http_client_curl_setopt(php_http_client_t *h, php_http_client_ return SUCCESS; } -static STATUS php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg) +static STATUS php_http_curl_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg) { - php_http_client_curl_t *curl = h->ctx; + php_http_curl_client_t *curl = h->ctx; switch (opt) { case PHP_HTTP_CLIENT_OPT_PROGRESS_INFO: @@ -1239,7 +1239,7 @@ static STATUS php_http_client_curl_getopt(php_http_client_t *h, php_http_client_ return SUCCESS; } -static php_http_resource_factory_ops_t php_http_client_curl_resource_factory_ops = { +static php_http_resource_factory_ops_t php_http_curl_client_resource_factory_ops = { php_http_curl_ctor, php_http_curl_copy, php_http_curl_dtor @@ -1247,49 +1247,49 @@ static php_http_resource_factory_ops_t php_http_client_curl_resource_factory_ops static zend_class_entry *get_class_entry(void) { - return php_http_client_curl_class_entry; + return php_http_curl_client_class_entry; } -static php_http_client_ops_t php_http_client_curl_ops = { - &php_http_client_curl_resource_factory_ops, - php_http_client_curl_init, - php_http_client_curl_copy, - php_http_client_curl_dtor, - php_http_client_curl_reset, - php_http_client_curl_exec, - php_http_client_curl_setopt, - php_http_client_curl_getopt, - (php_http_new_t) php_http_client_curl_object_new_ex, +static php_http_client_ops_t php_http_curl_client_ops = { + &php_http_curl_client_resource_factory_ops, + php_http_curl_client_init, + php_http_curl_client_copy, + php_http_curl_client_dtor, + php_http_curl_client_reset, + php_http_curl_client_exec, + php_http_curl_client_setopt, + php_http_curl_client_getopt, + (php_http_new_t) php_http_curl_client_object_new_ex, get_class_entry }; -PHP_HTTP_API php_http_client_ops_t *php_http_client_curl_get_ops(void) +PHP_HTTP_API php_http_client_ops_t *php_http_curl_client_get_ops(void) { - return &php_http_client_curl_ops; + return &php_http_curl_client_ops; } #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientCURL, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientCURL, method, 0) -#define PHP_HTTP_CLIENT_CURL_ME(method, visibility) PHP_ME(HttpClientCURL, method, PHP_HTTP_ARGS(HttpClientCURL, method), visibility) -#define PHP_HTTP_CLIENT_CURL_CLIENT_MALIAS(me, vis) ZEND_FENTRY(me, ZEND_MN(HttpClient_##me), PHP_HTTP_ARGS(HttpClientCURL, me), vis) +#define PHP_HTTP_CURL_CLIENT_ME(method, visibility) PHP_ME(HttpClientCURL, method, PHP_HTTP_ARGS(HttpClientCURL, method), visibility) +#define PHP_HTTP_CURL_CLIENT_CLIENT_MALIAS(me, vis) ZEND_FENTRY(me, ZEND_MN(HttpClient_##me), PHP_HTTP_ARGS(HttpClientCURL, me), vis) PHP_HTTP_BEGIN_ARGS(send, 1) PHP_HTTP_ARG_VAL(request, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_client_curl_class_entry; -zend_function_entry php_http_client_curl_method_entry[] = { - PHP_HTTP_CLIENT_CURL_CLIENT_MALIAS(send, ZEND_ACC_PUBLIC) +zend_class_entry *php_http_curl_client_class_entry; +zend_function_entry php_http_curl_client_method_entry[] = { + PHP_HTTP_CURL_CLIENT_CLIENT_MALIAS(send, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; -zend_object_value php_http_client_curl_object_new(zend_class_entry *ce TSRMLS_DC) +zend_object_value php_http_curl_client_object_new(zend_class_entry *ce TSRMLS_DC) { - return php_http_client_curl_object_new_ex(ce, NULL, NULL TSRMLS_CC); + return php_http_curl_client_object_new_ex(ce, NULL, NULL TSRMLS_CC); } -zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC) +zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC) { zend_object_value ov; php_http_client_object_t *o; @@ -1299,7 +1299,7 @@ zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_h object_properties_init((zend_object *) o, ce); if (!(o->client = r)) { - o->client = php_http_client_init(NULL, &php_http_client_curl_ops, NULL, NULL TSRMLS_CC); + o->client = php_http_client_init(NULL, &php_http_curl_client_ops, NULL, NULL TSRMLS_CC); } if (ptr) { @@ -1313,69 +1313,69 @@ zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_h } -PHP_MINIT_FUNCTION(http_client_curl) +PHP_MINIT_FUNCTION(http_curl_client) { - if (SUCCESS != php_http_persistent_handle_provide(ZEND_STRL("http_client.curl"), &php_http_client_curl_resource_factory_ops, NULL, NULL)) { + if (SUCCESS != php_http_persistent_handle_provide(ZEND_STRL("http_client.curl"), &php_http_curl_client_resource_factory_ops, NULL, NULL)) { return FAILURE; } - PHP_HTTP_REGISTER_CLASS(http\\Client, CURL, http_client_curl, php_http_client_get_class_entry(), 0); - php_http_client_curl_class_entry->create_object = php_http_client_curl_object_new; + PHP_HTTP_REGISTER_CLASS(http\\Curl, Client, http_curl_client, php_http_client_get_class_entry(), 0); + php_http_curl_client_class_entry->create_object = php_http_curl_client_object_new; /* * HTTP Protocol Version Constants */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("HTTP_VERSION_1_0"), CURL_HTTP_VERSION_1_0 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("HTTP_VERSION_1_1"), CURL_HTTP_VERSION_1_1 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("HTTP_VERSION_NONE"), CURL_HTTP_VERSION_NONE TSRMLS_CC); /* to be removed */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("HTTP_VERSION_ANY"), CURL_HTTP_VERSION_NONE TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("HTTP_VERSION_1_0"), CURL_HTTP_VERSION_1_0 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("HTTP_VERSION_1_1"), CURL_HTTP_VERSION_1_1 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("HTTP_VERSION_NONE"), CURL_HTTP_VERSION_NONE TSRMLS_CC); /* to be removed */ + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("HTTP_VERSION_ANY"), CURL_HTTP_VERSION_NONE TSRMLS_CC); /* * SSL Version Constants */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("SSL_VERSION_TLSv1"), CURL_SSLVERSION_TLSv1 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("SSL_VERSION_SSLv2"), CURL_SSLVERSION_SSLv2 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("SSL_VERSION_SSLv3"), CURL_SSLVERSION_SSLv3 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("SSL_VERSION_ANY"), CURL_SSLVERSION_DEFAULT TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("SSL_VERSION_TLSv1"), CURL_SSLVERSION_TLSv1 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("SSL_VERSION_SSLv2"), CURL_SSLVERSION_SSLv2 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("SSL_VERSION_SSLv3"), CURL_SSLVERSION_SSLv3 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("SSL_VERSION_ANY"), CURL_SSLVERSION_DEFAULT TSRMLS_CC); /* * DNS IPvX resolving */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("IPRESOLVE_V4"), CURL_IPRESOLVE_V4 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("IPRESOLVE_V6"), CURL_IPRESOLVE_V6 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("IPRESOLVE_ANY"), CURL_IPRESOLVE_WHATEVER TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("IPRESOLVE_V4"), CURL_IPRESOLVE_V4 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("IPRESOLVE_V6"), CURL_IPRESOLVE_V6 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("IPRESOLVE_ANY"), CURL_IPRESOLVE_WHATEVER TSRMLS_CC); /* * Auth Constants */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_BASIC"), CURLAUTH_BASIC TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_DIGEST"), CURLAUTH_DIGEST TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_BASIC"), CURLAUTH_BASIC TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_DIGEST"), CURLAUTH_DIGEST TSRMLS_CC); #if PHP_HTTP_CURL_VERSION(7,19,3) - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_DIGEST_IE"), CURLAUTH_DIGEST_IE TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_DIGEST_IE"), CURLAUTH_DIGEST_IE TSRMLS_CC); #endif - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_NTLM"), CURLAUTH_NTLM TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_GSSNEG"), CURLAUTH_GSSNEGOTIATE TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("AUTH_ANY"), CURLAUTH_ANY TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_NTLM"), CURLAUTH_NTLM TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_GSSNEG"), CURLAUTH_GSSNEGOTIATE TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("AUTH_ANY"), CURLAUTH_ANY TSRMLS_CC); /* * Proxy Type Constants */ - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_SOCKS4"), CURLPROXY_SOCKS4 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_SOCKS4A"), CURLPROXY_SOCKS5 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_SOCKS5_HOSTNAME"), CURLPROXY_SOCKS5 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_SOCKS5"), CURLPROXY_SOCKS5 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_HTTP"), CURLPROXY_HTTP TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_SOCKS4"), CURLPROXY_SOCKS4 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_SOCKS4A"), CURLPROXY_SOCKS5 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_SOCKS5_HOSTNAME"), CURLPROXY_SOCKS5 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_SOCKS5"), CURLPROXY_SOCKS5 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_HTTP"), CURLPROXY_HTTP TSRMLS_CC); # if PHP_HTTP_CURL_VERSION(7,19,4) - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("PROXY_HTTP_1_0"), CURLPROXY_HTTP_1_0 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("PROXY_HTTP_1_0"), CURLPROXY_HTTP_1_0 TSRMLS_CC); # endif /* * Post Redirection Constants */ #if PHP_HTTP_CURL_VERSION(7,19,1) - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("POSTREDIR_301"), CURL_REDIR_POST_301 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("POSTREDIR_302"), CURL_REDIR_POST_302 TSRMLS_CC); - zend_declare_class_constant_long(php_http_client_curl_class_entry, ZEND_STRL("POSTREDIR_ALL"), CURL_REDIR_POST_ALL TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("POSTREDIR_301"), CURL_REDIR_POST_301 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("POSTREDIR_302"), CURL_REDIR_POST_302 TSRMLS_CC); + zend_declare_class_constant_long(php_http_curl_client_class_entry, ZEND_STRL("POSTREDIR_ALL"), CURL_REDIR_POST_ALL TSRMLS_CC); #endif return SUCCESS; diff --git a/php_http_client_curl.h b/php_http_curl_client.h similarity index 67% rename from php_http_client_curl.h rename to php_http_curl_client.h index b22e266..b3d8a4a 100644 --- a/php_http_client_curl.h +++ b/php_http_curl_client.h @@ -10,14 +10,14 @@ +--------------------------------------------------------------------+ */ -#ifndef PHP_HTTP_CLIENT_CURL_H -#define PHP_HTTP_CLIENT_CURL_H +#ifndef PHP_HTTP_CURL_CLIENT_H +#define PHP_HTTP_CURL_CLIENT_H #if PHP_HTTP_HAVE_CURL -PHP_HTTP_API php_http_client_ops_t *php_http_client_curl_get_ops(void); +PHP_HTTP_API php_http_client_ops_t *php_http_curl_client_get_ops(void); -typedef struct php_http_client_curl { +typedef struct php_http_curl_client { CURL *handle; struct { @@ -39,16 +39,16 @@ typedef struct php_http_client_curl { php_http_client_progress_t progress; -} php_http_client_curl_t; +} php_http_curl_client_t; -typedef struct php_http_client_curl_storage { +typedef struct php_http_curl_client_storage { char *url; char *cookiestore; char errorbuffer[0x100]; -} php_http_client_curl_storage_t; +} php_http_curl_client_storage_t; -static inline php_http_client_curl_storage_t *get_storage(CURL *ch) { - php_http_client_curl_storage_t *st = NULL; +static inline php_http_curl_client_storage_t *get_storage(CURL *ch) { + php_http_curl_client_storage_t *st = NULL; curl_easy_getinfo(ch, CURLINFO_PRIVATE, &st); @@ -61,18 +61,18 @@ static inline php_http_client_curl_storage_t *get_storage(CURL *ch) { return st; } -extern STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *msg); +extern STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg); -extern zend_class_entry *php_http_client_curl_class_entry; -extern zend_function_entry php_http_client_curl_method_entry[]; +extern zend_class_entry *php_http_curl_client_class_entry; +extern zend_function_entry php_http_curl_client_method_entry[]; -extern zend_object_value php_http_client_curl_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC); +extern zend_object_value php_http_curl_client_object_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(http_client_curl); +PHP_MINIT_FUNCTION(http_curl_client); #endif /* PHP_HTTP_HAVE_CURL */ -#endif /* PHP_HTTP_CLIENT_CURL_H */ +#endif /* PHP_HTTP_CURL_CLIENT_H */ /* diff --git a/php_http_client_datashare_curl.c b/php_http_curl_client_datashare.c similarity index 73% rename from php_http_client_datashare_curl.c rename to php_http_curl_client_datashare.c index 161b510..1b47eb5 100644 --- a/php_http_client_datashare_curl.c +++ b/php_http_curl_client_datashare.c @@ -14,9 +14,9 @@ #if PHP_HTTP_HAVE_CURL -typedef struct php_http_client_datashare_curl { +typedef struct php_http_curl_client_datashare { CURLSH *handle; -} php_http_client_datashare_curl_t; +} php_http_curl_client_datashare_t; static void *php_http_curlsh_ctor(void *opaque TSRMLS_DC) @@ -32,9 +32,9 @@ static void php_http_curlsh_dtor(void *opaque, void *handle TSRMLS_DC) /* datashare handler ops */ -static php_http_client_datashare_t *php_http_client_datashare_curl_init(php_http_client_datashare_t *h, void *handle) +static php_http_client_datashare_t *php_http_curl_client_datashare_init(php_http_client_datashare_t *h, void *handle) { - php_http_client_datashare_curl_t *curl; + php_http_curl_client_datashare_t *curl; TSRMLS_FETCH_FROM_CTX(h->ts); if (!handle && !(handle = php_http_resource_factory_handle_ctor(h->rf TSRMLS_CC))) { @@ -49,9 +49,9 @@ static php_http_client_datashare_t *php_http_client_datashare_curl_init(php_http return h; } -static void php_http_client_datashare_curl_dtor(php_http_client_datashare_t *h) +static void php_http_curl_client_datashare_dtor(php_http_client_datashare_t *h) { - php_http_client_datashare_curl_t *curl = h->ctx; + php_http_curl_client_datashare_t *curl = h->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); php_http_resource_factory_handle_dtor(h->rf, curl->handle TSRMLS_CC); @@ -60,11 +60,11 @@ static void php_http_client_datashare_curl_dtor(php_http_client_datashare_t *h) h->ctx = NULL; } -static STATUS php_http_client_datashare_curl_attach(php_http_client_datashare_t *h, php_http_client_t *r) +static STATUS php_http_curl_client_datashare_attach(php_http_client_datashare_t *h, php_http_client_t *r) { CURLcode rc; - php_http_client_datashare_curl_t *curl = h->ctx; - php_http_client_curl_t *recurl = r->ctx; + php_http_curl_client_datashare_t *curl = h->ctx; + php_http_curl_client_t *recurl = r->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); if (CURLE_OK != (rc = curl_easy_setopt(recurl->handle, CURLOPT_SHARE, curl->handle))) { @@ -74,10 +74,10 @@ static STATUS php_http_client_datashare_curl_attach(php_http_client_datashare_t return SUCCESS; } -static STATUS php_http_client_datashare_curl_detach(php_http_client_datashare_t *h, php_http_client_t *r) +static STATUS php_http_curl_client_datashare_detach(php_http_client_datashare_t *h, php_http_client_t *r) { CURLcode rc; - php_http_client_curl_t *recurl = r->ctx; + php_http_curl_client_t *recurl = r->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); @@ -88,10 +88,10 @@ static STATUS php_http_client_datashare_curl_detach(php_http_client_datashare_t return SUCCESS; } -static STATUS php_http_client_datashare_curl_setopt(php_http_client_datashare_t *h, php_http_client_datashare_setopt_opt_t opt, void *arg) +static STATUS php_http_curl_client_datashare_setopt(php_http_client_datashare_t *h, php_http_client_datashare_setopt_opt_t opt, void *arg) { CURLSHcode rc; - php_http_client_datashare_curl_t *curl = h->ctx; + php_http_curl_client_datashare_t *curl = h->ctx; switch (opt) { case PHP_HTTP_CLIENT_DATASHARE_OPT_COOKIES: @@ -138,42 +138,42 @@ static php_http_resource_factory_ops_t php_http_curlsh_resource_factory_ops = { static zend_class_entry *get_class_entry(void) { - return php_http_client_datashare_curl_class_entry; + return php_http_curl_client_datashare_class_entry; } -static php_http_client_datashare_ops_t php_http_client_datashare_curl_ops = { +static php_http_client_datashare_ops_t php_http_curl_client_datashare_ops = { &php_http_curlsh_resource_factory_ops, - php_http_client_datashare_curl_init, + php_http_curl_client_datashare_init, NULL /* copy */, - php_http_client_datashare_curl_dtor, + php_http_curl_client_datashare_dtor, NULL /*reset */, - php_http_client_datashare_curl_attach, - php_http_client_datashare_curl_detach, - php_http_client_datashare_curl_setopt, - (php_http_new_t) php_http_client_datashare_curl_object_new_ex, + php_http_curl_client_datashare_attach, + php_http_curl_client_datashare_detach, + php_http_curl_client_datashare_setopt, + (php_http_new_t) php_http_curl_client_datashare_object_new_ex, get_class_entry }; -PHP_HTTP_API php_http_client_datashare_ops_t *php_http_client_datashare_curl_get_ops(void) +PHP_HTTP_API php_http_client_datashare_ops_t *php_http_curl_client_datashare_get_ops(void) { - return &php_http_client_datashare_curl_ops; + return &php_http_curl_client_datashare_ops; } #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientDataShare, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientDataShare, method, 0) #define PHP_HTTP_RSHARE_ME(method, visibility) PHP_ME(HttpClientDataShare, method, PHP_HTTP_ARGS(HttpClientDataShare, method), visibility) -zend_class_entry *php_http_client_datashare_curl_class_entry; -zend_function_entry php_http_client_datashare_curl_method_entry[] = { +zend_class_entry *php_http_curl_client_datashare_class_entry; +zend_function_entry php_http_curl_client_datashare_method_entry[] = { EMPTY_FUNCTION_ENTRY }; -zend_object_value php_http_client_datashare_curl_object_new(zend_class_entry *ce TSRMLS_DC) +zend_object_value php_http_curl_client_datashare_object_new(zend_class_entry *ce TSRMLS_DC) { - return php_http_client_datashare_curl_object_new_ex(ce, NULL, NULL TSRMLS_CC); + return php_http_curl_client_datashare_object_new_ex(ce, NULL, NULL TSRMLS_CC); } -zend_object_value php_http_client_datashare_curl_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC) +zend_object_value php_http_curl_client_datashare_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC) { zend_object_value ov; php_http_client_datashare_object_t *o; @@ -185,7 +185,7 @@ zend_object_value php_http_client_datashare_curl_object_new_ex(zend_class_entry if (share) { o->share = share; } else { - o->share = php_http_client_datashare_init(NULL, &php_http_client_datashare_curl_ops, NULL, NULL TSRMLS_CC); + o->share = php_http_client_datashare_init(NULL, &php_http_curl_client_datashare_ops, NULL, NULL TSRMLS_CC); } if (ptr) { @@ -199,14 +199,14 @@ zend_object_value php_http_client_datashare_curl_object_new_ex(zend_class_entry } -PHP_MINIT_FUNCTION(http_client_datashare_curl) +PHP_MINIT_FUNCTION(http_curl_client_datashare) { if (SUCCESS != php_http_persistent_handle_provide(ZEND_STRL("http_client_datashare.curl"), &php_http_curlsh_resource_factory_ops, NULL, NULL)) { return FAILURE; } - PHP_HTTP_REGISTER_CLASS(http\\Client\\DataShare, CURL, http_client_datashare_curl, php_http_client_datashare_get_class_entry(), 0); - php_http_client_datashare_curl_class_entry->create_object = php_http_client_datashare_curl_object_new; + PHP_HTTP_REGISTER_CLASS(http\\Curl\\Client, DataShare, http_curl_client_datashare, php_http_client_datashare_get_class_entry(), 0); + php_http_curl_client_datashare_class_entry->create_object = php_http_curl_client_datashare_object_new; return SUCCESS; } diff --git a/php_http_client_datashare_curl.h b/php_http_curl_client_datashare.h similarity index 66% rename from php_http_client_datashare_curl.h rename to php_http_curl_client_datashare.h index c13689b..d02796e 100644 --- a/php_http_client_datashare_curl.h +++ b/php_http_curl_client_datashare.h @@ -10,24 +10,24 @@ +--------------------------------------------------------------------+ */ -#ifndef PHP_HTTP_CLIENT_DATASHARE_CURL_H -#define PHP_HTTP_CLIENT_DATASHARE_CURL_H +#ifndef PHP_HTTP_CURL_CLIENT_DATASHARE_H +#define PHP_HTTP_CURL_CLIENT_DATASHARE_H #if PHP_HTTP_HAVE_CURL -PHP_HTTP_API php_http_client_datashare_ops_t *php_http_client_datashare_curl_get_ops(void); +PHP_HTTP_API php_http_client_datashare_ops_t *php_http_curl_client_datashare_get_ops(void); -extern zend_class_entry *php_http_client_datashare_curl_class_entry; -extern zend_function_entry php_http_client_datashare_curl_method_entry[]; +extern zend_class_entry *php_http_curl_client_datashare_class_entry; +extern zend_function_entry php_http_curl_client_datashare_method_entry[]; -extern zend_object_value php_http_client_datashare_curl_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_client_datashare_curl_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC); +extern zend_object_value php_http_curl_client_datashare_object_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object_value php_http_curl_client_datashare_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC); -PHP_MINIT_FUNCTION(http_client_datashare_curl); +PHP_MINIT_FUNCTION(http_curl_client_datashare); #endif /* PHP_HTTP_HAVE_CURL */ -#endif /* PHP_HTTP_CLIENT_DATASHARE_CURL_H */ +#endif /* PHP_HTTP_CURL_CLIENT_DATASHARE_H */ /* * Local variables: diff --git a/php_http_client_pool_curl.c b/php_http_curl_client_pool.c similarity index 77% rename from php_http_client_pool_curl.c rename to php_http_curl_client_pool.c index 12d9454..61a00f1 100644 --- a/php_http_client_pool_curl.c +++ b/php_http_curl_client_pool.c @@ -18,7 +18,7 @@ # include #endif -typedef struct php_http_client_pool_curl { +typedef struct php_http_curl_client_pool { CURLM *handle; int unfinished; /* int because of curl_multi_perform() */ @@ -28,7 +28,7 @@ typedef struct php_http_client_pool_curl { unsigned useevents:1; unsigned runsocket:1; #endif -} php_http_client_pool_curl_t; +} php_http_curl_client_pool_t; static void *php_http_curlm_ctor(void *opaque TSRMLS_DC) { @@ -41,11 +41,11 @@ static void php_http_curlm_dtor(void *opaque, void *handle TSRMLS_DC) } -static void php_http_client_pool_curl_responsehandler(php_http_client_pool_t *pool) +static void php_http_curl_client_pool_responsehandler(php_http_client_pool_t *pool) { int remaining = 0; zval **requests; - php_http_client_pool_curl_t *curl = pool->ctx; + php_http_curl_client_pool_t *curl = pool->ctx; TSRMLS_FETCH_FROM_CTX(pool->ts); do { @@ -55,7 +55,7 @@ static void php_http_client_pool_curl_responsehandler(php_http_client_pool_t *po zval **request; if (CURLE_OK != msg->data.result) { - php_http_client_curl_storage_t *st = get_storage(msg->easy_handle); + php_http_curl_client_storage_t *st = get_storage(msg->easy_handle); php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "%s; %s (%s)", curl_easy_strerror(msg->data.result), STR_PTR(st->errorbuffer), STR_PTR(st->url)); } @@ -63,7 +63,7 @@ static void php_http_client_pool_curl_responsehandler(php_http_client_pool_t *po for (request = requests; *request; ++request) { php_http_client_object_t *obj = zend_object_store_get_object(*request TSRMLS_CC); - if (msg->easy_handle == ((php_http_client_curl_t *) (obj->client->ctx))->handle) { + if (msg->easy_handle == ((php_http_curl_client_t *) (obj->client->ctx))->handle) { Z_ADDREF_PP(request); zend_llist_add_element(&pool->clients.finished, request); php_http_client_object_handle_response(*request TSRMLS_CC); @@ -100,10 +100,10 @@ static inline int etoca(short action) { } } -static void php_http_client_pool_curl_timeout_callback(int socket, short action, void *event_data) +static void php_http_curl_client_pool_timeout_callback(int socket, short action, void *event_data) { php_http_client_pool_t *pool = event_data; - php_http_client_pool_curl_t *curl = pool->ctx; + php_http_curl_client_pool_t *curl = pool->ctx; #if DBG_EVENTS fprintf(stderr, "T"); @@ -118,14 +118,14 @@ static void php_http_client_pool_curl_timeout_callback(int socket, short action, php_http_error(HE_WARNING, PHP_HTTP_E_SOCKET, "%s", curl_multi_strerror(rc)); } - php_http_client_pool_curl_responsehandler(pool); + php_http_curl_client_pool_responsehandler(pool); } } -static void php_http_client_pool_curl_event_callback(int socket, short action, void *event_data) +static void php_http_curl_client_pool_event_callback(int socket, short action, void *event_data) { php_http_client_pool_t *pool = event_data; - php_http_client_pool_curl_t *curl = pool->ctx; + php_http_curl_client_pool_t *curl = pool->ctx; #if DBG_EVENTS fprintf(stderr, "E"); @@ -140,7 +140,7 @@ static void php_http_client_pool_curl_event_callback(int socket, short action, v php_http_error(HE_WARNING, PHP_HTTP_E_SOCKET, "%s", curl_multi_strerror(rc)); } - php_http_client_pool_curl_responsehandler(pool); + php_http_curl_client_pool_responsehandler(pool); /* remove timeout if there are no transfers left */ if (!curl->unfinished && event_initialized(curl->timeout) && event_pending(curl->timeout, EV_TIMEOUT, NULL)) { @@ -149,10 +149,10 @@ static void php_http_client_pool_curl_event_callback(int socket, short action, v } } -static int php_http_client_pool_curl_socket_callback(CURL *easy, curl_socket_t sock, int action, void *socket_data, void *assign_data) +static int php_http_curl_client_pool_socket_callback(CURL *easy, curl_socket_t sock, int action, void *socket_data, void *assign_data) { php_http_client_pool_t *pool = socket_data; - php_http_client_pool_curl_t *curl = pool->ctx; + php_http_curl_client_pool_t *curl = pool->ctx; #if DBG_EVENTS fprintf(stderr, "S"); @@ -193,17 +193,17 @@ static int php_http_client_pool_curl_socket_callback(CURL *easy, curl_socket_t s return -1; } - event_set(&ev->evnt, sock, events, php_http_client_pool_curl_event_callback, pool); + event_set(&ev->evnt, sock, events, php_http_curl_client_pool_event_callback, pool); event_add(&ev->evnt, NULL); } return 0; } -static void php_http_client_pool_curl_timer_callback(CURLM *multi, long timeout_ms, void *timer_data) +static void php_http_curl_client_pool_timer_callback(CURLM *multi, long timeout_ms, void *timer_data) { php_http_client_pool_t *pool = timer_data; - php_http_client_pool_curl_t *curl = pool->ctx; + php_http_curl_client_pool_t *curl = pool->ctx; #if DBG_EVENTS fprintf(stderr, "%ld", timeout_ms); @@ -211,13 +211,13 @@ static void php_http_client_pool_curl_timer_callback(CURLM *multi, long timeout_ if (curl->useevents) { if (timeout_ms < 0) { - php_http_client_pool_curl_timeout_callback(CURL_SOCKET_TIMEOUT, CURL_CSELECT_IN|CURL_CSELECT_OUT, pool); + php_http_curl_client_pool_timeout_callback(CURL_SOCKET_TIMEOUT, CURL_CSELECT_IN|CURL_CSELECT_OUT, pool); } else if (timeout_ms > 0 || !event_initialized(curl->timeout) || !event_pending(curl->timeout, EV_TIMEOUT, NULL)) { struct timeval timeout; TSRMLS_FETCH_FROM_CTX(pool->ts); if (!event_initialized(curl->timeout)) { - event_set(curl->timeout, -1, 0, php_http_client_pool_curl_timeout_callback, pool); + event_set(curl->timeout, -1, 0, php_http_curl_client_pool_timeout_callback, pool); event_base_set(PHP_HTTP_G->curl.event_base, curl->timeout); } else if (event_pending(curl->timeout, EV_TIMEOUT, NULL)) { event_del(curl->timeout); @@ -236,9 +236,9 @@ static void php_http_client_pool_curl_timer_callback(CURLM *multi, long timeout_ /* pool handler ops */ -static php_http_client_pool_t *php_http_client_pool_curl_init(php_http_client_pool_t *h, void *handle) +static php_http_client_pool_t *php_http_curl_client_pool_init(php_http_client_pool_t *h, void *handle) { - php_http_client_pool_curl_t *curl; + php_http_curl_client_pool_t *curl; TSRMLS_FETCH_FROM_CTX(h->ts); if (!handle && !(handle = php_http_resource_factory_handle_ctor(h->rf TSRMLS_CC))) { @@ -254,9 +254,9 @@ static php_http_client_pool_t *php_http_client_pool_curl_init(php_http_client_po return h; } -static void php_http_client_pool_curl_dtor(php_http_client_pool_t *h) +static void php_http_curl_client_pool_dtor(php_http_client_pool_t *h) { - php_http_client_pool_curl_t *curl = h->ctx; + php_http_curl_client_pool_t *curl = h->ctx; TSRMLS_FETCH_FROM_CTX(h->ts); #if PHP_HTTP_HAVE_EVENT @@ -274,14 +274,14 @@ static void php_http_client_pool_curl_dtor(php_http_client_pool_t *h) h->ctx = NULL; } -static STATUS php_http_client_pool_curl_attach(php_http_client_pool_t *h, php_http_client_t *r, php_http_message_t *m) +static STATUS php_http_curl_client_pool_attach(php_http_client_pool_t *h, php_http_client_t *r, php_http_message_t *m) { - php_http_client_pool_curl_t *curl = h->ctx; - php_http_client_curl_t *recurl = r->ctx; + php_http_curl_client_pool_t *curl = h->ctx; + php_http_curl_client_t *recurl = r->ctx; CURLMcode rs; TSRMLS_FETCH_FROM_CTX(h->ts); - if (SUCCESS != php_http_client_curl_prepare(r, m)) { + if (SUCCESS != php_http_curl_client_prepare(r, m)) { return FAILURE; } @@ -294,10 +294,10 @@ static STATUS php_http_client_pool_curl_attach(php_http_client_pool_t *h, php_ht } } -static STATUS php_http_client_pool_curl_detach(php_http_client_pool_t *h, php_http_client_t *r) +static STATUS php_http_curl_client_pool_detach(php_http_client_pool_t *h, php_http_client_t *r) { - php_http_client_pool_curl_t *curl = h->ctx; - php_http_client_curl_t *recurl = r->ctx; + php_http_curl_client_pool_t *curl = h->ctx; + php_http_curl_client_t *recurl = r->ctx; CURLMcode rs = curl_multi_remove_handle(curl->handle, recurl->handle); TSRMLS_FETCH_FROM_CTX(h->ts); @@ -315,12 +315,12 @@ static STATUS php_http_client_pool_curl_detach(php_http_client_pool_t *h, php_ht # define SELECT_ERROR -1 #endif -static STATUS php_http_client_pool_curl_wait(php_http_client_pool_t *h, struct timeval *custom_timeout) +static STATUS php_http_curl_client_pool_wait(php_http_client_pool_t *h, struct timeval *custom_timeout) { int MAX; fd_set R, W, E; struct timeval timeout; - php_http_client_pool_curl_t *curl = h->ctx; + php_http_curl_client_pool_t *curl = h->ctx; #if PHP_HTTP_HAVE_EVENT if (curl->useevents) { @@ -360,9 +360,9 @@ static STATUS php_http_client_pool_curl_wait(php_http_client_pool_t *h, struct t return FAILURE; } -static int php_http_client_pool_curl_once(php_http_client_pool_t *h) +static int php_http_curl_client_pool_once(php_http_client_pool_t *h) { - php_http_client_pool_curl_t *curl = h->ctx; + php_http_curl_client_pool_t *curl = h->ctx; #if PHP_HTTP_HAVE_EVENT if (curl->useevents) { @@ -374,7 +374,7 @@ static int php_http_client_pool_curl_once(php_http_client_pool_t *h) while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curl->handle, &curl->unfinished)); - php_http_client_pool_curl_responsehandler(h); + php_http_curl_client_pool_responsehandler(h); return curl->unfinished; @@ -384,12 +384,12 @@ static void dolog(int i, const char *m) { fprintf(stderr, "%d: %s\n", i, m); } #endif -static STATUS php_http_client_pool_curl_exec(php_http_client_pool_t *h) +static STATUS php_http_curl_client_pool_exec(php_http_client_pool_t *h) { TSRMLS_FETCH_FROM_CTX(h->ts); #if PHP_HTTP_HAVE_EVENT - php_http_client_pool_curl_t *curl = h->ctx; + php_http_curl_client_pool_t *curl = h->ctx; if (curl->useevents) { event_set_log_callback(dolog); @@ -402,8 +402,8 @@ static STATUS php_http_client_pool_curl_exec(php_http_client_pool_t *h) } else #endif { - while (php_http_client_pool_curl_once(h)) { - if (SUCCESS != php_http_client_pool_curl_wait(h, NULL)) { + while (php_http_curl_client_pool_once(h)) { + if (SUCCESS != php_http_curl_client_pool_wait(h, NULL)) { #ifdef PHP_WIN32 /* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */ php_http_error(HE_WARNING, PHP_HTTP_E_SOCKET, "WinSock error: %d", WSAGetLastError()); @@ -418,9 +418,9 @@ static STATUS php_http_client_pool_curl_exec(php_http_client_pool_t *h) return SUCCESS; } -static STATUS php_http_client_pool_curl_setopt(php_http_client_pool_t *h, php_http_client_pool_setopt_opt_t opt, void *arg) +static STATUS php_http_curl_client_pool_setopt(php_http_client_pool_t *h, php_http_client_pool_setopt_opt_t opt, void *arg) { - php_http_client_pool_curl_t *curl = h->ctx; + php_http_curl_client_pool_t *curl = h->ctx; switch (opt) { case PHP_HTTP_CLIENT_POOL_OPT_ENABLE_PIPELINING: @@ -436,9 +436,9 @@ static STATUS php_http_client_pool_curl_setopt(php_http_client_pool_t *h, php_ht curl->timeout = ecalloc(1, sizeof(struct event)); } curl_multi_setopt(curl->handle, CURLMOPT_SOCKETDATA, h); - curl_multi_setopt(curl->handle, CURLMOPT_SOCKETFUNCTION, php_http_client_pool_curl_socket_callback); + curl_multi_setopt(curl->handle, CURLMOPT_SOCKETFUNCTION, php_http_curl_client_pool_socket_callback); curl_multi_setopt(curl->handle, CURLMOPT_TIMERDATA, h); - curl_multi_setopt(curl->handle, CURLMOPT_TIMERFUNCTION, php_http_client_pool_curl_timer_callback); + curl_multi_setopt(curl->handle, CURLMOPT_TIMERFUNCTION, php_http_curl_client_pool_timer_callback); } else { curl_multi_setopt(curl->handle, CURLMOPT_SOCKETDATA, NULL); curl_multi_setopt(curl->handle, CURLMOPT_SOCKETFUNCTION, NULL); @@ -462,28 +462,28 @@ static php_http_resource_factory_ops_t php_http_curlm_resource_factory_ops = { static zend_class_entry *get_class_entry(void) { - return php_http_client_pool_curl_class_entry; + return php_http_curl_client_pool_class_entry; } -static php_http_client_pool_ops_t php_http_client_pool_curl_ops = { +static php_http_client_pool_ops_t php_http_curl_client_pool_ops = { &php_http_curlm_resource_factory_ops, - php_http_client_pool_curl_init, + php_http_curl_client_pool_init, NULL /* copy */, - php_http_client_pool_curl_dtor, + php_http_curl_client_pool_dtor, NULL /*reset */, - php_http_client_pool_curl_exec, - php_http_client_pool_curl_wait, - php_http_client_pool_curl_once, - php_http_client_pool_curl_attach, - php_http_client_pool_curl_detach, - php_http_client_pool_curl_setopt, - (php_http_new_t) php_http_client_pool_curl_object_new_ex, + php_http_curl_client_pool_exec, + php_http_curl_client_pool_wait, + php_http_curl_client_pool_once, + php_http_curl_client_pool_attach, + php_http_curl_client_pool_detach, + php_http_curl_client_pool_setopt, + (php_http_new_t) php_http_curl_client_pool_object_new_ex, get_class_entry }; -PHP_HTTP_API php_http_client_pool_ops_t *php_http_client_pool_curl_get_ops(void) +PHP_HTTP_API php_http_client_pool_ops_t *php_http_curl_client_pool_get_ops(void) { - return &php_http_client_pool_curl_ops; + return &php_http_curl_client_pool_ops; } #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientCURL, method, 0, req_args) @@ -492,17 +492,17 @@ PHP_HTTP_API php_http_client_pool_ops_t *php_http_client_pool_curl_get_ops(void) #define PHP_HTTP_CURL_ALIAS(method, func) PHP_HTTP_STATIC_ME_ALIAS(method, func, PHP_HTTP_ARGS(HttpClientCURL, method)) #define PHP_HTTP_CURL_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpClientCURL_##al), PHP_HTTP_ARGS(HttpClientCURL, al), vis) -zend_class_entry *php_http_client_pool_curl_class_entry; -zend_function_entry php_http_client_pool_curl_method_entry[] = { +zend_class_entry *php_http_curl_client_pool_class_entry; +zend_function_entry php_http_curl_client_pool_method_entry[] = { EMPTY_FUNCTION_ENTRY }; -zend_object_value php_http_client_pool_curl_object_new(zend_class_entry *ce TSRMLS_DC) +zend_object_value php_http_curl_client_pool_object_new(zend_class_entry *ce TSRMLS_DC) { - return php_http_client_pool_curl_object_new_ex(ce, NULL, NULL TSRMLS_CC); + return php_http_curl_client_pool_object_new_ex(ce, NULL, NULL TSRMLS_CC); } -zend_object_value php_http_client_pool_curl_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC) +zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC) { zend_object_value ov; php_http_client_pool_object_t *o; @@ -512,7 +512,7 @@ zend_object_value php_http_client_pool_curl_object_new_ex(zend_class_entry *ce, object_properties_init((zend_object *) o, ce); if (!(o->pool = p)) { - o->pool = php_http_client_pool_init(NULL, &php_http_client_pool_curl_ops, NULL, NULL TSRMLS_CC); + o->pool = php_http_client_pool_init(NULL, &php_http_curl_client_pool_ops, NULL, NULL TSRMLS_CC); } if (ptr) { @@ -526,19 +526,19 @@ zend_object_value php_http_client_pool_curl_object_new_ex(zend_class_entry *ce, } -PHP_MINIT_FUNCTION(http_client_pool_curl) +PHP_MINIT_FUNCTION(http_curl_client_pool) { if (SUCCESS != php_http_persistent_handle_provide(ZEND_STRL("http_client_pool.curl"), &php_http_curlm_resource_factory_ops, NULL, NULL)) { return FAILURE; } - PHP_HTTP_REGISTER_CLASS(http\\Client\\Pool, CURL, http_client_pool_curl, php_http_client_pool_get_class_entry(), 0); - php_http_client_pool_curl_class_entry->create_object = php_http_client_pool_curl_object_new; + PHP_HTTP_REGISTER_CLASS(http\\Curl\\Client, Pool, http_curl_client_pool, php_http_client_pool_get_class_entry(), 0); + php_http_curl_client_pool_class_entry->create_object = php_http_curl_client_pool_object_new; return SUCCESS; } -PHP_RINIT_FUNCTION(http_client_pool_curl) +PHP_RINIT_FUNCTION(http_curl_client_pool) { #if PHP_HTTP_HAVE_EVENT if (!PHP_HTTP_G->curl.event_base && !(PHP_HTTP_G->curl.event_base = event_init())) { diff --git a/php_http_client_pool_curl.h b/php_http_curl_client_pool.h similarity index 67% rename from php_http_client_pool_curl.h rename to php_http_curl_client_pool.h index 092b76c..c0e5eb9 100644 --- a/php_http_client_pool_curl.h +++ b/php_http_curl_client_pool.h @@ -10,31 +10,31 @@ +--------------------------------------------------------------------+ */ -#ifndef PHP_HTTP_CLIENT_POOL_CURL_H -#define PHP_HTTP_CLIENT_POOL_CURL_H +#ifndef PHP_HTTP_CURL_CLIENT_POOL_H +#define PHP_HTTP_CURL_CLIENT_POOL_H #if PHP_HTTP_HAVE_CURL -PHP_HTTP_API php_http_client_pool_ops_t *php_http_client_pool_curl_get_ops(void); +PHP_HTTP_API php_http_client_pool_ops_t *php_http_curl_client_pool_get_ops(void); -extern zend_class_entry *php_http_client_pool_curl_class_entry; -extern zend_function_entry php_http_client_pool_curl_method_entry[]; +extern zend_class_entry *php_http_curl_client_pool_class_entry; +extern zend_function_entry php_http_curl_client_pool_method_entry[]; -extern zend_object_value php_http_client_pool_curl_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_client_pool_curl_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC); +extern zend_object_value php_http_curl_client_pool_object_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC); #if PHP_HTTP_HAVE_EVENT struct php_http_curl_globals { void *event_base; }; -PHP_RINIT_FUNCTION(http_client_pool_curl); +PHP_RINIT_FUNCTION(http_curl_client_pool); #endif -PHP_MINIT_FUNCTION(http_client_pool_curl); +PHP_MINIT_FUNCTION(http_curl_client_pool); #endif /* PHP_HTTP_HAVE_CURL */ -#endif /* PHP_HTTP_CLIENT_POOL_CURL_H */ +#endif /* PHP_HTTP_CURL_CLIENT_POOL_H */ /* * Local variables: -- 2.30.2