From b1f6bd8ed2be14c399be968bf365167c5ff8f29b Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Mon, 12 Aug 2024 03:35:52 +0700 Subject: [PATCH] ext/curl: Add HTTP/3 constants This intends to supersede the two following PRs: - #12000 because it does not modify the stub file, but only update the arginfo file. It also proposes to merge to GA branches, and is currently marked as Requires RM Approval. - #12543 Essentially the same as this PR and from the same author, as this, but its about a year old and requires rebasing anyway. This adds the `CURL_HTTP_VERSION_3` and `CURL_HTTP_VERSION_3ONLY` constants on relevant versions (7.66 and 7.88 respectively). It is possible to use HTTP/3 without having these constants declared, but having them declared in PHP makes things more approachable and "official". --- NEWS | 4 ++++ UPGRADING | 6 ++++++ ext/curl/curl.stub.php | 13 +++++++++++++ ext/curl/curl_arginfo.h | 8 +++++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1656b8bba2683..dc28d6abdc3f7 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,10 @@ PHP NEWS . Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias) . Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos) +- Curl: + . Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY + (libcurl 7.88) as options for CURLOPT_HTTP_VERSION (Ayesh Karunaratne) + - Date: . Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and SUNFUNCS_RET_DOUBLE are now deprecated. (Jorg Sowa) diff --git a/UPGRADING b/UPGRADING index 544a25c6fbeb8..29dc2d2b171ef 100644 --- a/UPGRADING +++ b/UPGRADING @@ -244,6 +244,8 @@ PHP 8.4 UPGRADE NOTES . curl_version() returns an additional feature_list value, which is an associative array of all known Curl features, and whether they are supported (true) or not (false). + . Added CURL_HTTP_VERSION_3 and CURL_HTTP_VERSION_3ONLY constants (available + since libcurl 7.66 and 7.88) as available options for CURLOPT_HTTP_VERSION. - Date: . Added static methods @@ -881,6 +883,10 @@ PHP 8.4 UPGRADE NOTES . PHP_OUTPUT_HANDLER_PROCESSED. . PHP_SBINDIR. +- Curl: + . CURL_HTTP_VERSION_3. + . CURL_HTTP_VERSION_3ONLY. + - Intl: . The IntlDateFormatter class exposes now the new PATTERN constant reflecting udat api's UDAT_PATTERN. diff --git a/ext/curl/curl.stub.php b/ext/curl/curl.stub.php index 5709a404afe97..0adfb17c4d3f3 100644 --- a/ext/curl/curl.stub.php +++ b/ext/curl/curl.stub.php @@ -3102,6 +3102,11 @@ * @cvalue CURLINFO_RETRY_AFTER */ const CURLINFO_RETRY_AFTER = UNKNOWN; +/** + * @var int + * @cvalue CURL_HTTP_VERSION_3 + */ +const CURL_HTTP_VERSION_3 = UNKNOWN; #endif #if LIBCURL_VERSION_NUM >= 0x074300 /* Available since 7.67.0 */ @@ -3547,6 +3552,14 @@ const CURLOPT_QUICK_EXIT = UNKNOWN; #endif +#if LIBCURL_VERSION_NUM >= 0x075800 /* Available since 7.88.0 */ +/** + * @var int + * @cvalue CURL_HTTP_VERSION_3ONLY + */ +const CURL_HTTP_VERSION_3ONLY = UNKNOWN; +#endif + /** * @var int * @cvalue CURLOPT_SAFE_UPLOAD diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index 0eee34bfd3178..044763d57df0f 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 92f4985790d0dad4216be837571e41c86711b6f8 */ + * Stub hash: b5a3bd62bcb62b2e7e4aacfcd4621cc632be1564 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0) @@ -848,6 +848,9 @@ static void register_curl_symbols(int module_number) #if LIBCURL_VERSION_NUM >= 0x074200 /* Available since 7.66.0 */ REGISTER_LONG_CONSTANT("CURLINFO_RETRY_AFTER", CURLINFO_RETRY_AFTER, CONST_PERSISTENT); #endif +#if LIBCURL_VERSION_NUM >= 0x074200 /* Available since 7.66.0 */ + REGISTER_LONG_CONSTANT("CURL_HTTP_VERSION_3", CURL_HTTP_VERSION_3, CONST_PERSISTENT); +#endif #if LIBCURL_VERSION_NUM >= 0x074300 /* Available since 7.67.0 */ REGISTER_LONG_CONSTANT("CURLMOPT_MAX_CONCURRENT_STREAMS", CURLMOPT_MAX_CONCURRENT_STREAMS, CONST_PERSISTENT); #endif @@ -1081,6 +1084,9 @@ static void register_curl_symbols(int module_number) #endif #if LIBCURL_VERSION_NUM >= 0x075700 /* Available since 7.87.0 */ REGISTER_LONG_CONSTANT("CURLOPT_QUICK_EXIT", CURLOPT_QUICK_EXIT, CONST_PERSISTENT); +#endif +#if LIBCURL_VERSION_NUM >= 0x075800 /* Available since 7.88.0 */ + REGISTER_LONG_CONSTANT("CURL_HTTP_VERSION_3ONLY", CURL_HTTP_VERSION_3ONLY, CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("CURLOPT_SAFE_UPLOAD", CURLOPT_SAFE_UPLOAD, CONST_PERSISTENT); }