Simplify CSP header method
This commit is contained in:
@@ -212,24 +212,7 @@ class Response
|
|||||||
$policies['default-src'] = "'self'";
|
$policies['default-src'] = "'self'";
|
||||||
$values = '';
|
$values = '';
|
||||||
|
|
||||||
foreach ($policies as $policy => $hosts) {
|
foreach ($policies as $policy => $acl) {
|
||||||
|
|
||||||
if (is_array($hosts)) {
|
|
||||||
|
|
||||||
$acl = '';
|
|
||||||
|
|
||||||
foreach ($hosts as &$host) {
|
|
||||||
|
|
||||||
if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) {
|
|
||||||
$acl .= $host.' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
$acl = $hosts;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values .= $policy.' '.trim($acl).'; ';
|
$values .= $policy.' '.trim($acl).'; ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user