diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/download/file.php | 10 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 23 |
2 files changed, 23 insertions, 10 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 00b8e2e656..2154847865 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -670,15 +670,7 @@ function set_modified_headers($stamp, $browser) { if ($last_load !== false && $last_load >= $stamp) { - if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') - { - // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though - header('Status: 304 Not Modified', true, 304); - } - else - { - header('HTTP/1.0 304 Not Modified', true, 304); - } + send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers header('Pragma: public'); header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..bc7c426e44 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,27 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + if (isset($_SERVER['HTTP_VERSION'])) + { + $version = $_SERVER['HTTP_VERSION']; + } + else + { + $version = 'HTTP/1.0'; + } + header("$version $code $message", true, $code); + } +} + //Form validation @@ -3623,7 +3644,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { - header("HTTP/1.x 404 Not Found"); + send_status_line(404, 'Not Found'); } $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; |