Skip to content

Commit

Permalink
remove curl < 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
doubaokun committed Jan 1, 2025
1 parent eb2af6c commit e9542d2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 736 deletions.
2 changes: 0 additions & 2 deletions thirdparty/php/curl/curl_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "curl_interface.h"

#ifdef SW_USE_CURL
#if PHP_VERSION_ID >= 80000

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_swoole_native_curl_close, 0, 1, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
Expand Down Expand Up @@ -152,4 +151,3 @@ static const zend_function_entry swoole_native_curl_functions[] = {
PHP_FE_END
};
#endif
#endif
62 changes: 0 additions & 62 deletions thirdparty/php/curl/curl_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ typedef struct {
php_curl_read *read;
zval std_err;
php_curl_progress *progress;
#if PHP_VERSION_ID >= 80200
#if LIBCURL_VERSION_NUM >= 0x072000
php_curl_fnxferinfo *xferinfo;
#endif
#endif
#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
php_curl_fnmatch *fnmatch;
#endif
Expand All @@ -96,7 +94,6 @@ struct _php_curl_send_headers {
zend_string *str;
};

#if PHP_VERSION_ID >= 80100
struct _php_curl_free {
zend_llist post;
zend_llist stream;
Expand All @@ -105,45 +102,21 @@ struct _php_curl_free {
#endif
HashTable *slist;
};
#else
struct _php_curl_free {
zend_llist str;
zend_llist post;
zend_llist stream;
HashTable *slist;
};
#endif

typedef struct {
CURL *cp;
#if PHP_VERSION_ID < 80000
zend_resource *res;
#endif
#if PHP_VERSION_ID >= 80100
php_curl_handlers handlers;
#else
php_curl_handlers *handlers;
#endif
struct _php_curl_free *to_free;
struct _php_curl_send_headers header;
struct _php_curl_error err;
zend_bool in_callback;
uint32_t* clone;
zval postfields;

#if PHP_VERSION_ID >= 80100
/* For CURLOPT_PRIVATE */
zval private_data;
#elif PHP_VERSION_ID < 80000
const char *private_data;
#endif

/* CurlShareHandle object set using CURLOPT_SHARE. */
#if PHP_VERSION_ID >= 80000
struct _php_curlsh *share;
zend_object std;
#endif

} php_curl;

#define CURLOPT_SAFE_UPLOAD -1
Expand All @@ -159,34 +132,21 @@ class Multi;
using swoole::curl::Multi;

typedef struct {
#if PHP_VERSION_ID < 80100
int still_running;
#endif
Multi *multi;
zend_llist easyh;
#if PHP_VERSION_ID >= 80100
php_curlm_handlers handlers;
#else
php_curlm_handlers *handlers;
#endif
struct {
int no;
} err;
#if PHP_VERSION_ID >= 80000
zend_object std;
#else
bool is_co;
#endif
} php_curlm;

typedef struct _php_curlsh {
CURLSH *share;
struct {
int no;
} err;
#if PHP_VERSION_ID >= 80000
zend_object std;
#endif
} php_curlsh;

php_curl *swoole_curl_init_handle_into_zval(zval *curl);
Expand All @@ -196,17 +156,10 @@ void swoole_curl_multi_cleanup_list(void *data);
void swoole_curl_verify_handlers(php_curl *ch, int 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 >= 80000
static inline php_curl *curl_from_obj(zend_object *obj) {
return (php_curl *)((char *)(obj) - XtOffsetOf(php_curl, std));
}
Expand All @@ -220,26 +173,11 @@ 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);

#if PHP_VERSION_ID < 80200
int swoole_curl_cast_object(zend_object *obj, zval *result, int type);
#else
zend_result swoole_curl_cast_object(zend_object *obj, zval *result, int type);
#endif
#else
#define Z_CURL_P(zv) swoole_curl_get_handle(zv)
#endif /* PHP8 end */

php_curl *swoole_curl_get_handle(zval *zid, bool exclusive = true, bool required = true);

SW_EXTERN_C_BEGIN
#if PHP_VERSION_ID < 80000
void swoole_curl_close_ex(php_curl *ch);
void swoole_curl_close(zend_resource *rsrc);
void swoole_curl_multi_close(zend_resource *rsrc);
php_curl *swoole_curl_alloc_handle();
int swoole_curl_get_le_curl();
int swoole_curl_get_le_curl_multi();
#endif
SW_EXTERN_C_END

#endif /* _PHP_CURL_PRIVATE_H */
Expand Down
Loading

0 comments on commit e9542d2

Please sign in to comment.