mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Moving features from RequestHandler into CakeRequest.
This commit is contained in:
parent
df910026ee
commit
78bd7300a2
2 changed files with 9 additions and 0 deletions
|
@ -380,6 +380,11 @@ class CakeRequest implements ArrayAccess {
|
||||||
*/
|
*/
|
||||||
public function referer($local = false) {
|
public function referer($local = false) {
|
||||||
$ref = env('HTTP_REFERER');
|
$ref = env('HTTP_REFERER');
|
||||||
|
$forwarded = env('HTTP_X_FORWARDED_HOST');
|
||||||
|
if ($forwarded) {
|
||||||
|
$ref = $forwarded;
|
||||||
|
}
|
||||||
|
|
||||||
$base = '';
|
$base = '';
|
||||||
if (defined('FULL_BASE_URL')) {
|
if (defined('FULL_BASE_URL')) {
|
||||||
$base = FULL_BASE_URL;
|
$base = FULL_BASE_URL;
|
||||||
|
|
|
@ -466,6 +466,10 @@ class CakeRequestTestCase extends CakeTestCase {
|
||||||
$_SERVER['HTTP_REFERER'] = FULL_BASE_URL . 'recipes/add';
|
$_SERVER['HTTP_REFERER'] = FULL_BASE_URL . 'recipes/add';
|
||||||
$result = $request->referer(true);
|
$result = $request->referer(true);
|
||||||
$this->assertIdentical($result, '/recipes/add');
|
$this->assertIdentical($result, '/recipes/add');
|
||||||
|
|
||||||
|
$_SERVER['HTTP_X_FORWARDED_HOST'] = 'cakephp.org';
|
||||||
|
$result = $request->referer();
|
||||||
|
$this->assertIdentical($result, 'cakephp.org');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue