WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 7 weeks ago

#42466 new defect (bug)

HTTP status code is wrong on setup error

Reported by: linyows Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: 2nd-opinion has-patch
Focuses: administration Cc:

Description

Since setup error and http status are not matched, it is necessary to correct it.

Attachments (1)

setup-config.php.patch (964 bytes) - added by linyows 2 months ago.

Download all attachments as: .zip

Change History (5)

#1 @linyows
2 months ago

  • Type changed from enhancement to defect (bug)

#2 @dd32
2 months ago

  • Keywords 2nd-opinion added

A 409 doesn't seem like the correct code here - The 4xx series of codes are a "Client error" (ie. incorrect data sent) which isn't the case here.

A 500 error seems to fit best when looking through the various codes, although a 200 is possibly also the correct response here. The error is a "Sorry, but this isn't usable right now, it looks like your server is already configured" (which makes it sound like a 403 would be correct, but that would also be incorrect as it's not a client error)

#3 @ocean90
2 months ago

  • Keywords has-patch added
  • Version trunk deleted

The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.
https://tools.ietf.org/html/rfc7231#section-6.5.8

Based on the definition I think it's actually an appropriate code.

#4 @linyows
7 weeks ago

I think the server side detects client duplication as it detects file duplication. If the user runs the installer again it is obviously a client error. Also, I think that it is more programmable to match these errors with the message being returned than to put them together as a 500 error.

Note: See TracTickets for help on using tickets.