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