Skip to content

[cURL] Update cURL features list #7869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
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
34 changes: 34 additions & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ PHP_MINFO_FUNCTION(curl)
{"SSL", CURL_VERSION_SSL},
{"SSPI", CURL_VERSION_SSPI},
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
{"TrackMemory", CURL_VERSION_CURLDEBUG},
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
{"HTTP2", CURL_VERSION_HTTP2},
#endif
Expand All @@ -295,6 +296,22 @@ PHP_MINFO_FUNCTION(curl)
#endif
#if LIBCURL_VERSION_NUM >= 0x073900 /* 7.57.0 */
{"BROTLI", CURL_VERSION_BROTLI},
#endif
#if LIBCURL_VERSION_NUM >= 0x074001 /* 7.64.1 */
{"Alt-Svc", CURL_VERSION_ALTSVC},
#endif
#if LIBCURL_VERSION_NUM >= 0x074200 /* 7.66.0 */
{"HTTP3", CURL_VERSION_HTTP3},
#endif
#if LIBCURL_VERSION_NUM >= 0x074800 /* 7.72.0 */
{"Unicode", CURL_VERSION_UNICODE},
{"Zstandard", CURL_VERSION_ZSTD},
#endif
#if LIBCURL_VERSION_NUM >= 0x074a00 /* 7.74.0 */
{"HSTS", CURL_VERSION_HSTS},
#endif
#if LIBCURL_VERSION_NUM >= 0x074c00 /* 7.76.0 */
{"Libgsasl", CURL_VERSION_GSASL},
#endif
{NULL, 0}
};
Expand Down Expand Up @@ -1155,6 +1172,10 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_VERSION_ALTSVC);
#endif

#if LIBCURL_VERSION_NUM >= 0x074200 /* Available since 7.66.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_HTTP3);
#endif

#if LIBCURL_VERSION_NUM >= 0x074700 /* Available since 7.71.0 */
REGISTER_CURL_CONSTANT(CURLOPT_ISSUERCERT_BLOB);
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_ISSUERCERT);
Expand All @@ -1165,6 +1186,19 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_SSLKEY_BLOB);
#endif

#if LIBCURL_VERSION_NUM >= 0x074800 /* Available since 7.72.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_UNICODE);
REGISTER_CURL_CONSTANT(CURL_VERSION_ZSTD);
#endif

#if LIBCURL_VERSION_NUM >= 0x074a00 /* Available since 7.74.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_HSTS);
#endif

#if LIBCURL_VERSION_NUM >= 0x074c00 /* Available since 7.76.0 */
REGISTER_CURL_CONSTANT(CURL_VERSION_GSASL);
#endif

REGISTER_CURL_CONSTANT(CURLOPT_SAFE_UPLOAD);

#ifdef PHP_CURL_NEED_OPENSSL_TSL
Expand Down
64 changes: 64 additions & 0 deletions ext/curl/tests/check_features_unix.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--TEST--
Check libcurl features list
--SKIPIF--
<?php

if (substr(PHP_OS, 0, 3) === 'WIN') {
exit('skip: test doesn\'t work with Windows');
}

if (!extension_loaded('curl')) {
exit('skip: test requires the curl extension');
}

$version = curl_version();

if ($version['version_number'] < 0x071d00) {
exit('skip: test works only with curl >= 7.29.0');
}

?>
--FILE--
<?php
ob_start();
phpinfo();
$s = ob_get_contents();
ob_end_clean();
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);

echo $m[1], "\n";

?>
--EXPECTF--
cURL support => enabled
cURL Information => %s
Age => %d
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => %s
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
TrackMemory => No
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => %s
HTTPS_PROXY => Yes
MULTI_SSL => No
%A
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps%s
Host => %s
SSL Version => %s/%s
ZLib Version => %s
65 changes: 65 additions & 0 deletions ext/curl/tests/check_features_win.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--TEST--
Check libcurl features list
--SKIPIF--
<?php

if (substr(PHP_OS, 0, 3) !== 'WIN') {
exit('skip: test only works with Windows');
}

if (!extension_loaded('curl')) {
exit('skip: test requires the curl extension');
}

$version = curl_version();

if ($version['version_number'] < 0x071d00) {
exit('skip: test works only with curl >= 7.29.0');
}

?>
--FILE--
<?php
ob_start();
phpinfo();
$s = ob_get_contents();
ob_end_clean();
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);

echo $m[1], "\n";

?>
--EXPECTF--
cURL support => enabled
cURL Information => %s
Age => %d
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => No
SPNEGO => No
SSL => Yes
SSPI => Yes
TLS-SRP => No
TrackMemory => No
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => Yes
HTTPS_PROXY => Yes
MULTI_SSL => %s
BROTLI => %s
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, smb, smbs, smtp, smtps, telnet, tftp
Host => %s-pc-win32
SSL Version => OpenSSL/%s
ZLib Version => %s
libSSH Version => libssh2/%s
1 change: 1 addition & 0 deletions ext/curl/tests/check_win_config.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
TrackMemory => No
NTLMWB => No
SPNEGO => Yes
SSL => Yes
Expand Down