Use full domain test list

This commit is contained in:
crazywhalecc 2025-08-02 18:40:55 +08:00
parent e14301d991
commit 3960a21e05
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 35 additions and 8 deletions

View File

@ -6,13 +6,27 @@ assert(function_exists('curl_init'));
assert(function_exists('curl_setopt')); assert(function_exists('curl_setopt'));
assert(function_exists('curl_exec')); assert(function_exists('curl_exec'));
assert(function_exists('curl_close')); assert(function_exists('curl_close'));
assert(function_exists('curl_version'));
$curl_version = curl_version(); $curl_version = curl_version();
if (stripos($curl_version['ssl_version'], 'schannel') !== false) { if (stripos($curl_version['ssl_version'], 'schannel') !== false) {
$curl = curl_init(); $domain_list = [
curl_setopt($curl, CURLOPT_URL, 'https://captive.apple.com/'); 'https://captive.apple.com/',
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 'https://detectportal.firefox.com/',
curl_setopt($curl, CURLOPT_HEADER, 0); 'https://static-php.dev/',
$data = curl_exec($curl); 'https://www.example.com/',
curl_close($curl); ];
assert($data !== false); $valid = false;
foreach ($domain_list as $domain) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $domain);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
$data = curl_exec($curl);
curl_close($curl);
if ($data !== false) {
$valid = true;
break;
}
}
assert($valid);
} }

View File

@ -5,7 +5,20 @@ declare(strict_types=1);
assert(function_exists('openssl_digest')); assert(function_exists('openssl_digest'));
assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e'); assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e');
if (file_exists('/etc/ssl/openssl.cnf')) { if (file_exists('/etc/ssl/openssl.cnf')) {
assert(file_get_contents('https://captive.apple.com/') !== false); $domain_list = [
'https://captive.apple.com/',
'https://detectportal.firefox.com/',
'https://static-php.dev/',
'https://www.example.com/',
];
$valid = false;
foreach ($domain_list as $domain) {
if (file_get_contents($domain) !== false) {
$valid = true;
break;
}
}
assert($valid);
} }
if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
assert(function_exists('openssl_password_hash')); assert(function_exists('openssl_password_hash'));