feat: initial commit
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* 请求 URL 回归(CLI 输出 JSON)
|
||||
*/
|
||||
$root = dirname(__DIR__);
|
||||
require_once $root . '/lib/CloakHttpHelpers.php';
|
||||
|
||||
$tests = [];
|
||||
|
||||
$_SERVER = [
|
||||
'HTTP_HOST' => 'shili.buzz',
|
||||
'REQUEST_URI' => '/BXSXX.php',
|
||||
'HTTPS' => 'off',
|
||||
'SERVER_PORT' => '443',
|
||||
'HTTP_X_FORWARDED_PROTO' => 'https',
|
||||
];
|
||||
$tests['https_from_forwarded_proto'] = cloak_current_request_url() === 'https://shili.buzz/BXSXX.php';
|
||||
|
||||
$_SERVER = [
|
||||
'HTTP_HOST' => 'shili.buzz',
|
||||
'REQUEST_URI' => '/BXSXX.php?ttclid=abc&clk_sig=x',
|
||||
'HTTPS' => 'on',
|
||||
];
|
||||
$tests['full_url_with_query'] = cloak_current_request_url() === 'https://shili.buzz/BXSXX.php?ttclid=abc&clk_sig=x';
|
||||
|
||||
$_SERVER = [
|
||||
'HTTP_HOST' => 'shili.buzz',
|
||||
'REQUEST_URI' => '/BXSXX.php',
|
||||
'HTTPS' => 'on',
|
||||
];
|
||||
$tests['no_bare_question_mark'] = substr(cloak_current_request_url(), -1) !== '?';
|
||||
|
||||
$_SERVER = [
|
||||
'HTTP_HOST' => 'shili.buzz',
|
||||
'SCRIPT_NAME' => '/index.php',
|
||||
'QUERY_STRING' => 'fbclid=test',
|
||||
'HTTPS' => 'on',
|
||||
];
|
||||
unset($_SERVER['REQUEST_URI']);
|
||||
$tests['fallback_query_string'] = cloak_current_request_url() === 'https://shili.buzz/index.php?fbclid=test';
|
||||
|
||||
echo json_encode(['ok' => !in_array(false, $tests, true), 'tests' => $tests], JSON_UNESCAPED_UNICODE) . "\n";
|
||||
Reference in New Issue
Block a user