diff options
author | Matthieu Aubry <matt@piwik.org> | 2014-09-17 04:46:43 +0400 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2014-09-17 04:46:43 +0400 |
commit | 102dadefb56305f809bcae47e196aaa91c707631 (patch) | |
tree | 9839a27521bd3f8e5380d58adf41980cfe8759f2 /core/ProxyHttp.php | |
parent | aac07f9edbaeea8266783e278e6a5c6ac228501d (diff) | |
parent | 1c471b0163e39ca388f9eab1a7a2f7b0f5ecb7f9 (diff) |
Merge pull request #6211 from kylekatarnls/cleanup-arobases2
Replace header() with Common::sendHeader() when possible
Diffstat (limited to 'core/ProxyHttp.php')
-rw-r--r-- | core/ProxyHttp.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/core/ProxyHttp.php b/core/ProxyHttp.php index 9cd32ea35d..a1e7fda32c 100644 --- a/core/ProxyHttp.php +++ b/core/ProxyHttp.php @@ -77,12 +77,12 @@ class ProxyHttp // set some HTTP response headers self::overrideCacheControlHeaders('public'); - @header('Vary: Accept-Encoding'); - @header('Content-Disposition: inline; filename=' . basename($file)); + Common::sendHeader('Vary: Accept-Encoding'); + Common::sendHeader('Content-Disposition: inline; filename=' . basename($file)); if ($expireFarFutureDays) { // Required by proxy caches potentially in between the browser and server to cache the request indeed - @header(self::getExpiresHeaderForFutureDay($expireFarFutureDays)); + Common::sendHeader(self::getExpiresHeaderForFutureDay($expireFarFutureDays)); } // Return 304 if the file has not modified since @@ -143,18 +143,18 @@ class ProxyHttp } } - @header('Last-Modified: ' . $lastModified); + Common::sendHeader('Last-Modified: ' . $lastModified); if (!$phpOutputCompressionEnabled) { - @header('Content-Length: ' . ($byteEnd - $byteStart)); + Common::sendHeader('Content-Length: ' . ($byteEnd - $byteStart)); } if (!empty($contentType)) { - @header('Content-Type: ' . $contentType); + Common::sendHeader('Content-Type: ' . $contentType); } if ($compressed) { - @header('Content-Encoding: ' . $encoding); + Common::sendHeader('Content-Encoding: ' . $encoding); } if (!_readfile($file, $byteStart, $byteEnd)) { @@ -209,12 +209,12 @@ class ProxyHttp public static function overrideCacheControlHeaders($override = null) { if ($override || self::isHttps()) { - @header('Pragma: '); - @header('Expires: '); + Common::sendHeader('Pragma: '); + Common::sendHeader('Expires: '); if (in_array($override, array('public', 'private', 'no-cache', 'no-store'))) { - @header("Cache-Control: $override, must-revalidate"); + Common::sendHeader("Cache-Control: $override, must-revalidate"); } else { - @header('Cache-Control: must-revalidate'); + Common::sendHeader('Cache-Control: must-revalidate'); } } } @@ -228,11 +228,12 @@ class ProxyHttp protected static function setHttpStatus($status) { if (strpos(PHP_SAPI, '-fcgi') === false) { - @header($_SERVER['SERVER_PROTOCOL'] . ' ' . $status); + $key = $_SERVER['SERVER_PROTOCOL']; } else { // FastCGI - @header('Status: ' . $status); + $key = 'Status:'; } + Common::sendHeader($key . ' ' . $status); } /** |