X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_methods.c;h=f844c055ba06f3606be5a5281cfba399f771877b;hp=e10923b2b473a2e30d09c6cd9b1e0829c4eb37cb;hb=559c156f3d0aeffe2c920d9275f47cfcdfc40bdf;hpb=2269e8e11a6837fc165ae85406ea6db84c1995cc diff --git a/http_methods.c b/http_methods.c index e10923b..f844c05 100644 --- a/http_methods.c +++ b/http_methods.c @@ -27,6 +27,7 @@ #include "php_http_api.h" #include "php_http_cache_api.h" #include "php_http_request_api.h" +#include "php_http_request_pool_api.h" #include "php_http_date_api.h" #include "php_http_headers_api.h" #include "php_http_message_api.h" @@ -2125,15 +2126,13 @@ PHP_METHOD(HttpRequest, send) } if (SUCCESS == (status = http_request_object_requesthandler(obj, getThis(), &body))) { - zval *info = GET_PROP(obj, responseInfo); - status = http_request_exec(obj->ch, Z_ARRVAL_P(info)); - SET_PROP(obj, responseInfo, info); + status = http_request_exec(obj->ch, NULL); } http_request_body_dtor(&body); /* final data handling */ if (SUCCESS == status) { - status = http_request_object_responsehandler(obj, getThis(), NULL); + status = http_request_object_responsehandler(obj, getThis()); } SET_EH_NORMAL(); @@ -2163,7 +2162,7 @@ PHP_METHOD(HttpRequestPool, __destruct) NO_ARGS; - http_request_pool_detach_all(&obj->pool); + //http_request_pool_detach_all(&obj->pool); } /* }}} */ @@ -2233,6 +2232,59 @@ PHP_METHOD(HttpRequestPool, send) } /* }}} */ +/* {{{ proto protected bool HttpRequestPool::socketSend() + * + * Usage: + *
+ * socketSend()) {
+ *         do_something_else();
+ *         if (!$pool->socketSelect()) {
+ *             die('Socket error');
+ *         }
+ *     }
+ *     $pool->socketRead();
+ * ?>
+ * 
+ */ +PHP_METHOD(HttpRequestPool, socketSend) +{ + getObject(http_requestpool_object, obj); + + NO_ARGS; + + RETURN_BOOL(0 < http_request_pool_perform(&obj->pool)); +} +/* }}} */ + +/* {{{ proto protected bool HttpRequestPool::socketSelect() + * + * See HttpRequestPool::socketSend(). + */ +PHP_METHOD(HttpRequestPool, socketSelect) +{ + getObject(http_requestpool_object, obj); + + NO_ARGS; + + RETURN_SUCCESS(http_request_pool_select(&obj->pool)); +} +/* }}} */ + +/* {{{ proto protected void HttpRequestPool::socketRead() + * + * See HttpRequestPool::socketSend(). + */ +PHP_METHOD(HttpRequestPool, socketRead) +{ + getObject(http_requestpool_object, obj); + + NO_ARGS; + + zend_llist_apply(&obj->pool.handles, (llist_apply_func_t) http_request_pool_responsehandler TSRMLS_CC); +} +/* }}} */ + /* }}} */ /* }}} */