Skip to content

Commit

Permalink
Style consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-scott committed Jan 3, 2016
1 parent 2223d9e commit 6d5aaa6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/CSPBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,16 @@ protected function compileSubgroup($directive, $policies = null)
$url = \filter_var($url, FILTER_SANITIZE_URL);
if ($url !== false) {
if ($this->supportOldBrowsers) {
if (strpos($url, '://') === false) {
if (self::isHTTPSconnection() || !empty($this->policies['upgrade-insecure-requests'])) {
if (\strpos($url, '://') === false) {
if ($this->isHTTPSconnection() || !empty($this->policies['upgrade-insecure-requests'])) {
// We only want HTTPS connections here.
$ret .= 'https://'.$url.' ';
} else {
$ret .= 'https://'.$url.' http://'.$url.' ';
}
}
}
if (self::isHTTPSconnection() || !empty($this->policies['upgrade-insecure-requests'])) {
if ($this->isHTTPSconnection() || !empty($this->policies['upgrade-insecure-requests'])) {
$ret .= \str_replace('http://', 'https://', $url).' ';
} else {
$ret .= $url.' ';
Expand Down Expand Up @@ -480,11 +480,14 @@ protected function compileSubgroup($directive, $policies = null)
*/
protected function getHeaderKeys($legacy = true)
{
// We always want this
$return = [
$this->reportOnly
? 'Content-Security-Policy-Report-Only'
: 'Content-Security-Policy'
];

// If we're supporting legacy devices, include these too:
if ($legacy) {
$return []= $this->reportOnly
? 'X-Content-Security-Policy-Report-Only'
Expand Down

0 comments on commit 6d5aaa6

Please sign in to comment.