17#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
29#include <curl/multi.h>
31#ifdef HAVE_SYS_SELECT_H
32#include <sys/select.h>
39#ifdef HAVE_SYS_TYPES_H
47#define SAVE_CURLM_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
57#define Z_CURL_MULTI_P(zv) curl_multi_from_obj(Z_OBJ_P(zv))
121static int curl_compare_objects(
zval *z1,
zval *z2 )
130static zval *_php_curl_multi_find_easy_handle(
php_curlm *mh, CURL *easy)
140 if (tmp_ch->
cp == easy) {
182 double timeout = 1.0;
194 if (!(timeout >= 0.0 && timeout <= ((
double)
INT_MAX / 1000.0))) {
199 error = curl_multi_wait(mh->
multi,
NULL, 0, (
int) (timeout * 1000.0), &numfds);
213 zval *z_still_running;
238 still_running = zval_get_long(z_still_running);
239 error = curl_multi_perform(mh->
multi, &still_running);
260 if (!
ch->handlers.write->buf.s) {
263 smart_str_0(&
ch->handlers.write->buf);
290 if (tmp_msg ==
NULL) {
294 if (zmsgs_in_queue) {
300 add_assoc_long(
return_value,
"result", tmp_msg->data.result);
304 zval *pz_ch = _php_curl_multi_find_easy_handle(mh, tmp_msg->easy_handle);
378static int _php_server_push_callback(CURL *parent_ch, CURL *easy,
size_t num_headers,
struct curl_pushheaders *push_headers,
void *userp)
389 pz_parent_ch = _php_curl_multi_find_easy_handle(mh, parent_ch);
390 if (pz_parent_ch ==
NULL) {
401 for (
size_t i = 0; i < num_headers; i++) {
402 char *
header = curl_pushheader_bynum(push_headers, i);
410 zval_ptr_dtor_nogc(&headers);
438#if LIBCURL_VERSION_NUM >= 0x074300
445#if LIBCURL_VERSION_NUM >= 0x073e00
460 char *error_str =
NULL;
479 error = CURLM_UNKNOWN_OPTION;
524 zend_throw_error(
NULL,
"Cannot directly construct CurlMultiHandle, use curl_multi_init() instead");
528static void curl_multi_free_obj(
zend_object *
object)
530 php_curlm *mh = curl_multi_from_obj(
object);
550 curl_multi_cleanup(mh->
multi);
562 php_curlm *curl_multi = curl_multi_from_obj(
object);
573 zend_get_gc_buffer_add_zval(gc_buffer, pz_ch);
576 zend_get_gc_buffer_use(gc_buffer, table,
n);
585 curl_multi_ce->default_object_handlers = &curl_multi_handlers;
589 curl_multi_handlers.free_obj = curl_multi_free_obj;
590 curl_multi_handlers.get_gc = curl_multi_get_gc;
591 curl_multi_handlers.get_constructor = curl_multi_get_constructor;
592 curl_multi_handlers.clone_obj =
NULL;
header(string $header, bool $replace=true, int $response_code=0)
zend_class_entry * curl_ce
curl_multi_select(CurlMultiHandle $multi_handle, float $timeout=1.0)
const CURLMOPT_MAXCONNECTS
const CURLMOPT_PUSHFUNCTION
const CURLMOPT_MAX_PIPELINE_LENGTH
const CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE
curl_multi_setopt(CurlMultiHandle $multi_handle, int $option, mixed $value)
curl_multi_exec(CurlMultiHandle $multi_handle, &$still_running)
curl_multi_close(CurlMultiHandle $multi_handle)
curl_multi_errno(CurlMultiHandle $multi_handle)
curl_multi_strerror(int $error_code)
const CURLMOPT_MAX_TOTAL_CONNECTIONS
const CURLMOPT_MAX_CONCURRENT_STREAMS
const CURLMOPT_MAX_HOST_CONNECTIONS
curl_multi_add_handle(CurlMultiHandle $multi_handle, CurlHandle $handle)
const CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE
curl_multi_getcontent(CurlHandle $handle)
curl_multi_remove_handle(CurlMultiHandle $multi_handle, CurlHandle $handle)
const CURLMOPT_PIPELINING
curl_multi_info_read(CurlMultiHandle $multi_handle, &$queued_messages=null)
#define SAVE_CURL_ERROR(__handle, __err)
php_curl * init_curl_handle_into_zval(zval *curl)
void _php_curl_multi_cleanup_list(void *data)
zend_result curl_cast_object(zend_object *obj, zval *result, int type)
void _php_curl_cleanup_handle(php_curl *)
void _php_curl_verify_handlers(php_curl *ch, bool reporterror)
void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
void curl_multi_register_handlers(void)
void _php_curl_multi_cleanup_list(void *data)
#define SAVE_CURLM_ERROR(__handle, __err)
#define Z_CURL_MULTI_P(zv)
zend_class_entry * curl_multi_ce
unsigned const char * pos
PHP_JSON_API size_t int options
zend_fcall_info_cache server_push
php_curlm_handlers handlers
struct php_curlm::@376371063142164024322336236347115231202062012263 err
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type)
ZEND_API bool zend_is_callable_ex(zval *callable, zend_object *object, uint32_t check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error)
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format,...)
ZEND_API zend_result add_next_index_string(zval *arg, const char *str)
#define ZEND_PARSE_PARAMETERS_END()
#define ZEND_PARSE_PARAMETERS_NONE()
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define ZEND_TRY_ASSIGN_REF_LONG(zv, lval)
#define Z_PARAM_LONG(dest)
#define Z_PARAM_DOUBLE(dest)
#define ZEND_FCC_INITIALIZED(fcc)
#define Z_PARAM_OBJECT_OF_CLASS(dest, _ce)
#define RETURN_EMPTY_STRING()
#define Z_PARAM_ZVAL(dest)
#define RETURN_STR_COPY(s)
ZEND_API const char * get_active_function_name(void)
union _zend_function zend_function
ZEND_API zend_get_gc_buffer * zend_get_gc_buffer_create(void)
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int(*compare)(void *element1, void *element2))
ZEND_API void zend_llist_add_element(zend_llist *l, const void *element)
ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
ZEND_API void zend_llist_clean(zend_llist *l)
ZEND_API void * zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos)
ZEND_API void * zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos)
zend_llist_element * zend_llist_position
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2)
ZEND_API HashTable * zend_std_get_properties(zend_object *zobj)
ZEND_API const zend_object_handlers std_object_handlers
ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce)
ZEND_API void zend_object_std_dtor(zend_object *object)
#define XtOffsetOf(s_type, field)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
struct _zend_array HashTable
#define IS_OBJ_FREE_CALLED
struct _zend_object_handlers zend_object_handlers
ZEND_API void zval_ptr_dtor(zval *zval_ptr)