Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function process(HTTPRequest $request, callable $delegate) |
||
30 | { |
||
31 | if ($this->allowedHosts && !Director::is_cli()) { |
||
32 | $allowedHosts = preg_split('/ *, */', $this->allowedHosts); |
||
33 | |||
34 | // check allowed hosts |
||
35 | if (!in_array($request->getHeader('Host'), $allowedHosts)) { |
||
36 | return new HTTPResponse('Invalid Host', 400); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | return $delegate($request); |
||
41 | } |
||
42 | } |
||
43 |