mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
committed by
GitHub
parent
e9f42c0854
commit
65e5640810
@ -4,7 +4,7 @@ Yii Framework 2 Change Log
|
||||
2.0.34 under development
|
||||
------------------------
|
||||
|
||||
- no changes in this release.
|
||||
- Bug #17932: Fix regression in detection of AJAX requests (samdark)
|
||||
|
||||
|
||||
2.0.33 March 24, 2020
|
||||
|
||||
@ -487,13 +487,7 @@ class Request extends \yii\base\Request
|
||||
*/
|
||||
public function getIsAjax()
|
||||
{
|
||||
$origin = $this->headers->get('Origin');
|
||||
|
||||
return
|
||||
($this->headers->get('X-Requested-With') === 'XMLHttpRequest') ||
|
||||
($this->headers->get('Sec-Fetch-Mode') === 'cors') ||
|
||||
($this->headers->get('Sec-Fetch-Site') === 'cross-site') ||
|
||||
($origin !== null && $origin !== $this->getHostInfo());
|
||||
return $this->headers->get('X-Requested-With') === 'XMLHttpRequest';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -908,24 +908,6 @@ class RequestTest extends TestCase
|
||||
],
|
||||
true,
|
||||
],
|
||||
[
|
||||
[
|
||||
'HTTP_Sec-Fetch-Mode' => 'cors',
|
||||
],
|
||||
true,
|
||||
],
|
||||
[
|
||||
[
|
||||
'HTTP_Sec-Fetch-Site' => 'cross-site',
|
||||
],
|
||||
true,
|
||||
],
|
||||
[
|
||||
[
|
||||
'HTTP_Origin' => 'https://example.com/',
|
||||
],
|
||||
true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user