mirror of
https://github.com/php/php-src.git
synced 2024-12-14 12:26:19 +08:00
Merge branch 'PHP-7.3'
This commit is contained in:
commit
e450679dcd
@ -568,6 +568,9 @@ PHP_MINFO_FUNCTION(curl)
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x072f00 /* 7.47.0 */
|
||||
{"PSL", CURL_VERSION_PSL},
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* 7.52.0 */
|
||||
{"HTTPS_PROXY", CURL_VERSION_HTTPS_PROXY},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
@ -1324,8 +1327,70 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TCP_FASTOPEN);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073200 /* Available since 7.50.0 */
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_HTTP_VERSION);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073300 /* Available since 7.51.0 */
|
||||
REGISTER_CURL_CONSTANT(CURLE_WEIRD_SERVER_REPLY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_KEEP_SENDING_ON_ERROR);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* Available since 7.52.0 */
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_3);
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_HTTPS_PROXY);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_PROTOCOL);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_PROXY_SSL_VERIFYRESULT);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SCHEME);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PRE_PROXY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_CAINFO);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_CAPATH);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_CRLFILE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_KEYPASSWD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_PINNEDPUBLICKEY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSL_CIPHER_LIST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSL_OPTIONS);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSL_VERIFYHOST);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSL_VERIFYPEER);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSLCERT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSLCERTTYPE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSLKEY);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSLKEYTYPE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SSLVERSION);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TLSAUTH_PASSWORD);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TLSAUTH_TYPE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TLSAUTH_USERNAME);
|
||||
REGISTER_CURL_CONSTANT(CURLPROXY_HTTPS);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073500 /* Available since 7.53.0 */
|
||||
REGISTER_CURL_CONSTANT(CURL_MAX_READ_SIZE);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_ABSTRACT_UNIX_SOCKET);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073600 /* Available since 7.54.0 */
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_DEFAULT);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_NONE);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_TLSv1_0);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_TLSv1_1);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_TLSv1_2);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_MAX_TLSv1_3);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SUPPRESS_CONNECT_HEADERS);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073601 /* Available since 7.54.1 */
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_GSSAPI);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* Available since 7.55.0 */
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_DOWNLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_LENGTH_UPLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SIZE_DOWNLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SIZE_UPLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SPEED_DOWNLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLINFO_SPEED_UPLOAD_T);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_REQUEST_TARGET);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SOCKS5_AUTH);
|
||||
#endif
|
||||
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SAFE_UPLOAD);
|
||||
@ -2187,6 +2252,22 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
#if LIBCURL_VERSION_NUM >= 0x073100 /* Available since 7.49.0 */
|
||||
case CURLOPT_TCP_FASTOPEN:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073300 /* Available since 7.51.0 */
|
||||
case CURLOPT_KEEP_SENDING_ON_ERROR:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* Available since 7.52.0 */
|
||||
case CURLOPT_PROXY_SSL_OPTIONS:
|
||||
case CURLOPT_PROXY_SSL_VERIFYHOST:
|
||||
case CURLOPT_PROXY_SSL_VERIFYPEER:
|
||||
case CURLOPT_PROXY_SSLVERSION:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073600 /* Available since 7.54.0 */
|
||||
case CURLOPT_SUPPRESS_CONNECT_HEADERS:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* Available since 7.55.0 */
|
||||
case CURLOPT_SOCKS5_AUTH:
|
||||
#endif
|
||||
|
||||
lval = zval_get_long(zvalue);
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
|
||||
@ -2277,6 +2358,25 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
#if LIBCURL_VERSION_NUM >= 0x072d00 /* Available since 7.45.0 */
|
||||
case CURLOPT_DEFAULT_PROTOCOL:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* Available since 7.52.0 */
|
||||
case CURLOPT_PRE_PROXY:
|
||||
case CURLOPT_PROXY_CAINFO:
|
||||
case CURLOPT_PROXY_CAPATH:
|
||||
case CURLOPT_PROXY_CRLFILE:
|
||||
case CURLOPT_PROXY_KEYPASSWD:
|
||||
case CURLOPT_PROXY_PINNEDPUBLICKEY:
|
||||
case CURLOPT_PROXY_SSL_CIPHER_LIST:
|
||||
case CURLOPT_PROXY_SSLCERT:
|
||||
case CURLOPT_PROXY_SSLCERTTYPE:
|
||||
case CURLOPT_PROXY_SSLKEY:
|
||||
case CURLOPT_PROXY_SSLKEYTYPE:
|
||||
case CURLOPT_PROXY_TLSAUTH_PASSWORD:
|
||||
case CURLOPT_PROXY_TLSAUTH_TYPE:
|
||||
case CURLOPT_PROXY_TLSAUTH_USERNAME:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073500 /* Available since 7.53.0 */
|
||||
case CURLOPT_ABSTRACT_UNIX_SOCKET:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* Available since 7.55.0 */
|
||||
case CURLOPT_REQUEST_TARGET:
|
||||
#endif
|
||||
@ -2976,10 +3076,13 @@ PHP_FUNCTION(curl_getinfo)
|
||||
long as there's no 32-bit int overflow. */
|
||||
long l_code;
|
||||
double d_code;
|
||||
#if LIBCURL_VERSION_NUM > 0x071301
|
||||
#if LIBCURL_VERSION_NUM > 0x071301 /* 7.19.1 */
|
||||
struct curl_certinfo *ci = NULL;
|
||||
zval listcode;
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* 7.55.0 */
|
||||
curl_off_t co;
|
||||
#endif
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
@ -3076,6 +3179,42 @@ PHP_FUNCTION(curl_getinfo)
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_LOCAL_PORT, &l_code) == CURLE_OK) {
|
||||
CAAL("local_port", l_code);
|
||||
}
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073200 /* Available since 7.50.0 */
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_HTTP_VERSION, &l_code) == CURLE_OK) {
|
||||
CAAL("http_version", l_code);
|
||||
}
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* Available since 7.52.0 */
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_PROTOCOL, &l_code) == CURLE_OK) {
|
||||
CAAL("protocol", l_code);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_PROXY_SSL_VERIFYRESULT, &l_code) == CURLE_OK) {
|
||||
CAAL("ssl_verifyresult", l_code);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_SCHEME, &s_code) == CURLE_OK) {
|
||||
CAAS("scheme", s_code);
|
||||
}
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* Available since 7.55.0 */
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("content_length_download", co);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("content_length_upload", co);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("size_download", co);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("size_upload", co);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("speed_download", co);
|
||||
}
|
||||
if (curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD_T, &co) == CURLE_OK) {
|
||||
CAAL("speed_upload", co);
|
||||
}
|
||||
#endif
|
||||
if (ch->header.str) {
|
||||
CAASTR("request_header", ch->header.str);
|
||||
@ -3153,6 +3292,18 @@ PHP_FUNCTION(curl_getinfo)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if LIBCURL_VERSION_NUM >= 0x073700 /* Available since 7.55.0 */
|
||||
case CURLINFO_OFF_T:
|
||||
{
|
||||
curl_off_t c_off;
|
||||
if (curl_easy_getinfo(ch->cp, option, &c_off) == CURLE_OK) {
|
||||
RETURN_LONG((long) c_off);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ GSSAPI => No
|
||||
KERBEROS5 => Yes
|
||||
UNIX_SOCKETS => No
|
||||
PSL => No
|
||||
HTTPS_PROXY => Yes
|
||||
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
|
||||
Host => %s-pc-win32
|
||||
SSL Version => OpenSSL/%s
|
||||
|
31
ext/curl/tests/curl_basic_023.phpt
Normal file
31
ext/curl/tests/curl_basic_023.phpt
Normal file
@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test curl_getinfo() function with CURLINFO_HTTP_VERSION parameter
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) print "skip";
|
||||
$curl_version = curl_version();
|
||||
if ($curl_version['version_number'] < 0x073200) {
|
||||
exit("skip: test works only with curl >= 7.50.0");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
|
||||
$ch = curl_init();
|
||||
var_dump(0 === curl_getinfo($ch, CURLINFO_HTTP_VERSION));
|
||||
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$url = "{$host}/get.php?test=";
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_exec($ch);
|
||||
var_dump(CURL_HTTP_VERSION_1_1 === curl_getinfo($ch, CURLINFO_HTTP_VERSION));
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
===DONE===
|
32
ext/curl/tests/curl_basic_024.phpt
Normal file
32
ext/curl/tests/curl_basic_024.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Test curl_getinfo() function with CURLINFO_* from curl >= 7.52.0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) print "skip";
|
||||
$curl_version = curl_version();
|
||||
if ($curl_version['version_number'] < 0x073400) {
|
||||
exit("skip: test works only with curl >= 7.52.0");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
|
||||
$ch = curl_init();
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$url = "{$host}/get.php?test=";
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_exec($ch);
|
||||
var_dump(CURLPROTO_HTTP === curl_getinfo($ch, CURLINFO_PROTOCOL));
|
||||
var_dump(0 === curl_getinfo($ch, CURLINFO_PROXY_SSL_VERIFYRESULT));
|
||||
var_dump(curl_getinfo($ch, CURLINFO_SCHEME));
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(4) "HTTP"
|
||||
===DONE===
|
Loading…
Reference in New Issue
Block a user