no travis yet
[m6w6/ext-http] / php_http_client.c
index f69a56fdde9c6842477e86d154b5abef8f5ed04c..5d78803154676f52248647338ffb463c88ce82ac 100644 (file)
@@ -27,16 +27,16 @@ static void php_http_client_driver_hash_dtor(zval *pData)
 
 ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver)
 {
-       return zend_hash_str_add_mem(&php_http_client_drivers, driver->name_str, driver->name_len, (void *) driver, sizeof(php_http_client_driver_t))
+       return zend_hash_add_mem(&php_http_client_drivers, driver->driver_name, (void *) driver, sizeof(php_http_client_driver_t))
                        ? SUCCESS : FAILURE;
 }
 
-php_http_client_driver_t *php_http_client_driver_get(const char *name_str, size_t name_len)
+php_http_client_driver_t *php_http_client_driver_get(zend_string *name)
 {
        zval *ztmp;
        php_http_client_driver_t *tmp;
 
-       if (name_str && (tmp = zend_hash_str_find_ptr(&php_http_client_drivers, name_str, name_len))) {
+       if (name && (tmp = zend_hash_find_ptr(&php_http_client_drivers, name))) {
                return tmp;
        }
        if ((ztmp = zend_hash_get_current_data(&php_http_client_drivers))) {
@@ -50,7 +50,7 @@ static int apply_driver_list(zval *p, void *arg)
        php_http_client_driver_t *d = Z_PTR_P(p);
        zval zname;
 
-       ZVAL_STRINGL(&zname, d->name_str, d->name_len);
+       ZVAL_STR_COPY(&zname, d->driver_name);
 
        zend_hash_next_index_insert(arg, &zname);
        return ZEND_HASH_APPLY_KEEP;
@@ -148,7 +148,7 @@ void php_http_client_options_get_subr(zval *instance, char *key, size_t len, zva
        zval *options, opts_tmp, *opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &opts_tmp);
 
        if ((Z_TYPE_P(opts) == IS_ARRAY) && (options = zend_symtable_str_find(Z_ARRVAL_P(opts), key, len))) {
-               RETVAL_ZVAL_FAST(options);
+               RETVAL_ZVAL(options, 1, 0);
        }
 }
 
@@ -326,6 +326,8 @@ void php_http_client_object_free(zend_object *object)
        php_http_client_object_t *o = PHP_HTTP_OBJ(object, NULL);
 
        php_http_client_free(&o->client);
+       php_http_object_method_dtor(&o->notify);
+       php_http_object_method_free(&o->update);
        zend_object_std_dtor(object);
 }
 
@@ -333,7 +335,7 @@ php_http_client_object_t *php_http_client_object_new_ex(zend_class_entry *ce, ph
 {
        php_http_client_object_t *o;
 
-       o = ecalloc(1, sizeof(php_http_client_object_t) + (ce->default_properties_count - 1) * sizeof(zval));
+       o = ecalloc(1, sizeof(*o) + zend_object_properties_size(ce));
        zend_object_std_init(&o->zo, ce);
        object_properties_init(&o->zo, ce);
 
@@ -367,7 +369,7 @@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_
        zval_ptr_dtor(&new_hist);
 }
 
-static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response)
+static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **response)
 {
        zend_bool dequeue = 0;
        zval zclient;
@@ -385,7 +387,7 @@ static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, ph
                php_http_message_set_type(msg, PHP_HTTP_RESPONSE);
 
                if (zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) {
-                       handle_history(&zclient, *request, *response);
+                       handle_history(&zclient, e->request, *response);
                }
 
                /* hard detach, redirects etc. are in the history */
@@ -443,27 +445,28 @@ static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, ph
 
 static void handle_progress(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *progress)
 {
-       zval zrequest, zprogress, retval, zclient;
+       zval zclient, args[2];
+       php_http_client_object_t *client_obj = arg;
        zend_error_handling zeh;
 
-       ZVAL_UNDEF(&retval);
-       ZVAL_OBJECT(&zclient, &((php_http_client_object_t *) arg)->zo, 1);
-       ZVAL_OBJECT(&zrequest, &((php_http_message_object_t *) e->opaque)->zo, 1);
-       object_init(&zprogress);
-       add_property_bool(&zprogress, "started", progress->started);
-       add_property_bool(&zprogress, "finished", progress->finished);
-       add_property_string(&zprogress, "info", STR_PTR(progress->info));
-       add_property_double(&zprogress, "dltotal", progress->dl.total);
-       add_property_double(&zprogress, "dlnow", progress->dl.now);
-       add_property_double(&zprogress, "ultotal", progress->ul.total);
-       add_property_double(&zprogress, "ulnow", progress->ul.now);
+       ZVAL_OBJECT(&zclient, &client_obj->zo, 1);
+       ZVAL_OBJECT(&args[0], &((php_http_message_object_t *) e->opaque)->zo, 1);
+       object_init(&args[1]);
+       add_property_bool(&args[1], "started", progress->started);
+       add_property_bool(&args[1], "finished", progress->finished);
+       add_property_string(&args[1], "info", STR_PTR(progress->info));
+       add_property_double(&args[1], "dltotal", progress->dl.total);
+       add_property_double(&args[1], "dlnow", progress->dl.now);
+       add_property_double(&args[1], "ultotal", progress->ul.total);
+       add_property_double(&args[1], "ulnow", progress->ul.now);
+
        zend_replace_error_handling(EH_NORMAL, NULL, &zeh);
-       zend_call_method_with_2_params(&zclient, NULL, NULL, "notify", &retval, &zrequest, &zprogress);
+       php_http_object_method_call(&client_obj->notify, &zclient, NULL, 2, args);
        zend_restore_error_handling(&zeh);
+
        zval_ptr_dtor(&zclient);
-       zval_ptr_dtor(&zrequest);
-       zval_ptr_dtor(&zprogress);
-       zval_ptr_dtor(&retval);
+       zval_ptr_dtor(&args[0]);
+       zval_ptr_dtor(&args[1]);
 }
 
 static void response_dtor(void *data)
@@ -479,21 +482,20 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_construct, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, __construct)
 {
-               char *driver_str = NULL, *persistent_handle_str = NULL;
-               size_t driver_len = 0, persistent_handle_len = 0;
+               zend_string *driver_name = NULL, *persistent_handle_name = NULL;
                php_http_client_driver_t *driver;
                php_resource_factory_t *rf = NULL;
                php_http_client_object_t *obj;
                zval os;
 
-               php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", &driver_str, &driver_len, &persistent_handle_str, &persistent_handle_len), invalid_arg, return);
+               php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!S!", &driver_name, &persistent_handle_name), invalid_arg, return);
 
                if (!zend_hash_num_elements(&php_http_client_drivers)) {
                        php_http_throw(unexpected_val, "No http\\Client drivers available", NULL);
                        return;
                }
-               if (!(driver = php_http_client_driver_get(driver_str, driver_len))) {
-                       php_http_throw(unexpected_val, "Failed to locate \"%s\" client request handler", driver_len ? driver_str : "default");
+               if (!(driver = php_http_client_driver_get(driver_name))) {
+                       php_http_throw(unexpected_val, "Failed to locate \"%s\" client request handler", driver_name ? driver_name->val : "default");
                        return;
                }
 
@@ -501,25 +503,20 @@ static PHP_METHOD(HttpClient, __construct)
                zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), &os);
                zval_ptr_dtor(&os);
 
-               if (persistent_handle_len) {
-                       char *name_str;
-                       size_t name_len;
+               if (persistent_handle_name) {
                        php_persistent_handle_factory_t *pf;
 
-                       name_len = spprintf(&name_str, 0, "http\\Client\\%s", driver->name_str);
-                       php_http_pretty_key(name_str + lenof("http\\Client\\"), driver->name_len, 1, 1);
-
-                       if ((pf = php_persistent_handle_concede(NULL, name_str, name_len, persistent_handle_str, persistent_handle_len, NULL, NULL))) {
-                               rf = php_resource_factory_init(NULL, php_persistent_handle_get_resource_factory_ops(), pf, (void (*)(void *)) php_persistent_handle_abandon);
+                       if ((pf = php_persistent_handle_concede(NULL, driver->client_name, persistent_handle_name, NULL, NULL))) {
+                               rf = php_persistent_handle_resource_factory_init(NULL, pf);
                        }
-
-                       efree(name_str);
                }
 
                obj = PHP_HTTP_OBJ(NULL, getThis());
 
                php_http_expect(obj->client = php_http_client_init(NULL, driver->client_ops, rf, NULL), runtime, return);
 
+               php_http_object_method_init(&obj->notify, getThis(), ZEND_STRL("notify"));
+
                obj->client->callback.response.func = handle_response;
                obj->client->callback.response.arg = obj;
                obj->client->callback.progress.func = handle_progress;
@@ -540,7 +537,7 @@ static PHP_METHOD(HttpClient, reset)
        obj->iterator = 0;
        php_http_client_reset(obj->client);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 static HashTable *combined_options(zval *client, zval *request)
@@ -633,7 +630,7 @@ static PHP_METHOD(HttpClient, enqueue)
                        return;
        );
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_dequeue, 0, 0, 1)
@@ -657,7 +654,7 @@ static PHP_METHOD(HttpClient, dequeue)
 
        php_http_expect(SUCCESS == php_http_client_dequeue(obj->client, msg_obj->message), runtime, return);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_requeue, 0, 0, 1)
@@ -703,7 +700,7 @@ static PHP_METHOD(HttpClient, requeue)
                        return;
        );
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_count, 0, 0, 0)
@@ -770,7 +767,7 @@ static PHP_METHOD(HttpClient, getHistory)
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
        zhistory = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0, &zhistory_tmp);
-       RETVAL_ZVAL_FAST(zhistory);
+       RETVAL_ZVAL(zhistory, 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_send, 0, 0, 0)
@@ -785,7 +782,7 @@ static PHP_METHOD(HttpClient, send)
 
        php_http_expect(SUCCESS == php_http_client_exec(obj->client), runtime, return);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_once, 0, 0, 0)
@@ -817,6 +814,22 @@ static PHP_METHOD(HttpClient, wait)
        }
 }
 
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_configure, 0, 0, 1)
+       ZEND_ARG_ARRAY_INFO(0, settings, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClient, configure)
+{
+       HashTable *settings = NULL;
+       php_http_client_object_t *obj;
+
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|H!", &settings), invalid_arg, return);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
+
+       php_http_expect(SUCCESS == php_http_client_setopt(obj->client, PHP_HTTP_CLIENT_OPT_CONFIGURATION, settings), unexpected_val, return);
+
+       RETVAL_ZVAL(getThis(), 1, 0);
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_enablePipelining, 0, 0, 0)
        ZEND_ARG_INFO(0, enable)
 ZEND_END_ARG_INFO();
@@ -831,7 +844,7 @@ static PHP_METHOD(HttpClient, enablePipelining)
 
        php_http_expect(SUCCESS == php_http_client_setopt(obj->client, PHP_HTTP_CLIENT_OPT_ENABLE_PIPELINING, &enable), unexpected_val, return);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_enableEvents, 0, 0, 0)
@@ -848,18 +861,26 @@ static PHP_METHOD(HttpClient, enableEvents)
 
        php_http_expect(SUCCESS == php_http_client_setopt(obj->client, PHP_HTTP_CLIENT_OPT_USE_EVENTS, &enable), unexpected_val, return);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
+struct notify_arg {
+       php_http_object_method_t *cb;
+       zval args[3];
+       int argc;
+};
+
 static int notify(zend_object_iterator *iter, void *puser)
 {
-       zval *observer, *args = puser;
+       zval *observer;
+       struct notify_arg *arg = puser;
 
        if ((observer = iter->funcs->get_current_data(iter))) {
-               int num_args = !Z_ISUNDEF(args[0]) + !Z_ISUNDEF(args[1]) + !Z_ISUNDEF(args[2]);
-               return php_http_method_call(observer, ZEND_STRL("update"), num_args, args, NULL);
+               if (SUCCESS == php_http_object_method_call(arg->cb, observer, NULL, arg->argc, arg->args)) {
+                       return ZEND_HASH_APPLY_KEEP;
+               }
        }
-       return FAILURE;
+       return ZEND_HASH_APPLY_STOP;
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
@@ -867,10 +888,13 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, notify)
 {
-       zval *request = NULL, *zprogress = NULL, observers_tmp, *observers, args[3];
+       zval *request = NULL, *zprogress = NULL, observers_tmp, *observers;
+       php_http_client_object_t *client_obj;
+       struct notify_arg arg = {NULL};
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!o!", &request, php_http_client_request_class_entry, &zprogress), invalid_arg, return);
 
+       client_obj = PHP_HTTP_OBJ(NULL, getThis());
        observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
@@ -878,29 +902,32 @@ static PHP_METHOD(HttpClient, notify)
                return;
        }
 
-       ZVAL_COPY(&args[0], getThis());
-       if (request) {
-               ZVAL_COPY(&args[1], request);
-       } else {
-               ZVAL_UNDEF(&args[1]);
-       }
-       if (zprogress) {
-               ZVAL_COPY(&args[2], zprogress);
-       } else {
-               ZVAL_UNDEF(&args[2]);
-       }
+       if (client_obj->update) {
+               arg.cb = client_obj->update;
+               ZVAL_COPY(&arg.args[0], getThis());
+               arg.argc = 1;
+
+               if (request) {
+                       ZVAL_COPY(&arg.args[1], request);
+                       arg.argc += 1;
+               }
+               if (zprogress) {
+                       ZVAL_COPY(&arg.args[2], zprogress);
+                       arg.argc += 1;
+               }
 
-       spl_iterator_apply(observers, notify, args);
+               spl_iterator_apply(observers, notify, &arg);
 
-       zval_ptr_dtor(getThis());
-       if (request) {
-               zval_ptr_dtor(request);
-       }
-       if (zprogress) {
-               zval_ptr_dtor(zprogress);
+               zval_ptr_dtor(getThis());
+               if (request) {
+                       zval_ptr_dtor(request);
+               }
+               if (zprogress) {
+                       zval_ptr_dtor(zprogress);
+               }
        }
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1)
@@ -909,9 +936,11 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, attach)
 {
        zval observers_tmp, *observers, *observer, retval;
+       php_http_client_object_t *client_obj;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return);
 
+       client_obj = PHP_HTTP_OBJ(NULL, getThis());
        observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp);
 
        if (Z_TYPE_P(observers) != IS_OBJECT) {
@@ -919,11 +948,15 @@ static PHP_METHOD(HttpClient, attach)
                return;
        }
 
+       if (!client_obj->update) {
+               client_obj->update = php_http_object_method_init(NULL, observer, ZEND_STRL("update"));
+       }
+
        ZVAL_UNDEF(&retval);
        zend_call_method_with_1_params(observers, NULL, NULL, "attach", &retval, observer);
        zval_ptr_dtor(&retval);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1)
@@ -946,7 +979,7 @@ static PHP_METHOD(HttpClient, detach)
        zend_call_method_with_1_params(observers, NULL, NULL, "detach", &retval, observer);
        zval_ptr_dtor(&retval);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getObservers, 0, 0, 0)
@@ -964,7 +997,7 @@ static PHP_METHOD(HttpClient, getObservers)
                return;
        }
 
-       RETVAL_ZVAL_FAST(observers);
+       RETVAL_ZVAL(observers, 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getProgressInfo, 0, 0, 1)
@@ -1025,7 +1058,7 @@ static PHP_METHOD(HttpClient, setOptions)
 
        php_http_client_options_set(getThis(), opts);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getOptions, 0, 0, 0)
@@ -1034,7 +1067,7 @@ static PHP_METHOD(HttpClient, getOptions)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
                zval options_tmp, *options = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0, &options_tmp);
-               RETVAL_ZVAL_FAST(options);
+               RETVAL_ZVAL(options, 1, 0);
        }
 }
 
@@ -1049,7 +1082,7 @@ static PHP_METHOD(HttpClient, setSslOptions)
 
        php_http_client_options_set_subr(getThis(), ZEND_STRL("ssl"), opts, 1);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_addSslOptions, 0, 0, 0)
@@ -1063,7 +1096,7 @@ static PHP_METHOD(HttpClient, addSslOptions)
 
        php_http_client_options_set_subr(getThis(), ZEND_STRL("ssl"), opts, 0);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getSslOptions, 0, 0, 0)
@@ -1086,7 +1119,7 @@ static PHP_METHOD(HttpClient, setCookies)
 
        php_http_client_options_set_subr(getThis(), ZEND_STRL("cookies"), opts, 1);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_addCookies, 0, 0, 0)
@@ -1100,7 +1133,7 @@ static PHP_METHOD(HttpClient, addCookies)
 
        php_http_client_options_set_subr(getThis(), ZEND_STRL("cookies"), opts, 0);
 
-       RETVAL_ZVAL_FAST(getThis());
+       RETVAL_ZVAL(getThis(), 1, 0);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getCookies, 0, 0, 0)
@@ -1122,6 +1155,30 @@ static PHP_METHOD(HttpClient, getAvailableDrivers)
        }
 }
 
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getAvailableOptions, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClient, getAvailableOptions)
+{
+       if (SUCCESS == zend_parse_parameters_none()) {
+               php_http_client_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+               array_init(return_value);
+               php_http_client_getopt(obj->client, PHP_HTTP_CLIENT_OPT_AVAILABLE_OPTIONS, NULL, &Z_ARRVAL_P(return_value));
+       }
+}
+
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getAvailableConfiguration, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClient, getAvailableConfiguration)
+{
+       if (SUCCESS == zend_parse_parameters_none()) {
+               php_http_client_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+               array_init(return_value);
+               php_http_client_getopt(obj->client, PHP_HTTP_CLIENT_OPT_AVAILABLE_CONFIGURATION, NULL, &Z_ARRVAL_P(return_value));
+       }
+}
+
 static zend_function_entry php_http_client_methods[] = {
        PHP_ME(HttpClient, __construct,          ai_HttpClient_construct,            ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
        PHP_ME(HttpClient, reset,                ai_HttpClient_reset,                ZEND_ACC_PUBLIC)
@@ -1134,8 +1191,9 @@ static zend_function_entry php_http_client_methods[] = {
        PHP_ME(HttpClient, wait,                 ai_HttpClient_wait,                 ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, getResponse,          ai_HttpClient_getResponse,          ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, getHistory,           ai_HttpClient_getHistory,           ZEND_ACC_PUBLIC)
-       PHP_ME(HttpClient, enablePipelining,     ai_HttpClient_enablePipelining,     ZEND_ACC_PUBLIC)
-       PHP_ME(HttpClient, enableEvents,         ai_HttpClient_enableEvents,         ZEND_ACC_PUBLIC)
+       PHP_ME(HttpClient, configure,            ai_HttpClient_configure,            ZEND_ACC_PUBLIC)
+       PHP_ME(HttpClient, enablePipelining,     ai_HttpClient_enablePipelining,     ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
+       PHP_ME(HttpClient, enableEvents,         ai_HttpClient_enableEvents,         ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
        PHP_ME(HttpClient, notify,               ai_HttpClient_notify,               ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, attach,               ai_HttpClient_attach,               ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, detach,               ai_HttpClient_detach,               ZEND_ACC_PUBLIC)
@@ -1151,6 +1209,8 @@ static zend_function_entry php_http_client_methods[] = {
        PHP_ME(HttpClient, addCookies,           ai_HttpClient_addCookies,           ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, getCookies,           ai_HttpClient_getCookies,           ZEND_ACC_PUBLIC)
        PHP_ME(HttpClient, getAvailableDrivers,  ai_HttpClient_getAvailableDrivers,  ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+       PHP_ME(HttpClient, getAvailableOptions,  ai_HttpClient_getAvailableOptions,  ZEND_ACC_PUBLIC)
+       PHP_ME(HttpClient, getAvailableConfiguration, ai_HttpClient_getAvailableConfiguration, ZEND_ACC_PUBLIC)
        EMPTY_FUNCTION_ENTRY
 };