diff --git a/NEWS b/NEWS index 858ca396189a..3e24c2fa0bc6 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,9 @@ PHP NEWS - BZ2: . Reject oversized input in bzdecompress(). (arshidkv12) +- Curl: + . Add support for CURLINFO_SIZE_DELIVERED (libcurl >= 8.20.0). (Ayesh) + - Date: . Update timelib to 2022.16. (Derick) diff --git a/UPGRADING b/UPGRADING index 9f7917301b59..18afee1a5c9d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -186,6 +186,13 @@ PHP 8.6 UPGRADE NOTES . It is now possible to define the `__debugInfo()` magic method on enums. RFC: https://wiki.php.net/rfc/debugable-enums +- Curl: + . curl_getinfo() return array now includes a new size_delivered key, + which indicates the total number of bytes passed to the download + write callback. This value can also be obtained by passing + CURLINFO_SIZE_DELIVERED as the $option parameter. + Requires libcurl 8.20.0 or later. + - Fileinfo: . finfo_file() now works with remote streams. @@ -399,6 +406,9 @@ PHP 8.6 UPGRADE NOTES 10. New Global Constants ======================================== +- Curl: + . CURLINFO_SIZE_DELIVERED (libcurl >= 8.20.0). + - Sockets: . TCP_USER_TIMEOUT (Linux only). . AF_UNSPEC. diff --git a/ext/curl/curl.stub.php b/ext/curl/curl.stub.php index aadab8cb0b0d..d3bd58510e40 100644 --- a/ext/curl/curl.stub.php +++ b/ext/curl/curl.stub.php @@ -3117,6 +3117,13 @@ */ const CURLINFO_CONN_ID = UNKNOWN; #endif +#if LIBCURL_VERSION_NUM >= 0x081400 /* Available since 8.20.0 */ +/** + * @var int + * @cvalue CURLINFO_SIZE_DELIVERED + */ +const CURLINFO_SIZE_DELIVERED = UNKNOWN; +#endif /** * @var int * @cvalue CURLOPT_DISALLOW_USERNAME_IN_URL diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index 6fb17ed029e3..6a05b73572cb 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit curl.stub.php instead. - * Stub hash: 10ebdc94560ed19ecd6b61a11b3dab5d32989d66 */ + * Stub hash: 1ecf692ba8494e7b486986c0170686c33768deb5 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0) @@ -830,6 +830,9 @@ static void register_curl_symbols(int module_number) #endif #if LIBCURL_VERSION_NUM >= 0x080200 /* Available since 8.2.0 */ REGISTER_LONG_CONSTANT("CURLINFO_CONN_ID", CURLINFO_CONN_ID, CONST_PERSISTENT); +#endif +#if LIBCURL_VERSION_NUM >= 0x081400 /* Available since 8.20.0 */ + REGISTER_LONG_CONSTANT("CURLINFO_SIZE_DELIVERED", CURLINFO_SIZE_DELIVERED, CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("CURLOPT_DISALLOW_USERNAME_IN_URL", CURLOPT_DISALLOW_USERNAME_IN_URL, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS, CONST_PERSISTENT); diff --git a/ext/curl/interface.c b/ext/curl/interface.c index ed544866a886..1dff14b7c8c2 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2456,6 +2456,11 @@ PHP_FUNCTION(curl_getinfo) if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code) == CURLE_OK) { CAAD("size_download", d_code); } +#if LIBCURL_VERSION_NUM >= 0x081400 /* Available since 8.20.0 */ + if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DELIVERED , &l_code) == CURLE_OK) { + CAAL("size_delivered", l_code); + } +#endif if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code) == CURLE_OK) { CAAD("speed_download", d_code); } diff --git a/ext/curl/tests/curl_getinfo_CURLINFO_SIZE_DELIVERED.phpt b/ext/curl/tests/curl_getinfo_CURLINFO_SIZE_DELIVERED.phpt new file mode 100644 index 000000000000..e33277ff88f8 --- /dev/null +++ b/ext/curl/tests/curl_getinfo_CURLINFO_SIZE_DELIVERED.phpt @@ -0,0 +1,40 @@ +--TEST-- +Curlinfo CURLINFO_SIZE_DELIVERED +--EXTENSIONS-- +curl +--SKIPIF-- += 8.20.0"); +?> +--FILE-- + 0); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +