Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions ext-src/swoole_curl_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ PHP_FUNCTION(swoole_native_curl_multi_setopt);
PHP_FUNCTION(swoole_native_curl_multi_getcontent);
PHP_FUNCTION(swoole_native_curl_multi_info_read);
PHP_FUNCTION(swoole_native_curl_multi_init);

#if PHP_VERSION_ID >= 80400
#if LIBCURL_VERSION_NUM >= 0x073E00 && PHP_VERSION_ID >= 80200
PHP_FUNCTION(swoole_native_curl_upkeep);
PHP_FUNCTION(swoole_native_curl_version);
PHP_FUNCTION(swoole_native_curl_strerror);
PHP_FUNCTION(swoole_native_curl_multi_strerror);
#endif

SW_EXTERN_C_END
Expand Down
10 changes: 9 additions & 1 deletion thirdparty/php/curl/curl_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_swoole_native_curl_init, 0,
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, url, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

#if LIBCURL_VERSION_NUM >= 0x073E00 && PHP_VERSION_ID >= 80200 /* Available since 7.62.0 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_upkeep, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_multi_add_handle, 0, 2, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, multi_handle, CurlMultiHandle, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
Expand Down Expand Up @@ -116,6 +122,9 @@ static const zend_function_entry swoole_native_curl_functions[] = {
PHP_FE(swoole_native_curl_exec, arginfo_swoole_native_curl_exec)
PHP_FE(swoole_native_curl_getinfo, arginfo_swoole_native_curl_getinfo)
PHP_FE(swoole_native_curl_init, arginfo_swoole_native_curl_init)
#if LIBCURL_VERSION_NUM >= 0x073E00 && PHP_VERSION_ID >= 80200
PHP_FE(swoole_native_curl_upkeep, arginfo_swoole_native_curl_upkeep)
#endif
PHP_FE(swoole_native_curl_setopt, arginfo_swoole_native_curl_setopt)
PHP_FE(swoole_native_curl_setopt_array, arginfo_swoole_native_curl_setopt_array)
PHP_FE(swoole_native_curl_reset, arginfo_swoole_native_curl_reset)
Expand All @@ -132,7 +141,6 @@ static const zend_function_entry swoole_native_curl_functions[] = {
PHP_FE(swoole_native_curl_multi_info_read, arginfo_swoole_native_curl_multi_info_read)
PHP_FE(swoole_native_curl_multi_init, arginfo_swoole_native_curl_multi_init)
PHP_FE(swoole_native_curl_multi_remove_handle, arginfo_swoole_native_curl_multi_remove_handle)

PHP_FE_END
};
#endif
53 changes: 20 additions & 33 deletions thirdparty/php/curl/curl_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
Expand All @@ -15,8 +15,6 @@
+----------------------------------------------------------------------+
*/

/* Copied from PHP-4f68662f5b61aecf90f6d8005976f5f91d4ce8d3 */

#if defined(SW_USE_CURL) && PHP_VERSION_ID < 80400

#ifndef _PHP_CURL_PRIVATE_H
Expand Down Expand Up @@ -67,21 +65,20 @@ typedef struct {
typedef struct {
zval func_name;
zend_fcall_info_cache fci_cache;
int method;
} php_curl_progress, php_curl_fnmatch, php_curlm_server_push, php_curl_fnxferinfo, php_curl_sshhostkey;
} php_curl_callback;

typedef struct {
php_curl_write *write;
php_curl_write *write_header;
php_curl_read *read;
zval std_err;
php_curl_progress *progress;
#if LIBCURL_VERSION_NUM >= 0x072000 && PHP_VERSION_ID >= 80200
php_curl_fnxferinfo *xferinfo;
php_curl_callback *progress;
#if PHP_VERSION_ID >= 80200
php_curl_callback *xferinfo;
#endif
php_curl_fnmatch *fnmatch;
php_curl_callback *fnmatch;
#if LIBCURL_VERSION_NUM >= 0x075400 && PHP_VERSION_ID >= 80300
php_curl_sshhostkey *sshhostkey;
php_curl_callback *sshhostkey;
#endif
} php_curl_handlers;

Expand All @@ -94,30 +91,22 @@ struct _php_curl_send_headers {
zend_string *str;
};

#if PHP_VERSION_ID >= 80100
struct _php_curl_free {
zend_llist post;
zend_llist stream;
HashTable *slist;
};
#else
struct _php_curl_free {
zend_llist str;
zend_llist post;
zend_llist stream;
HashTable *slist;
};
#endif

typedef struct {
CURL *cp;
php_curl_handlers handlers;
struct _php_curl_free *to_free;
struct _php_curl_send_headers header;
struct _php_curl_error err;
zend_bool in_callback;
bool in_callback;
uint32_t *clone;
zval postfields;
/* For CURLOPT_PRIVATE */
zval private_data;
/* CurlShareHandle object set using CURLOPT_SHARE. */
struct _php_curlsh *share;
Expand All @@ -127,7 +116,7 @@ typedef struct {
#define CURLOPT_SAFE_UPLOAD -1

typedef struct {
php_curlm_server_push *server_push;
php_curl_callback *server_push;
} php_curlm_handlers;

namespace swoole {
Expand Down Expand Up @@ -160,23 +149,16 @@ php_curl *swoole_curl_init_handle_into_zval(zval *curl);
void swoole_curl_init_handle(php_curl *ch);
void swoole_curl_cleanup_handle(php_curl *);
void swoole_curl_multi_cleanup_list(void *data);
void swoole_curl_verify_handlers(php_curl *ch, int reporterror);
void swoole_curl_verify_handlers(php_curl *ch, bool reporterror);
void swoole_setup_easy_copy_handlers(php_curl *ch, php_curl *source);

#if PHP_VERSION_ID >= 80100
static inline php_curl_handlers *curl_handlers(php_curl *ch) {
return &ch->handlers;
}
#else
static inline php_curl_handlers *curl_handlers(php_curl *ch) {
return ch->handlers;
}
#endif

#if PHP_VERSION_ID >= 80200
typedef zend_result curl_result_t;
#else
typedef int curl_result_t;
#if PHP_VERSION_ID >= 80300
/* Consumes `zv` */
zend_long php_curl_get_long(zval *zv);
#endif

static inline php_curl *curl_from_obj(zend_object *obj) {
Expand All @@ -191,7 +173,12 @@ static inline php_curlsh *curl_share_from_obj(zend_object *obj) {

#define Z_CURL_SHARE_P(zv) curl_share_from_obj(Z_OBJ_P(zv))
void curl_multi_register_class(const zend_function_entry *method_entries);
curl_result_t swoole_curl_cast_object(zend_object *obj, zval *result, int type);

#if PHP_VERSION_ID >= 80200
zend_result swoole_curl_cast_object(zend_object *obj, zval *result, int type);
#else
int swoole_curl_cast_object(zend_object *obj, zval *result, int type);
#endif

#endif /* _PHP_CURL_PRIVATE_H */
#endif
Loading