55 | This source file is subject to version 3.01 of the PHP license, |
66 | that is bundled with this package in the file LICENSE, and is |
77 | available through the world-wide-web at the following url: |
8- | http ://www.php.net/license/3_01.txt |
8+ | https ://www.php.net/license/3_01.txt |
99 | If you did not receive a copy of the PHP license and are unable to |
1010 | obtain it through the world-wide-web, please send a note to |
1111 | license@php.net so we can mail you a copy immediately. |
1515 +----------------------------------------------------------------------+
1616*/
1717
18- /* Copied from PHP-4f68662f5b61aecf90f6d8005976f5f91d4ce8d3 */
19-
2018#if defined(SW_USE_CURL) && PHP_VERSION_ID < 80400
2119
2220#ifndef _PHP_CURL_PRIVATE_H
@@ -67,21 +65,20 @@ typedef struct {
6765typedef struct {
6866 zval func_name;
6967 zend_fcall_info_cache fci_cache;
70- int method;
71- } php_curl_progress, php_curl_fnmatch, php_curlm_server_push, php_curl_fnxferinfo, php_curl_sshhostkey;
68+ } php_curl_callback;
7269
7370typedef struct {
7471 php_curl_write *write;
7572 php_curl_write *write_header;
7673 php_curl_read *read;
7774 zval std_err;
78- php_curl_progress *progress;
79- #if LIBCURL_VERSION_NUM >= 0x072000 && PHP_VERSION_ID >= 80200
80- php_curl_fnxferinfo *xferinfo;
75+ php_curl_callback *progress;
76+ #if PHP_VERSION_ID >= 80200
77+ php_curl_callback *xferinfo;
8178#endif
82- php_curl_fnmatch *fnmatch;
79+ php_curl_callback *fnmatch;
8380#if LIBCURL_VERSION_NUM >= 0x075400 && PHP_VERSION_ID >= 80300
84- php_curl_sshhostkey *sshhostkey;
81+ php_curl_callback *sshhostkey;
8582#endif
8683} php_curl_handlers;
8784
@@ -94,30 +91,22 @@ struct _php_curl_send_headers {
9491 zend_string *str;
9592};
9693
97- #if PHP_VERSION_ID >= 80100
98- struct _php_curl_free {
99- zend_llist post ;
100- zend_llist stream;
101- HashTable *slist;
102- };
103- #else
10494struct _php_curl_free {
105- zend_llist str;
10695 zend_llist post ;
10796 zend_llist stream;
10897 HashTable *slist;
10998};
110- #endif
11199
112100typedef struct {
113101 CURL *cp;
114102 php_curl_handlers handlers;
115103 struct _php_curl_free *to_free;
116104 struct _php_curl_send_headers header;
117105 struct _php_curl_error err;
118- zend_bool in_callback;
106+ bool in_callback;
119107 uint32_t *clone;
120108 zval postfields;
109+ /* For CURLOPT_PRIVATE */
121110 zval private_data;
122111 /* CurlShareHandle object set using CURLOPT_SHARE. */
123112 struct _php_curlsh *share;
@@ -127,7 +116,7 @@ typedef struct {
127116#define CURLOPT_SAFE_UPLOAD -1
128117
129118typedef struct {
130- php_curlm_server_push *server_push;
119+ php_curl_callback *server_push;
131120} php_curlm_handlers;
132121
133122namespace swoole {
@@ -160,23 +149,16 @@ php_curl *swoole_curl_init_handle_into_zval(zval *curl);
160149void swoole_curl_init_handle (php_curl *ch);
161150void swoole_curl_cleanup_handle (php_curl *);
162151void swoole_curl_multi_cleanup_list (void *data);
163- void swoole_curl_verify_handlers (php_curl *ch, int reporterror);
152+ void swoole_curl_verify_handlers (php_curl *ch, bool reporterror);
164153void swoole_setup_easy_copy_handlers (php_curl *ch, php_curl *source);
165154
166- #if PHP_VERSION_ID >= 80100
167155static inline php_curl_handlers *curl_handlers (php_curl *ch) {
168156 return &ch->handlers ;
169157}
170- #else
171- static inline php_curl_handlers *curl_handlers (php_curl *ch) {
172- return ch->handlers ;
173- }
174- #endif
175158
176- #if PHP_VERSION_ID >= 80200
177- typedef zend_result curl_result_t ;
178- #else
179- typedef int curl_result_t ;
159+ #if PHP_VERSION_ID >= 80300
160+ /* Consumes `zv` */
161+ zend_long php_curl_get_long (zval *zv);
180162#endif
181163
182164static inline php_curl *curl_from_obj (zend_object *obj) {
@@ -191,7 +173,12 @@ static inline php_curlsh *curl_share_from_obj(zend_object *obj) {
191173
192174#define Z_CURL_SHARE_P (zv ) curl_share_from_obj(Z_OBJ_P(zv))
193175void curl_multi_register_class (const zend_function_entry *method_entries);
194- curl_result_t swoole_curl_cast_object (zend_object *obj, zval *result, int type);
176+
177+ #if PHP_VERSION_ID >= 80200
178+ zend_result swoole_curl_cast_object (zend_object *obj, zval *result, int type);
179+ #else
180+ int swoole_curl_cast_object (zend_object *obj, zval *result, int type);
181+ #endif
195182
196183#endif /* _PHP_CURL_PRIVATE_H */
197184#endif
0 commit comments