X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_request_pool_api.h;h=1ae2056cb969cd30c00d049c7a2444066168299e;hp=115cd3d5202f0c38bddadb1c3d65268b327778ff;hb=f2d0dbf38d7b00455d3dfba8f2de087105ae0f35;hpb=77b24e0e5f85b64a168a4ea4ce83db9339b1f31b diff --git a/php_http_request_pool_api.h b/php_http_request_pool_api.h index 115cd3d..1ae2056 100644 --- a/php_http_request_pool_api.h +++ b/php_http_request_pool_api.h @@ -1,42 +1,57 @@ /* - +----------------------------------------------------------------------+ - | PECL :: http | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, that | - | is bundled with this package in the file LICENSE, and is available | - | through the world-wide-web at http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Copyright (c) 2004-2005 Michael Wallner | - +----------------------------------------------------------------------+ + +--------------------------------------------------------------------+ + | 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-2005, Michael Wallner | + +--------------------------------------------------------------------+ */ /* $Id$ */ #ifndef PHP_HTTP_REQUEST_POOL_API_H #define PHP_HTTP_REQUEST_POOL_API_H - -#include "php_http_std_defs.h" -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif - -#include +#ifdef HTTP_HAVE_CURL typedef struct { CURLM *ch; - zend_bool sent; + zend_llist finished; zend_llist handles; zend_llist bodies; int unfinished; } http_request_pool; #define http_request_pool_responsehandler _http_request_pool_responsehandler -extern void _http_request_pool_responsehandler(zval **req TSRMLS_DC); +extern void _http_request_pool_responsehandler(zval **req, CURL *ch TSRMLS_DC); +#define http_request_pool_requesthandler(r, b) _http_request_pool_requesthandler((r), (b) TSRMLS_CC) +extern STATUS _http_request_pool_requesthandler(zval *request, http_request_body *body TSRMLS_DC); + +#define http_request_pool_try \ + { \ + zval *old_exception = EG(exception); \ + EG(exception) = NULL; +#define http_request_pool_catch() \ + if (EG(exception)) { \ + http_request_pool_wrap_exception(old_exception, EG(exception)); \ + } else { \ + EG(exception) = old_exception; \ + } \ + } +#define http_request_pool_final() \ + if (EG(exception)) { \ + zval *exception; \ + http_request_pool_wrap_exception(NULL, EG(exception)); \ + exception = EG(exception); \ + EG(exception) = NULL; \ + zend_throw_exception_object(exception TSRMLS_CC); \ + } + +#define http_request_pool_wrap_exception(o, n) _http_request_pool_wrap_exception((o), (n) TSRMLS_CC) +extern void _http_request_pool_wrap_exception(zval *old_exception, zval *new_exception TSRMLS_DC); + #define http_request_pool_init(p) _http_request_pool_init((p) TSRMLS_CC) PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool TSRMLS_DC); @@ -56,12 +71,13 @@ PHP_HTTP_API STATUS _http_request_pool_send(http_request_pool *pool TSRMLS_DC); #define http_request_pool_select _http_request_pool_select PHP_HTTP_API STATUS _http_request_pool_select(http_request_pool *pool); -#define http_request_pool_perform _http_request_pool_perform -PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool); +#define http_request_pool_perform(p) _http_request_pool_perform((p) TSRMLS_CC) +PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool TSRMLS_DC); #define http_request_pool_dtor(p) _http_request_pool_dtor((p) TSRMLS_CC) PHP_HTTP_API void _http_request_pool_dtor(http_request_pool *pool TSRMLS_DC); +#endif #endif /*