break;
case HTTP_MSG_PROPHASH_PARENT_MESSAGE:
- if (msg->parent) {
- zval tmp;
- tmp.value.obj = obj->parent;
- zend_objects_store_del_ref(&tmp TSRMLS_CC);
+ if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), http_message_object_ce TSRMLS_CC)) {
+ if (msg->parent) {
+ zval tmp;
+ tmp.value.obj = obj->parent;
+ Z_OBJ_DELREF(tmp);
+ }
+ Z_OBJ_ADDREF_P(value);
+ obj->parent = value->value.obj;
}
- zend_objects_store_add_ref(value TSRMLS_CC);
- obj->parent = value->value.obj;
break;
case HTTP_MSG_PROPHASH_REQUEST_METHOD:
zend_llist_add_element(&pool->bodies, &body);
zval_add_ref(&request);
- zend_objects_store_add_ref(request TSRMLS_CC);
+ Z_OBJ_ADDREF_P(request);
#if HTTP_DEBUG_REQPOOLS
fprintf(stderr, "> %d HttpRequests attached to pool %p\n", zend_llist_count(&pool->handles), pool);
#endif
zval_add_ref(req);
- zend_objects_store_add_ref(*req TSRMLS_CC);
+ Z_OBJ_ADDREF_PP(req);
zend_llist_add_element(&obj->pool->finished, req);
http_request_object_responsehandler(obj, *req);
}
HTTP_EMPTY_ARGS(getAttachedRequests, 0);
HTTP_EMPTY_ARGS(getFinishedRequests, 0);
-HTTP_BEGIN_ARGS(setRequestOptions, 0)
- HTTP_ARG_VAL(options, 0)
-HTTP_END_ARGS;
-
#define http_requestpool_object_declare_default_properties() _http_requestpool_object_declare_default_properties(TSRMLS_C)
static inline void _http_requestpool_object_declare_default_properties(TSRMLS_D);
static void _http_requestpool_object_llist2array(zval **req, zval *array TSRMLS_DC)
{
zval_add_ref(req);
- zend_objects_store_add_ref(*req TSRMLS_CC);
+ Z_OBJ_ADDREF_PP(req);
add_next_index_zval(array, *req);
}
}
/* }}} */
+/* {{{ proto array HttpRequestPool::getAttachedRequests()
+ *
+ * Get attached HttpRequest objects.
+ *
+ * Returns an array containing all currently attached HttpRequest objects.
+ */
PHP_METHOD(HttpRequestPool, getAttachedRequests)
{
getObject(http_requestpool_object, obj);
(llist_apply_with_arg_func_t) http_requestpool_object_llist2array,
return_value TSRMLS_CC);
}
+/* }}} */
+/* {{{ proto array HttpRequestPool::getFinishedRequests()
+ *
+ * Get attached HttpRequest objects that already have finished their work.
+ *
+ * Returns an array containing all attached HttpRequest objects that
+ * already have finished their work.
+ */
PHP_METHOD(HttpRequestPool, getFinishedRequests)
{
getObject(http_requestpool_object, obj);
(llist_apply_with_arg_func_t) http_requestpool_object_llist2array,
return_value TSRMLS_CC);
}
+/* }}} */
#endif /* ZEND_ENGINE_2 && HTTP_HAVE_CURL */
#define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
#define PHP_RSHUTDOWN_CALL(func) PHP_RSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
+#define Z_OBJ_DELREF(z) \
+ if (Z_OBJ_HT(z)->del_ref) { \
+ Z_OBJ_HT(z)->del_ref(&(z) TSRMLS_CC); \
+ }
+#define Z_OBJ_ADDREF(z) \
+ if (Z_OBJ_HT(z)->add_ref) { \
+ Z_OBJ_HT(z)->add_ref(&(z) TSRMLS_CC); \
+ }
+#define Z_OBJ_DELREF_P(z) \
+ if (Z_OBJ_HT_P(z)->del_ref) { \
+ Z_OBJ_HT_P(z)->del_ref((z) TSRMLS_CC); \
+ }
+#define Z_OBJ_ADDREF_P(z) \
+ if (Z_OBJ_HT_P(z)->add_ref) { \
+ Z_OBJ_HT_P(z)->add_ref((z) TSRMLS_CC); \
+ }
+#define Z_OBJ_DELREF_PP(z) \
+ if (Z_OBJ_HT_PP(z)->del_ref) { \
+ Z_OBJ_HT_PP(z)->del_ref(*(z) TSRMLS_CC); \
+ }
+#define Z_OBJ_ADDREF_PP(z) \
+ if (Z_OBJ_HT_PP(z)->add_ref) { \
+ Z_OBJ_HT_PP(z)->add_ref(*(z) TSRMLS_CC); \
+ }
+
#endif /* PHP_HTTP_STD_DEFS_H */
/*