dnl DONE
dnl ----
PHP_HTTP_SOURCES="\
- php_http.c \
php_http_buffer.c \
+ php_http.c \
+ php_http_client.c \
+ php_http_client_curl.c \
+ php_http_client_datashare.c \
+ php_http_client_datashare_curl.c \
+ php_http_client_factory.c \
+ php_http_client_interface.c \
+ php_http_client_pool.c \
+ php_http_client_pool_curl.c \
+ php_http_client_request.c \
+ php_http_client_response.c \
php_http_cookie.c \
+ php_http_curl.c \
php_http_encoding.c \
php_http_env.c \
php_http_env_request.c \
php_http_etag.c \
php_http_exception.c \
php_http_filter.c \
- php_http_headers.c \
php_http_header_parser.c \
+ php_http_headers.c \
php_http_info.c \
php_http_message_body.c \
php_http_message.c \
php_http_negotiate.c \
php_http_object.c \
php_http_params.c \
- php_http_resource_factory.c \
php_http_persistent_handle.c \
php_http_property_proxy.c \
php_http_querystring.c \
- php_http_curl.c \
- php_http_client_interface.c \
- php_http_client.c \
- php_http_client_pool.c \
- php_http_client_datashare.c \
- php_http_client_curl.c \
- php_http_client_pool_curl.c \
- php_http_client_datashare_curl.c \
- php_http_client_request.c \
- php_http_client_response.c \
+ php_http_resource_factory.c \
php_http_strlist.c \
php_http_url.c \
php_http_version.c \
PHP_SUBST([HTTP_SHARED_LIBADD])
PHP_HTTP_HEADERS="
- php_http.h \
php_http_api.h \
php_http_buffer.h \
+ php_http_client_curl.h \
+ php_http_client_datashare_curl.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_client_pool.h \
+ php_http_client_request.h \
+ php_http_client_response.h \
php_http_cookie.h \
+ php_http_curl.h \
php_http_encoding.h \
php_http_env.h \
php_http_env_request.h \
php_http_etag.h \
php_http_exception.h \
php_http_filter.h \
- php_http_headers.h \
+ php_http.h \
php_http_header_parser.h \
+ php_http_headers.h \
php_http_info.h \
php_http_message_body.h \
php_http_message.h \
php_http_negotiate.h \
php_http_object.h \
php_http_params.h \
- php_http_resource_factory.h \
php_http_persistent_handle.h \
php_http_property_proxy.h \
php_http_querystring.h \
- php_http_request_datashare.h \
- php_http_request.h \
- php_http_request_factory.h \
- php_http_curl.h \
- php_http_request_pool.h \
+ php_http_resource_factory.h \
php_http_strlist.h \
php_http_url.h \
php_http_version.h \
|| SUCCESS != PHP_MINIT_CALL(http_client_response)
|| SUCCESS != PHP_MINIT_CALL(http_client_datashare)
|| SUCCESS != PHP_MINIT_CALL(http_client_pool)
+ || SUCCESS != PHP_MINIT_CALL(http_client_factory)
#if PHP_HTTP_HAVE_CURL
|| SUCCESS != PHP_MINIT_CALL(http_curl)
#endif
|| SUCCESS != PHP_MSHUTDOWN_CALL(http_curl)
#endif
|| SUCCESS != PHP_MSHUTDOWN_CALL(http_persistent_handle)
+ || SUCCESS != PHP_MSHUTDOWN_CALL(http_client_factory)
) {
return FAILURE;
}
#include "php_http_client_pool_curl.h"
#include "php_http_client_datashare.h"
#include "php_http_client_datashare_curl.h"
+#include "php_http_client_factory.h"
#include "php_http_url.h"
#include "php_http_version.h"
PHP_METHOD(HttpClient, __construct)
{
with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ zval *os;
+
+ MAKE_STD_ZVAL(os);
+ object_init_ex(os, spl_ce_SplObjectStorage);
+ zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), os TSRMLS_CC);
+ zval_ptr_dtor(&os);
+
php_http_client_object_set_options(INTERNAL_FUNCTION_PARAM_PASSTHRU);
} end_error_handling();
}
php_http_client_exec_func_t exec;
php_http_client_setopt_func_t setopt;
php_http_client_getopt_func_t getopt;
+ php_http_new_t create_object;
+ zend_class_entry *(*class_entry)(void);
} php_http_client_ops_t;
typedef struct php_http_client {
php_http_curl_dtor
};
+static zend_class_entry *get_class_entry(void)
+{
+ return php_http_client_curl_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_reset,
php_http_client_curl_exec,
php_http_client_curl_setopt,
- php_http_client_curl_getopt
+ php_http_client_curl_getopt,
+ (php_http_new_t) php_http_client_curl_object_new_ex,
+ get_class_entry
};
PHP_HTTP_API php_http_client_ops_t *php_http_client_curl_get_ops(void)
php_http_client_datashare_attach_func_t attach;
php_http_client_datashare_detach_func_t detach;
php_http_client_datashare_setopt_func_t setopt;
+ php_http_new_t create_object;
+ zend_class_entry *(*class_entry)(void);
} php_http_client_datashare_ops_t;
typedef struct php_http_client_datashare {
php_http_curlsh_dtor
};
+static zend_class_entry *get_class_entry(void)
+{
+ return php_http_client_datashare_curl_class_entry;
+}
+
static php_http_client_datashare_ops_t php_http_client_datashare_curl_ops = {
- &php_http_curlsh_resource_factory_ops,
- php_http_client_datashare_curl_init,
- NULL /* copy */,
- php_http_client_datashare_curl_dtor,
- NULL /*reset */,
- php_http_client_datashare_curl_attach,
- php_http_client_datashare_curl_detach,
- php_http_client_datashare_curl_setopt,
+ &php_http_curlsh_resource_factory_ops,
+ php_http_client_datashare_curl_init,
+ NULL /* copy */,
+ php_http_client_datashare_curl_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,
+ 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_client_datashare_curl_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_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);
--- /dev/null
+/*
+ +--------------------------------------------------------------------+
+ | PECL :: http |
+ +--------------------------------------------------------------------+
+ | Redistribution and use in source and binary forms, with or without |
+ | modification, are permitted provided that the conditions mentioned |
+ | in the accompanying LICENSE file are met. |
+ +--------------------------------------------------------------------+
+ | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
+*/
+
+#include "php_http_api.h"
+
+#include <ext/spl/spl_observer.h>
+
+/*
+ * array of name => php_http_client_factory_driver_t*
+ */
+static HashTable php_http_client_factory_drivers;
+
+PHP_HTTP_API STATUS php_http_client_factory_add_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver)
+{
+ return zend_hash_add(&php_http_client_factory_drivers, name_str, name_len + 1, (void *) driver, sizeof(php_http_client_factory_driver_t), NULL);
+}
+
+PHP_HTTP_API STATUS php_http_client_factory_get_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver)
+{
+ php_http_client_factory_driver_t *tmp;
+
+ if (SUCCESS == zend_hash_find(&php_http_client_factory_drivers, name_str, name_len + 1, (void *) &tmp)) {
+ *driver = *tmp;
+ return SUCCESS;
+ }
+ return FAILURE;
+}
+
+static zend_class_entry *php_http_client_factory_get_class_entry(zval *this_ptr, const char *for_str, size_t for_len TSRMLS_DC)
+{
+ /* stupid non-const api */
+ char *sc = estrndup(for_str, for_len);
+ zval *cn = zend_read_property(Z_OBJCE_P(getThis()), getThis(), sc, for_len, 0 TSRMLS_CC);
+
+ efree(sc);
+ if (Z_TYPE_P(cn) == IS_STRING && Z_STRLEN_P(cn)) {
+ return zend_fetch_class(Z_STRVAL_P(cn), Z_STRLEN_P(cn), 0 TSRMLS_CC);
+ }
+
+ return NULL;
+}
+
+#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientFactory, method, 0, req_args)
+#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientFactory, method, 0)
+#define PHP_HTTP_REQUEST_FACTORY_ME(method, visibility) PHP_ME(HttpClientFactory, method, PHP_HTTP_ARGS(HttpClientFactory, method), visibility)
+#define PHP_HTTP_REQUEST_FACTORY_ALIAS(method, func) PHP_HTTP_STATIC_ME_ALIAS(method, func, PHP_HTTP_ARGS(HttpClientFactory, method))
+#define PHP_HTTP_REQUEST_FACTORY_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpClientFactory_##al), PHP_HTTP_ARGS(HttpClientFactory, al), vis)
+
+PHP_HTTP_BEGIN_ARGS(__construct, 1)
+ PHP_HTTP_ARG_VAL(options, 0)
+PHP_HTTP_END_ARGS;
+PHP_HTTP_BEGIN_ARGS(createClient, 0)
+ PHP_HTTP_ARG_ARR(options, 1, 0)
+PHP_HTTP_END_ARGS;
+PHP_HTTP_BEGIN_ARGS(createPool, 0)
+ PHP_HTTP_ARG_OBJ(http\\Client, client1, 1)
+ PHP_HTTP_ARG_OBJ(http\\Client, client2, 1)
+ PHP_HTTP_ARG_OBJ(http\\Client, clientN, 1)
+PHP_HTTP_END_ARGS;
+PHP_HTTP_BEGIN_ARGS(createDataShare, 0)
+ PHP_HTTP_ARG_OBJ(http\\Client, client1, 1)
+ PHP_HTTP_ARG_OBJ(http\\Client, client2, 1)
+ PHP_HTTP_ARG_OBJ(http\\Client, clientN, 1)
+PHP_HTTP_END_ARGS;
+PHP_HTTP_EMPTY_ARGS(getDriver);
+PHP_HTTP_EMPTY_ARGS(getAvailableDrivers);
+
+zend_class_entry *php_http_client_factory_class_entry;
+zend_function_entry php_http_client_factory_method_entry[] = {
+ PHP_HTTP_REQUEST_FACTORY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_HTTP_REQUEST_FACTORY_ME(createClient, ZEND_ACC_PUBLIC)
+ PHP_HTTP_REQUEST_FACTORY_ME(createPool, ZEND_ACC_PUBLIC)
+ PHP_HTTP_REQUEST_FACTORY_ME(createDataShare, ZEND_ACC_PUBLIC)
+ PHP_HTTP_REQUEST_FACTORY_ME(getDriver, ZEND_ACC_PUBLIC)
+ PHP_HTTP_REQUEST_FACTORY_ME(getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+PHP_METHOD(HttpClientFactory, __construct)
+{
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ HashTable *options = NULL;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h", &options)) {
+ if (options) {
+ zval **val;
+ HashPosition pos;
+ php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+
+ FOREACH_HASH_KEYVAL(pos, options, key, val) {
+ if (key.type == HASH_KEY_IS_STRING) {
+ zval *newval = php_http_zsep(1, Z_TYPE_PP(val), *val);
+ zend_update_property(php_http_client_factory_class_entry, getThis(), key.str, key.len - 1, newval TSRMLS_CC);
+ zval_ptr_dtor(&newval);
+ }
+ }
+ }
+ }
+ } end_error_handling();
+}
+
+PHP_METHOD(HttpClientFactory, createClient)
+{
+ zval *options = NULL;
+
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &options)) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ zval *zdriver, *os;
+ zend_object_value ov;
+ zend_class_entry *class_entry = NULL;
+ php_http_client_t *req = NULL;
+ php_http_client_factory_driver_t driver;
+
+ zdriver = zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
+
+ if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_client_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.client_ops) {
+ zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
+ php_http_resource_factory_t *rf = NULL;
+
+ if (Z_STRLEN_P(phi)) {
+ char *name_str;
+ size_t name_len;
+ php_http_persistent_handle_factory_t *pf;
+
+ name_len = spprintf(&name_str, 0, "http_client.%s", Z_STRVAL_P(zdriver));
+
+ if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
+ rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
+ }
+
+ efree(name_str);
+ }
+
+ req = php_http_client_init(NULL, driver.client_ops, rf, NULL TSRMLS_CC);
+ if (req) {
+ if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientClass") TSRMLS_CC))) {
+ class_entry = driver.client_ops->class_entry();
+ }
+
+ if (SUCCESS == php_http_new(&ov, class_entry, driver.client_ops->create_object, driver.client_ops->class_entry(), req, NULL TSRMLS_CC)) {
+ ZVAL_OBJVAL(return_value, ov, 0);
+
+ zend_call_method_with_1_params(&return_value, Z_OBJCE_P(return_value), NULL, "__construct", NULL, options);
+ } else {
+ php_http_client_free(&req);
+ }
+ }
+
+ zval_ptr_dtor(&phi);
+ } else {
+ php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "clients are not supported by this driver");
+ }
+ } end_error_handling();
+ }
+ } end_error_handling();
+}
+
+PHP_METHOD(HttpClientFactory, createPool)
+{
+ int argc = 0;
+ zval ***argv;
+
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ int i;
+ zval *zdriver;
+ zend_object_value ov;
+ zend_class_entry *class_entry = NULL;
+ php_http_client_pool_t *pool = NULL;
+ php_http_client_factory_driver_t driver;
+
+ zdriver = zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
+ if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_client_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.client_pool_ops) {
+ zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
+ php_http_resource_factory_t *rf = NULL;
+
+ if (Z_STRLEN_P(phi)) {
+ char *name_str;
+ size_t name_len;
+ php_http_persistent_handle_factory_t *pf;
+
+ name_len = spprintf(&name_str, 0, "http_client_pool.%s", Z_STRVAL_P(zdriver));
+
+ if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
+ rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
+ }
+
+ efree(name_str);
+ }
+
+ pool = php_http_client_pool_init(NULL, driver.client_pool_ops, rf, NULL TSRMLS_CC);
+ if (pool) {
+ if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientPoolClass") TSRMLS_CC))) {
+ class_entry = driver.client_pool_ops->class_entry();
+ }
+
+ if (SUCCESS == php_http_new(&ov, class_entry, driver.client_pool_ops->create_object, driver.client_pool_ops->class_entry(), pool, NULL TSRMLS_CC)) {
+ ZVAL_OBJVAL(return_value, ov, 0);
+ for (i = 0; i < argc; ++i) {
+ if (Z_TYPE_PP(argv[i]) == IS_OBJECT && instanceof_function(Z_OBJCE_PP(argv[i]), php_http_client_class_entry TSRMLS_CC)) {
+ php_http_client_pool_attach(pool, *(argv[i]));
+ }
+ }
+ } else {
+ php_http_client_pool_free(&pool);
+ }
+ }
+
+ zval_ptr_dtor(&phi);
+ } else {
+ php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "pools are not supported by this driver");
+ }
+ } end_error_handling();
+ }
+ } end_error_handling();
+}
+
+PHP_METHOD(HttpClientFactory, createDataShare)
+{
+ int argc = 0;
+ zval ***argv;
+
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ int i;
+ zval *zdriver;
+ zend_object_value ov;
+ zend_class_entry *class_entry;
+ php_http_client_datashare_t *share = NULL;
+ php_http_client_factory_driver_t driver;
+
+ zdriver = zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
+ if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_client_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.client_datashare_ops) {
+ zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_client_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
+ php_http_resource_factory_t *rf = NULL;
+
+ if (Z_STRLEN_P(phi)) {
+ char *name_str;
+ size_t name_len;
+ php_http_persistent_handle_factory_t *pf;
+
+ name_len = spprintf(&name_str, 0, "http_client_datashare.%s", Z_STRVAL_P(zdriver));
+
+ if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
+ rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
+ }
+
+ efree(name_str);
+ }
+
+ share = php_http_client_datashare_init(NULL, driver.client_datashare_ops, rf, NULL TSRMLS_CC);
+ if (share) {
+ if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientDataShareClass") TSRMLS_CC))) {
+ class_entry = driver.client_datashare_ops->class_entry();
+ }
+
+ if (SUCCESS == php_http_new(&ov, class_entry, driver.client_datashare_ops->create_object, driver.client_datashare_ops->class_entry(), share, NULL TSRMLS_CC)) {
+ ZVAL_OBJVAL(return_value, ov, 0);
+ for (i = 0; i < argc; ++i) {
+ if (Z_TYPE_PP(argv[i]) == IS_OBJECT && instanceof_function(Z_OBJCE_PP(argv[i]), php_http_client_class_entry TSRMLS_CC)) {
+ php_http_client_datashare_attach(share, *(argv[i]));
+ }
+ }
+ } else {
+ php_http_client_datashare_free(&share);
+ }
+ }
+
+ zval_ptr_dtor(&phi);
+ } else {
+ php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "datashares are not supported by this driver");
+ }
+ } end_error_handling();
+ }
+ } end_error_handling();
+}
+
+PHP_METHOD(HttpClientFactory, getDriver)
+{
+ if (SUCCESS == zend_parse_parameters_none()) {
+ RETURN_PROP(php_http_client_factory_class_entry, "driver");
+ }
+ RETURN_FALSE;
+}
+
+PHP_METHOD(HttpClientFactory, getAvailableDrivers)
+{
+ if (SUCCESS == zend_parse_parameters_none()) {
+ HashPosition pos;
+ php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+
+ array_init(return_value);
+ FOREACH_HASH_KEY(pos, &php_http_client_factory_drivers, key) {
+ add_next_index_stringl(return_value, key.str, key.len - 1, 1);
+ }
+ return;
+ }
+ RETURN_FALSE;
+}
+
+PHP_MINIT_FUNCTION(http_client_factory)
+{
+ zend_hash_init(&php_http_client_factory_drivers, 0, NULL, NULL, 1);
+
+ PHP_HTTP_REGISTER_CLASS(http\\Client, Factory, http_client_factory, php_http_object_class_entry, 0);
+ php_http_client_factory_class_entry->create_object = php_http_client_factory_new;
+
+ zend_declare_property_stringl(php_http_client_factory_class_entry, ZEND_STRL("driver"), ZEND_STRL("curl"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(php_http_client_factory_class_entry, ZEND_STRL("persistentHandleId"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(php_http_client_factory_class_entry, ZEND_STRL("clientClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(php_http_client_factory_class_entry, ZEND_STRL("clientPoolClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(php_http_client_factory_class_entry, ZEND_STRL("clientDataShareClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
+
+ return SUCCESS;
+}
+
+PHP_MSHUTDOWN_FUNCTION(http_client_factory)
+{
+ zend_hash_destroy(&php_http_client_factory_drivers);
+
+ return SUCCESS;
+}
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
--- /dev/null
+/*
+ +--------------------------------------------------------------------+
+ | PECL :: http |
+ +--------------------------------------------------------------------+
+ | Redistribution and use in source and binary forms, with or without |
+ | modification, are permitted provided that the conditions mentioned |
+ | in the accompanying LICENSE file are met. |
+ +--------------------------------------------------------------------+
+ | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
+*/
+
+#ifndef PHP_HTTP_REQUEST_FACTORY_H
+#define PHP_HTTP_REQUEST_FACTORY_H
+
+#include "php_http_client.h"
+#include "php_http_client_pool.h"
+#include "php_http_client_datashare.h"
+
+typedef struct php_http_client_factory_driver {
+ php_http_client_ops_t *client_ops;
+ php_http_client_pool_ops_t *client_pool_ops;
+ php_http_client_datashare_ops_t *client_datashare_ops;
+} php_http_client_factory_driver_t;
+
+PHP_HTTP_API STATUS php_http_client_factory_add_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver);
+PHP_HTTP_API STATUS php_http_client_factory_get_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver);
+
+extern zend_class_entry *php_http_client_factory_class_entry;
+extern zend_function_entry php_http_client_factory_method_entry[];
+
+#define php_http_client_factory_new php_http_object_new
+
+PHP_METHOD(HttpClientFactory, __construct);
+PHP_METHOD(HttpClientFactory, createClient);
+PHP_METHOD(HttpClientFactory, createPool);
+PHP_METHOD(HttpClientFactory, createDataShare);
+PHP_METHOD(HttpClientFactory, getGlobalDataShareInstance);
+PHP_METHOD(HttpClientFactory, getDriver);
+PHP_METHOD(HttpClientFactory, getAvailableDrivers);
+
+extern PHP_MINIT_FUNCTION(http_client_factory);
+extern PHP_MSHUTDOWN_FUNCTION(http_client_factory);
+
+#endif /* PHP_HTTP_REQUEST_FACTORY_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
php_http_client_pool_attach_func_t attach;
php_http_client_pool_detach_func_t detach;
php_http_client_pool_setopt_func_t setopt;
+ php_http_new_t create_object;
+ zend_class_entry *(*class_entry)(void);
} php_http_client_pool_ops_t;
typedef struct php_http_client_pool {
php_http_curlm_dtor
};
+static zend_class_entry *get_class_entry(void)
+{
+ return php_http_client_pool_curl_class_entry;
+}
+
static php_http_client_pool_ops_t php_http_client_pool_curl_ops = {
- &php_http_curlm_resource_factory_ops,
- php_http_client_pool_curl_init,
- NULL /* copy */,
- php_http_client_pool_curl_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_curlm_resource_factory_ops,
+ php_http_client_pool_curl_init,
+ NULL /* copy */,
+ php_http_client_pool_curl_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,
+ get_class_entry
};
PHP_HTTP_API php_http_client_pool_ops_t *php_http_client_pool_curl_get_ops(void)
#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_CURL_ME(method, visibility) PHP_ME(HttpClientCURL, method, PHP_HTTP_ARGS(HttpClientCURL, method), visibility)
-#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)
+#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[] = {
PHP_HTTP_API php_http_client_pool_ops_t *php_http_client_pool_curl_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_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);
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()
+ };
+
#ifdef PHP_HTTP_NEED_OPENSSL_TSL
/* mod_ssl, libpq or ext/curl might already have set thread lock callbacks */
if (!CRYPTO_get_id_callback()) {
return FAILURE;
}
+ if (SUCCESS != php_http_client_factory_add_driver(ZEND_STRL("curl"), &driver)) {
+ return FAILURE;
+ }
+
return SUCCESS;
}
+++ /dev/null
-/*
- +--------------------------------------------------------------------+
- | PECL :: http |
- +--------------------------------------------------------------------+
- | Redistribution and use in source and binary forms, with or without |
- | modification, are permitted provided that the conditions mentioned |
- | in the accompanying LICENSE file are met. |
- +--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
- +--------------------------------------------------------------------+
-*/
-
-#include "php_http_api.h"
-
-#include <ext/spl/spl_observer.h>
-
-/*
- * array of name => php_http_request_factory_driver_t*
- */
-static HashTable php_http_request_factory_drivers;
-
-PHP_HTTP_API STATUS php_http_request_factory_add_driver(const char *name_str, size_t name_len, php_http_request_factory_driver_t *driver)
-{
- return zend_hash_add(&php_http_request_factory_drivers, name_str, name_len + 1, (void *) driver, sizeof(php_http_request_factory_driver_t), NULL);
-}
-
-PHP_HTTP_API STATUS php_http_request_factory_get_driver(const char *name_str, size_t name_len, php_http_request_factory_driver_t *driver)
-{
- php_http_request_factory_driver_t *tmp;
-
- if (SUCCESS == zend_hash_find(&php_http_request_factory_drivers, name_str, name_len + 1, (void *) &tmp)) {
- *driver = *tmp;
- return SUCCESS;
- }
- return FAILURE;
-}
-
-static zend_class_entry *php_http_request_factory_get_class_entry(zval *this_ptr, const char *for_str, size_t for_len TSRMLS_DC)
-{
- /* stupid non-const api */
- char *sc = estrndup(for_str, for_len);
- zval *cn = zend_read_property(Z_OBJCE_P(getThis()), getThis(), sc, for_len, 0 TSRMLS_CC);
-
- efree(sc);
- if (Z_TYPE_P(cn) == IS_STRING && Z_STRLEN_P(cn)) {
- return zend_fetch_class(Z_STRVAL_P(cn), Z_STRLEN_P(cn), 0 TSRMLS_CC);
- }
-
- return NULL;
-}
-
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpRequestFactory, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpRequestFactory, method, 0)
-#define PHP_HTTP_REQUEST_FACTORY_ME(method, visibility) PHP_ME(HttpRequestFactory, method, PHP_HTTP_ARGS(HttpRequestFactory, method), visibility)
-#define PHP_HTTP_REQUEST_FACTORY_ALIAS(method, func) PHP_HTTP_STATIC_ME_ALIAS(method, func, PHP_HTTP_ARGS(HttpRequestFactory, method))
-#define PHP_HTTP_REQUEST_FACTORY_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpRequestFactory_##al), PHP_HTTP_ARGS(HttpRequestFactory, al), vis)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 1)
- PHP_HTTP_ARG_VAL(options, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(createRequest, 0)
- PHP_HTTP_ARG_VAL(url, 0)
- PHP_HTTP_ARG_VAL(method, 0)
- PHP_HTTP_ARG_VAL(options, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(createPool, 0)
- PHP_HTTP_ARG_OBJ(http\\Request, request1, 1)
- PHP_HTTP_ARG_OBJ(http\\Request, request2, 1)
- PHP_HTTP_ARG_OBJ(http\\Request, requestN, 1)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(createDataShare, 0)
- PHP_HTTP_ARG_OBJ(http\\Request, request1, 1)
- PHP_HTTP_ARG_OBJ(http\\Request, request2, 1)
- PHP_HTTP_ARG_OBJ(http\\Request, requestN, 1)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_EMPTY_ARGS(getDriver);
-PHP_HTTP_EMPTY_ARGS(getAvailableDrivers);
-
-zend_class_entry *php_http_request_factory_class_entry;
-zend_function_entry php_http_request_factory_method_entry[] = {
- PHP_HTTP_REQUEST_FACTORY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_REQUEST_FACTORY_ME(createRequest, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQUEST_FACTORY_ME(createPool, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQUEST_FACTORY_ME(createDataShare, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQUEST_FACTORY_ME(getDriver, ZEND_ACC_PUBLIC)
- PHP_HTTP_REQUEST_FACTORY_ME(getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
-PHP_METHOD(HttpRequestFactory, __construct)
-{
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- HashTable *options = NULL;
-
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h", &options)) {
- if (options) {
- zval **val;
- HashPosition pos;
- php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-
- FOREACH_HASH_KEYVAL(pos, options, key, val) {
- if (key.type == HASH_KEY_IS_STRING) {
- zval *newval = php_http_zsep(1, Z_TYPE_PP(val), *val);
- zend_update_property(php_http_request_factory_class_entry, getThis(), key.str, key.len - 1, newval TSRMLS_CC);
- zval_ptr_dtor(&newval);
- }
- }
- }
- }
- } end_error_handling();
-}
-
-PHP_METHOD(HttpRequestFactory, createRequest)
-{
- char *meth_str = NULL, *url_str = NULL;
- int meth_len, url_len;
- zval *options = NULL;
-
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!", &url_str, &url_len, &meth_str, &meth_len, &options)) {
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- zval *zdriver, *os;
- zend_object_value ov;
- zend_class_entry *class_entry = NULL;
- php_http_client_t *req = NULL;
- php_http_request_factory_driver_t driver;
-
- class_entry = php_http_request_factory_get_class_entry(getThis(), ZEND_STRL("requestClass") TSRMLS_CC);
-
- if (!class_entry) {
- class_entry = php_http_client_class_entry;
- }
-
- zdriver = zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
-
- if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_request_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.request_ops) {
- zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
- php_http_resource_factory_t *rf = NULL;
-
- if (Z_STRLEN_P(phi)) {
- char *name_str;
- size_t name_len;
- php_http_persistent_handle_factory_t *pf;
-
- name_len = spprintf(&name_str, 0, "http_request.%s", Z_STRVAL_P(zdriver));
-
- if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
- rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
- }
-
- efree(name_str);
- }
-
- req = php_http_client_init(NULL, driver.request_ops, rf, NULL TSRMLS_CC);
- if (req) {
- if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_client_object_new_ex, php_http_client_class_entry, req, NULL TSRMLS_CC)) {
- ZVAL_OBJVAL(return_value, ov, 0);
-
- MAKE_STD_ZVAL(os);
- object_init_ex(os, spl_ce_SplObjectStorage);
- zend_update_property(php_http_client_class_entry, return_value, ZEND_STRL("observers"), os TSRMLS_CC);
- zval_ptr_dtor(&os);
-
- if (url_str) {
- zend_update_property_stringl(php_http_client_class_entry, return_value, ZEND_STRL("url"), url_str, url_len TSRMLS_CC);
- }
- if (meth_str) {
- zend_update_property_stringl(php_http_client_class_entry, return_value, ZEND_STRL("method"), meth_str, meth_len TSRMLS_CC);
- }
- if (options) {
- zend_call_method_with_1_params(&return_value, Z_OBJCE_P(return_value), NULL, "setoptions", NULL, options);
- }
- } else {
- php_http_client_free(&req);
- }
- }
-
- zval_ptr_dtor(&phi);
- } else {
- php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "requests are not supported by this driver");
- }
- } end_error_handling();
- }
- } end_error_handling();
-}
-
-PHP_METHOD(HttpRequestFactory, createPool)
-{
- int argc = 0;
- zval ***argv;
-
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- int i;
- zval *zdriver;
- zend_object_value ov;
- zend_class_entry *class_entry = NULL;
- php_http_request_pool_t *pool = NULL;
- php_http_request_factory_driver_t driver;
-
- if (!(class_entry = php_http_request_factory_get_class_entry(getThis(), ZEND_STRL("requestPoolClass") TSRMLS_CC))) {
- class_entry = php_http_request_pool_class_entry;
- }
-
- zdriver = zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
- if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_request_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.request_pool_ops) {
- zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
- php_http_resource_factory_t *rf = NULL;
-
- if (Z_STRLEN_P(phi)) {
- char *name_str;
- size_t name_len;
- php_http_persistent_handle_factory_t *pf;
-
- name_len = spprintf(&name_str, 0, "http_request_pool.%s", Z_STRVAL_P(zdriver));
-
- if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
- rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
- }
-
- efree(name_str);
- }
-
- pool = php_http_request_pool_init(NULL, driver.request_pool_ops, rf, NULL TSRMLS_CC);
- if (pool) {
- if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_request_pool_object_new_ex, php_http_request_pool_class_entry, pool, NULL TSRMLS_CC)) {
- ZVAL_OBJVAL(return_value, ov, 0);
- for (i = 0; i < argc; ++i) {
- if (Z_TYPE_PP(argv[i]) == IS_OBJECT && instanceof_function(Z_OBJCE_PP(argv[i]), php_http_client_class_entry TSRMLS_CC)) {
- php_http_request_pool_attach(pool, *(argv[i]));
- }
- }
- } else {
- php_http_request_pool_free(&pool);
- }
- }
-
- zval_ptr_dtor(&phi);
- } else {
- php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "pools are not supported by this driver");
- }
- } end_error_handling();
- }
- } end_error_handling();
-}
-
-PHP_METHOD(HttpRequestFactory, createDataShare)
-{
- int argc = 0;
- zval ***argv;
-
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) {
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- int i;
- zval *zdriver;
- zend_object_value ov;
- zend_class_entry *class_entry;
- php_http_client_datashare_t *share = NULL;
- php_http_request_factory_driver_t driver;
-
- if (!(class_entry = php_http_request_factory_get_class_entry(getThis(), ZEND_STRL("requestDataShareClass") TSRMLS_CC))) {
- class_entry = php_http_request_datashare_class_entry;
- }
-
- zdriver = zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC);
- if ((IS_STRING == Z_TYPE_P(zdriver)) && (SUCCESS == php_http_request_factory_get_driver(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver), &driver)) && driver.request_datashare_ops) {
- zval *phi = php_http_zsep(1, IS_STRING, zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("persistentHandleId"), 0 TSRMLS_CC));
- php_http_resource_factory_t *rf = NULL;
-
- if (Z_STRLEN_P(phi)) {
- char *name_str;
- size_t name_len;
- php_http_persistent_handle_factory_t *pf;
-
- name_len = spprintf(&name_str, 0, "http_request_datashare.%s", Z_STRVAL_P(zdriver));
-
- if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) {
- rf = php_http_resource_factory_init(NULL, php_http_persistent_handle_resource_factory_ops(), pf, (void (*)(void *)) php_http_persistent_handle_abandon);
- }
-
- efree(name_str);
- }
-
- share = php_http_client_datashare_init(NULL, driver.request_datashare_ops, rf, NULL TSRMLS_CC);
- if (share) {
- if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_request_datashare_object_new_ex, php_http_request_datashare_class_entry, share, NULL TSRMLS_CC)) {
- ZVAL_OBJVAL(return_value, ov, 0);
- for (i = 0; i < argc; ++i) {
- if (Z_TYPE_PP(argv[i]) == IS_OBJECT && instanceof_function(Z_OBJCE_PP(argv[i]), php_http_client_class_entry TSRMLS_CC)) {
- php_http_request_datashare_attach(share, *(argv[i]));
- }
- }
- } else {
- php_http_request_datashare_free(&share);
- }
- }
-
- zval_ptr_dtor(&phi);
- } else {
- php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_FACTORY, "datashares are not supported by this driver");
- }
- } end_error_handling();
- }
- } end_error_handling();
-}
-
-PHP_METHOD(HttpRequestFactory, getDriver)
-{
- if (SUCCESS == zend_parse_parameters_none()) {
- RETURN_PROP(php_http_request_factory_class_entry, "driver");
- }
- RETURN_FALSE;
-}
-
-PHP_METHOD(HttpRequestFactory, getAvailableDrivers)
-{
- if (SUCCESS == zend_parse_parameters_none()) {
- HashPosition pos;
- php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-
- array_init(return_value);
- FOREACH_HASH_KEY(pos, &php_http_request_factory_drivers, key) {
- add_next_index_stringl(return_value, key.str, key.len - 1, 1);
- }
- return;
- }
- RETURN_FALSE;
-}
-
-PHP_MINIT_FUNCTION(http_request_factory)
-{
- zend_hash_init(&php_http_request_factory_drivers, 0, NULL, NULL, 1);
-
- PHP_HTTP_REGISTER_CLASS(http\\Request, Factory, http_request_factory, php_http_object_class_entry, 0);
- php_http_request_factory_class_entry->create_object = php_http_request_factory_new;
-
- zend_declare_property_stringl(php_http_request_factory_class_entry, ZEND_STRL("driver"), ZEND_STRL("curl"), ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_property_null(php_http_request_factory_class_entry, ZEND_STRL("persistentHandleId"), ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_property_null(php_http_request_factory_class_entry, ZEND_STRL("requestClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_property_null(php_http_request_factory_class_entry, ZEND_STRL("requestPoolClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_property_null(php_http_request_factory_class_entry, ZEND_STRL("requestDataShareClass"), ZEND_ACC_PROTECTED TSRMLS_CC);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(http_request_factory)
-{
- zend_hash_destroy(&php_http_request_factory_drivers);
-
- return SUCCESS;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
+++ /dev/null
-/*
- +--------------------------------------------------------------------+
- | PECL :: http |
- +--------------------------------------------------------------------+
- | Redistribution and use in source and binary forms, with or without |
- | modification, are permitted provided that the conditions mentioned |
- | in the accompanying LICENSE file are met. |
- +--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
- +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_HTTP_REQUEST_FACTORY_H
-#define PHP_HTTP_REQUEST_FACTORY_H
-
-#include "php_http_request.h"
-#include "php_http_request_pool.h"
-#include "php_http_request_datashare.h"
-
-typedef struct php_http_request_factory_driver {
- php_http_client_ops_t *request_ops;
- php_http_request_pool_ops_t *request_pool_ops;
- php_http_request_datashare_ops_t *request_datashare_ops;
-} php_http_request_factory_driver_t;
-
-PHP_HTTP_API STATUS php_http_request_factory_add_driver(const char *name_str, size_t name_len, php_http_request_factory_driver_t *driver);
-PHP_HTTP_API STATUS php_http_request_factory_get_driver(const char *name_str, size_t name_len, php_http_request_factory_driver_t *driver);
-
-extern zend_class_entry *php_http_request_factory_class_entry;
-extern zend_function_entry php_http_request_factory_method_entry[];
-
-#define php_http_request_factory_new php_http_object_new
-
-PHP_METHOD(HttpRequestFactory, __construct);
-PHP_METHOD(HttpRequestFactory, createRequest);
-PHP_METHOD(HttpRequestFactory, createPool);
-PHP_METHOD(HttpRequestFactory, createDataShare);
-PHP_METHOD(HttpRequestFactory, getGlobalDataShareInstance);
-PHP_METHOD(HttpRequestFactory, getDriver);
-PHP_METHOD(HttpRequestFactory, getAvailableDrivers);
-
-extern PHP_MINIT_FUNCTION(http_request_factory);
-extern PHP_MSHUTDOWN_FUNCTION(http_request_factory);
-
-#endif /* PHP_HTTP_REQUEST_FACTORY_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-