X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_request_factory.c;h=e69f6d1886849ec2aaa58c7295a6d57c11837303;hp=a4ac4f0cd5e622854f3eb03b8172c09d18032797;hb=29a54250b58e444974ae19840194e214cab80bd5;hpb=7dc5de0b79846bfe33ca36a9eeb894ef2ecfdee1 diff --git a/php_http_request_factory.c b/php_http_request_factory.c index a4ac4f0..e69f6d1 100644 --- a/php_http_request_factory.c +++ b/php_http_request_factory.c @@ -1,9 +1,19 @@ - -#include "php_http.h" +/* + +--------------------------------------------------------------------+ + | 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 | + +--------------------------------------------------------------------+ +*/ + +#include "php_http_api.h" #include #include -#include /* * array of name => php_http_request_factory_driver_t* @@ -50,13 +60,19 @@ 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(persistentHandle, 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_VAL(persistentHandle, 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_VAL(persistentHandle, 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(getGlobalDataShareInstance); PHP_HTTP_EMPTY_ARGS(getDriver); @@ -89,7 +105,7 @@ PHP_METHOD(HttpRequestFactory, __construct) 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); + zend_update_property(php_http_request_factory_class_entry, getThis(), key.str, key.len - 1, newval TSRMLS_CC); zval_ptr_dtor(&newval); } } @@ -135,12 +151,12 @@ PHP_METHOD(HttpRequestFactory, createRequest) if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { php_http_resource_factory_ops_t ops = { - php_http_persistent_handle_acquire, - php_http_persistent_handle_accrete, - php_http_persistent_handle_release + (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, + (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, + (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release }; - rf = php_http_resource_factory_init(NULL, &ops, pf, php_http_persistent_handle_abandon TSRMLS_CC); + rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str); @@ -212,12 +228,12 @@ PHP_METHOD(HttpRequestFactory, createPool) if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { php_http_resource_factory_ops_t ops = { - php_http_persistent_handle_acquire, - php_http_persistent_handle_accrete, - php_http_persistent_handle_release + (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, + (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, + (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release }; - rf = php_http_resource_factory_init(NULL, &ops, pf, php_http_persistent_handle_abandon TSRMLS_CC); + rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str); @@ -279,12 +295,12 @@ PHP_METHOD(HttpRequestFactory, createDataShare) if ((pf = php_http_persistent_handle_concede(NULL , name_str, name_len, Z_STRVAL_P(phi), Z_STRLEN_P(phi) TSRMLS_CC))) { php_http_resource_factory_ops_t ops = { - php_http_persistent_handle_acquire, - php_http_persistent_handle_accrete, - php_http_persistent_handle_release + (php_http_resource_factory_handle_ctor_t) php_http_persistent_handle_acquire, + (php_http_resource_factory_handle_copy_t) php_http_persistent_handle_accrete, + (php_http_resource_factory_handle_dtor_t) php_http_persistent_handle_release }; - rf = php_http_resource_factory_init(NULL, &ops, pf, php_http_persistent_handle_abandon TSRMLS_CC); + rf = php_http_resource_factory_init(NULL, &ops, pf, (void (*)(void *)) php_http_persistent_handle_abandon); } efree(name_str); @@ -382,7 +398,7 @@ 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_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); @@ -401,3 +417,13 @@ PHP_MSHUTDOWN_FUNCTION(http_request_factory) 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 + */ +