X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_object.c;h=0a56e586679ef18332714f2b787dc5d5e7c08628;hp=0a6c5d1a4ea47df32b7f84a8708e2199ab6bcaae;hb=31d0ecaa361b6a186391f48d566e9b1de36b1099;hpb=36fa8b05be7aaf8e7f9e503c3e82733022500c03 diff --git a/http_request_object.c b/http_request_object.c index 0a6c5d1..0a56e58 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -158,6 +158,7 @@ HTTP_END_ARGS; HTTP_EMPTY_ARGS(getResponseMessage, 1); HTTP_EMPTY_ARGS(getRequestMessage, 1); HTTP_EMPTY_ARGS(getHistory, 1); +HTTP_EMPTY_ARGS(clearHistory, 0); HTTP_EMPTY_ARGS(send, 1); HTTP_BEGIN_ARGS(get, 0, 1) @@ -276,6 +277,7 @@ zend_function_entry http_request_object_fe[] = { HTTP_REQUEST_ME(getResponseMessage, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getRequestMessage, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getHistory, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(clearHistory, ZEND_ACC_PUBLIC) HTTP_REQUEST_ALIAS(get, http_get) HTTP_REQUEST_ALIAS(head, http_head) @@ -306,7 +308,6 @@ zend_object_value _http_request_object_new(zend_class_entry *ce TSRMLS_DC) o = ecalloc(1, sizeof(http_request_object)); o->zo.ce = ce; o->ch = curl_easy_init(); - o->pool = NULL; phpstr_init(&o->history); phpstr_init(&o->request); @@ -344,6 +345,7 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D) DCL_PROP(PUBLIC, bool, recordHistory, 1); +#ifndef WONKY /* * Request Method Constants */ @@ -388,6 +390,7 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D) DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM); DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY); # endif /* LIBCURL_VERSION_NUM */ +#endif /* WONKY */ } void _http_request_object_free(zend_object *object TSRMLS_DC) @@ -1594,6 +1597,10 @@ PHP_METHOD(HttpRequest, getRequestMessage) } /* }}} */ +/* {{{ proto HttpMessage HttpRequest::getHistory() + * + * Get all sent requests and received responses as an HttpMessage object. + */ PHP_METHOD(HttpRequest, getHistory) { NO_ARGS; @@ -1609,6 +1616,20 @@ PHP_METHOD(HttpRequest, getHistory) SET_EH_NORMAL(); } } +/* }}} */ + +/* {{{ proto void HttpRequest::clearHistory() + * + * Clear the history. + */ +PHP_METHOD(HttpRequest, clearHistory) +{ + NO_ARGS { + getObject(http_request_object, obj); + phpstr_dtor(&obj->history); + } +} +/* }}} */ /* {{{ proto HttpMessage HttpRequest::send() *