Simplify CSP header method

This commit is contained in:
Frederic Guillot 2015-02-01 14:38:29 -05:00
parent 41a344e9ce
commit 3e2f4f9c2c
1 changed files with 1 additions and 18 deletions

View File

@ -212,24 +212,7 @@ class Response
$policies['default-src'] = "'self'";
$values = '';
foreach ($policies as $policy => $hosts) {
if (is_array($hosts)) {
$acl = '';
foreach ($hosts as &$host) {
if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) {
$acl .= $host.' ';
}
}
}
else {
$acl = $hosts;
}
foreach ($policies as $policy => $acl) {
$values .= $policy.' '.trim($acl).'; ';
}