[wp-trac] [WordPress Trac] #17271: WordPress returns a status code 200 when it can't connect to the database
WordPress Trac
wp-trac at lists.automattic.com
Fri May 13 03:23:38 UTC 2011
#17271: WordPress returns a status code 200 when it can't connect to the database
--------------------------+------------------
Reporter: PeteMall | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.2
Component: Database | Version:
Severity: normal | Resolution:
Keywords: needs-patch |
--------------------------+------------------
Changes (by chrisbliss18):
* cc: gaarai@… (added)
Comment:
I also confirm a 500 response code when a database connection cannot be
made.
I don't see any code in core that specifically handles overload conditions
nor do I know how to force one. I'd love to know how to do that for
testing purposes.
With regards to the status code to use on db overload, the way I read the
RFC, it sounds like 503 is appropriate but that it isn't required in an
overload condition. Thus, a generic 500 is perfectly acceptable.
[http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1 RFC
2616] relevant section:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from
fulfilling the request.
...
10.5.4 503 Service Unavailable
The server is currently unable to handle the request due to a temporary
overloading or maintenance of the server. The implication is that this is
a temporary condition which will be alleviated after some delay. If known,
the length of the delay MAY be indicated in a Retry-After header. If no
Retry-After is given, the client SHOULD handle the response as it would
for a 500 response.
Note: The existence of the 503 status code does not imply that a server
must use it when becoming overloaded. Some servers may wish to simply
refuse the connection.
10.5.5 504 Gateway Timeout
The server, while acting as a gateway or proxy, did not receive a timely
response from the upstream server specified by the URI (e.g. HTTP, FTP,
LDAP) or some other auxiliary server (e.g. DNS) it needed to access in
attempting to complete the request.
Note: Note to implementors: some deployed proxies are known to return
400 or 500 when DNS lookups time out.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17271#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list