X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_object.c;h=c8fe26d0334185fd30de4f8bf14c4be1ce953314;hb=ecdfaaaf81cc29f99e39252b6f2463d328812cbf;hp=177d3b800165548aeccb44c05648b6c9c155341a;hpb=e182678d6def86ac46dabdd30294e6a857c7a1f6;p=m6w6%2Fext-http diff --git a/http_request_object.c b/http_request_object.c index 177d3b8..c8fe26d 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2005, Michael Wallner | + | Copyright (c) 2004-2006, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -302,7 +302,7 @@ PHP_MINIT_FUNCTION(http_request_object) zend_object_value _http_request_object_new(zend_class_entry *ce TSRMLS_DC) { - return http_request_object_new_ex(ce, curl_easy_init(), NULL); + return http_request_object_new_ex(ce, NULL, NULL); } zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, http_request_object **ptr TSRMLS_DC) @@ -338,6 +338,7 @@ zend_object_value _http_request_object_clone_obj(zval *this_ptr TSRMLS_DC) old_zo = zend_objects_get_address(this_ptr TSRMLS_CC); new_ov = http_request_object_new_ex(old_zo->ce, curl_easy_duphandle(old_obj->request->ch), &new_obj); + http_curl_init_ex(new_obj->request->ch, new_obj->request, new_obj->request->_error); zend_objects_clone_members(&new_obj->zo, new_ov, old_zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); phpstr_append(&new_obj->history, old_obj->history.data, old_obj->history.used); @@ -403,6 +404,11 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D) /* WebDAV Access Control - RFC 3744 */ DCL_CONST(long, "METH_ACL", HTTP_ACL); + /* cURL HTTP protocol versions */ + DCL_CONST(long, "VERSION_1_0", CURL_HTTP_VERSION_1_0); + DCL_CONST(long, "VERSION_1_1", CURL_HTTP_VERSION_1_1); + DCL_CONST(long, "VERSION_NONE", CURL_HTTP_VERSION_NONE); + /* * Auth Constants */ @@ -431,7 +437,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ STATUS status = SUCCESS; http_request_reset(obj->request); - HTTP_CHECK_CURL_INIT(obj->request->ch, curl_easy_init(), return FAILURE); + HTTP_CHECK_CURL_INIT(obj->request->ch, http_curl_init(obj->request), return FAILURE); obj->request->url = http_absolute_url(Z_STRVAL_P(GET_PROP(url))); @@ -606,7 +612,11 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this http_request_info(obj->request, Z_ARRVAL_P(info)); SET_PROP(responseInfo, info); zval_ptr_dtor(&info); - + + if (zend_hash_exists(&Z_OBJCE_P(getThis())->function_table, "onfinish", sizeof("onfinish"))) { + zend_call_method_with_0_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "onfinish", NULL); + } + return SUCCESS; } }