Index: bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.145.2.6 diff -u -r1.145.2.6 bootstrap.inc --- bootstrap.inc 26 Jul 2007 19:16:45 -0000 1.145.2.6 +++ bootstrap.inc 6 Sep 2007 13:26:15 -0000 @@ -555,7 +555,7 @@ if ($if_modified_since && $if_none_match && $if_none_match == $etag // etag must match && $if_modified_since == $last_modified) { // if-modified-since must match - header('HTTP/1.1 304 Not Modified'); + drupal_http_status(304, 'Not Modified'); // All 304 responses must send an etag if the 200 response for the same object contained an etag header("Etag: $etag"); exit(); @@ -850,7 +850,7 @@ case DRUPAL_BOOTSTRAP_ACCESS: // Deny access to hosts which were banned - t() is not yet available. if (drupal_is_denied('host', $_SERVER['REMOTE_ADDR'])) { - header('HTTP/1.1 403 Forbidden'); + drupal_http_status(403, 'Forbidden'); print 'Sorry, '. $_SERVER['REMOTE_ADDR']. ' has been banned.'; exit(); } Index: common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.611.2.9 diff -u -r1.611.2.9 common.inc --- common.inc 26 Jul 2007 19:16:45 -0000 1.611.2.9 +++ common.inc 6 Sep 2007 13:26:15 -0000 @@ -126,6 +126,22 @@ } /** + * As the CGI specification does not allow directly setting the HTTP status code, + * if the PHP Server API is CGI the HTTP/1.1 header will not work, using Status instead + * see http://www.php.net/manual/en/function.header.php#66254 + * + * @param int $status the http status + * @param string $message the header message + */ +function drupal_http_status($status, $message = '') { + if (substr(php_sapi_name(), 0, 3) == 'cgi') { + header('Status: ' . $status, TRUE); + } + else { + header('HTTP/1.1 ' . $status . ' ' . $message); + } +} + +/** * Set an HTTP response header for the current page. * * Note: when sending a Content-Type header, always include a 'charset' type @@ -306,6 +322,7 @@ // Before the redirect, allow modules to react to the end of the page request. module_invoke_all('exit', $url); + drupal_http_status($http_response_code); header('Location: '. $url, TRUE, $http_response_code); // The "Location" header sends a REDIRECT status code to the http @@ -318,7 +335,7 @@ * Generates a site off-line message */ function drupal_site_offline() { - drupal_set_header('HTTP/1.1 503 Service unavailable'); + drupal_http_status(503, 'Service unavailable'); drupal_set_title(t('Site off-line')); print theme('maintenance_page', filter_xss_admin(variable_get('site_offline_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))); @@ -328,8 +345,7 @@ * Generates a 404 error if the request can not be handled. */ function drupal_not_found() { - drupal_set_header('HTTP/1.1 404 Not Found'); - + drupal_http_status(404, 'Not Found'); watchdog('page not found', check_plain($_GET['q']), WATCHDOG_WARNING); // Keep old path for reference @@ -358,7 +374,7 @@ * Generates a 403 error if the request is not allowed. */ function drupal_access_denied() { - drupal_set_header('HTTP/1.1 403 Forbidden'); + drupal_http_status(403, 'Forbidden'); watchdog('access denied', check_plain($_GET['q']), WATCHDOG_WARNING); // Keep old path for reference Index: database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.66.2.1 diff -u -r1.66.2.1 database.mysql.inc --- database.mysql.inc 22 Jan 2007 02:20:50 -0000 1.66.2.1 +++ database.mysql.inc 6 Sep 2007 13:26:15 -0000 @@ -102,7 +102,7 @@ // Show error screen otherwise drupal_maintenance_theme(); - drupal_set_header('HTTP/1.1 503 Service Unavailable'); + drupal_http_status(503, 'Service Unavailable'); drupal_set_title('Unable to connect to database server'); print theme('maintenance_page', '
If you still have to install Drupal, proceed to the installation page.
If you have already finished installed Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can\'t connect to the MySQL database server. This could mean your hosting provider\'s database server is down.
If you still have to install Drupal, proceed to the installation page.
If you have already finished installed Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can\'t connect to the MySQL database server. This could mean your hosting provider\'s database server is down.
If you still have to install Drupal, proceed to the installation page.
If you have already finished installed Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can\'t connect to the PostgreSQL database server. This could mean your hosting provider\'s database server is down.