+ if (value && Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_client_curl_user_get_class_entry())) {
+ ev_ops = php_http_client_curl_user_ops_get();
+#if PHP_HTTP_HAVE_LIBEVENT
+ } else if (value && zend_is_true(value)) {
+ ev_ops = php_http_client_curl_event_ops_get();
+#endif
+ }
+
+ return php_http_curlm_use_eventloop(client, ev_ops, value);
+}
+
+static ZEND_RESULT_CODE php_http_curlm_option_set_share_cookies(php_http_option_t *opt, zval *value, void *userdata)
+{
+ php_http_client_t *client = userdata;
+ php_http_client_curl_t *curl = client->ctx;
+ CURLSHcode rc;
+
+ if (Z_TYPE_P(value) == IS_TRUE) {
+ rc = curl_share_setopt(curl->handle->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
+ } else {
+ rc = curl_share_setopt(curl->handle->share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_COOKIE);
+ }
+
+ if (CURLSHE_OK != rc) {
+ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_share_strerror(rc));
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+
+#if PHP_HTTP_CURL_VERSION(7,23,0)
+static ZEND_RESULT_CODE php_http_curlm_option_set_share_ssl(php_http_option_t *opt, zval *value, void *userdata)
+{
+ php_http_client_t *client = userdata;
+ php_http_client_curl_t *curl = client->ctx;
+ CURLSHcode rc;
+
+ if (Z_TYPE_P(value) == IS_TRUE) {
+ rc = curl_share_setopt(curl->handle->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
+ } else {
+ rc = curl_share_setopt(curl->handle->share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_SSL_SESSION);
+ }
+
+ if (CURLSHE_OK != rc) {
+ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_share_strerror(rc));
+ return FAILURE;
+ }
+ return SUCCESS;