-/* {{{ HttpRequest */
-#ifdef HTTP_HAVE_CURL
-
-zend_class_entry *http_request_ce;
-static zend_object_handlers http_request_object_handlers;
-
-#define http_request_declare_default_properties(ce) _http_request_declare_default_properties(ce TSRMLS_CC)
-static inline void _http_request_declare_default_properties(zend_class_entry *ce TSRMLS_DC)
-{
- DCL_PROP_N(PROTECTED, options);
- DCL_PROP_N(PROTECTED, responseInfo);
- DCL_PROP_N(PROTECTED, responseData);
- DCL_PROP_N(PROTECTED, postData);
- DCL_PROP_N(PROTECTED, postFiles);
-
- DCL_PROP(PROTECTED, long, method, HTTP_GET);
-
- DCL_PROP(PROTECTED, string, url, "");
- DCL_PROP(PROTECTED, string, contentType, "");
- DCL_PROP(PROTECTED, string, queryData, "");
- DCL_PROP(PROTECTED, string, postData, "");
-}
-
-#define http_request_free_object _http_request_free_object
-void _http_request_free_object(zend_object /* void */ *object TSRMLS_DC)
-{
- http_request_object *o = (http_request_object *) object;
-
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
- if (o->ch) {
- curl_easy_cleanup(o->ch);
- o->ch = NULL;
- }
- efree(o);
-}
-
-#define http_request_new_object _http_request_new_object
-zend_object_value _http_request_new_object(zend_class_entry *ce TSRMLS_DC)
-{
- zend_object_value ov;
- http_request_object *o;
-
- o = ecalloc(1, sizeof(http_request_object));
- o->zo.ce = ce;
- o->ch = curl_easy_init();
-
- ALLOC_HASHTABLE(OBJ_PROP(o));
- zend_hash_init(OBJ_PROP(o), 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-
- ov.handle = zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, http_request_free_object, NULL TSRMLS_CC);
- ov.handlers = &http_request_object_handlers;
-
- return ov;
-}
-
-zend_function_entry http_request_class_methods[] = {
- PHP_ME(HttpRequest, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(HttpRequest, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
-
- PHP_ME(HttpRequest, setOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, setSslOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getSslOptions, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetSslOptions, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, addHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, addCookies, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getCookies, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetCookies, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, setMethod, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getMethod, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, setURL, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getURL, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, setContentType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getContentType, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, setQueryData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getQueryData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, addQueryData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetQueryData, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, setPostData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getPostData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, addPostData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetPostData, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, addPostFile, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getPostFiles, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, unsetPostFiles, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, send, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequest, getResponseData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getResponseHeader, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getResponseCookie, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getResponseCode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getResponseBody, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequest, getResponseInfo, NULL, ZEND_ACC_PUBLIC)
-
- {NULL, NULL, NULL}