﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
2409,wordpress errors return status 200,glub,rob1n,"Wordpress notices when a page doesn't exist or the database is down and
returns a human-readable error.  However, the HTTP status code for these
pages remains 200.  This means the page looks like a ""real"" page to
monitoring systems and programs like wget.

This bug is to request a change to the themes/default/404.php file and wp-includes/wp-db.php
file.  Basically wordpress should call the php header() function to set the return
header when there is an error.

Here are the diffs that will accomplish this:

{{{
Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 420)
+++ wp-includes/wp-db.php	(working copy)
@@ -42,6 +42,7 @@
 	function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
 		$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
 		if (!$this->dbh) {
+			header('HTTP/1.0 500 Database Not Available');
 			$this->bail(""
 <h1>Error establishing a database connection</h1>
 <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>. This could mean your host's database server is down.</p>

Index: wp-content/themes/default/404.php
===================================================================
--- wp-content/themes/default/404.php	(revision 420)
+++ wp-content/themes/default/404.php	(working copy)
@@ -1,3 +1,4 @@
+<?php header('HTTP/1.0 404 Not Found'); ?>
 <?php get_header(); ?>
 
 	<div id=""content"" class=""narrowcolumn"">
}}}",defect (bug),closed,normal,2.3,General,2.0.1,normal,fixed,has-patch 2nd-opinion,
