X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_requestpool_object.c;h=4a4293ba29549eed553b30540971e918bd8f42e6;hp=3a203eff75925b013391a2022374dd1664babdb9;hb=2296badf107bded5e8ca4d45fdd8ef0f6e5b1d5b;hpb=b3afcfc70bf06c062115f4994cc04fc8c6e4aa67 diff --git a/http_requestpool_object.c b/http_requestpool_object.c index 3a203ef..4a4293b 100644 --- a/http_requestpool_object.c +++ b/http_requestpool_object.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2006, Michael Wallner | + | Copyright (c) 2004-2007, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -35,11 +35,7 @@ extern PHPAPI zend_class_entry *spl_ce_Countable; #define HTTP_EMPTY_ARGS(method) HTTP_EMPTY_ARGS_EX(HttpRequestPool, method, 0) #define HTTP_REQPOOL_ME(method, visibility) PHP_ME(HttpRequestPool, method, HTTP_ARGS(HttpRequestPool, method), visibility) -HTTP_BEGIN_ARGS(__construct, 0) - HTTP_ARG_OBJ(HttpRequest, request0, 0) - HTTP_ARG_OBJ(HttpRequest, request1, 0) - HTTP_ARG_OBJ(HttpRequest, requestN, 0) -HTTP_END_ARGS; +HTTP_EMPTY_ARGS(__construct); HTTP_EMPTY_ARGS(__destruct); HTTP_EMPTY_ARGS(reset); @@ -71,6 +67,10 @@ HTTP_BEGIN_ARGS(enablePipelining, 0) HTTP_ARG_VAL(enable, 0) HTTP_END_ARGS; +HTTP_BEGIN_ARGS(enableEvents, 0) + HTTP_ARG_VAL(enable, 0) +HTTP_END_ARGS; + zend_class_entry *http_requestpool_object_ce; zend_function_entry http_requestpool_object_fe[] = { HTTP_REQPOOL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) @@ -97,6 +97,7 @@ zend_function_entry http_requestpool_object_fe[] = { HTTP_REQPOOL_ME(getFinishedRequests, ZEND_ACC_PUBLIC) HTTP_REQPOOL_ME(enablePipelining, ZEND_ACC_PUBLIC) + HTTP_REQPOOL_ME(enableEvents, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; @@ -401,7 +402,7 @@ PHP_METHOD(HttpRequestPool, getFinishedRequests) } /* }}} */ -/* {{{ proto bool HttpRequest::enablePiplelinig([bool enable = true]) +/* {{{ proto bool HttpRequestPool::enablePipelining([bool enable = true]) Enables pipelining support for all attached requests if support in libcurl is given. */ PHP_METHOD(HttpRequestPool, enablePipelining) { @@ -420,6 +421,23 @@ PHP_METHOD(HttpRequestPool, enablePipelining) } /* }}} */ +/* {{{ proto bool HttpRequestPool::enableEvents([bool enable = true]) + Enables event-driven I/O if support in libcurl is given. */ +PHP_METHOD(HttpRequestPool, enableEvents) +{ + zend_bool enable = 1; + getObject(http_requestpool_object, obj); + + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &enable)) { +#if defined(HTTP_HAVE_EVENT) + obj->pool.useevents = enable; + RETURN_TRUE; +#endif + } + RETURN_FALSE; +} +/* }}} */ + #endif /* ZEND_ENGINE_2 && HTTP_HAVE_CURL */ /*