HTTP status code compliance: non-existent and deleted records should return 4xx codes

Bug #1406025 reported by Dan Scott
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned

Bug Description

* Evergreen master and every version with TPAC

Problem: make an HTTP request for a record that is deleted; although the HTML includes the red-bordered message "This record has been deleted", the HTTP status code will be "HTTP/1.1 200 OK". Arguably, this should be 410 Gone (per http://tools.ietf.org/html/rfc2616#section-10.4.11).

Problem: request a record that does not exist, such as http://localhost/eg/opac/record/9999999999999 (assuming that doesn't exist in your system). The TPAC generates an empty HTML record summary page and returns an HTTP status code of "HTTP1/1 200 OK". Arguably, this should be 404 Not Found, and the HTML should indicate that the record in question does not exist.

Tags: pullrequest
Dan Scott (denials)
Changed in evergreen:
milestone: none → 2.next
Revision history for this message
Dan Scott (denials) wrote :

Created http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbs/lp1406025_tpac_http_4xx_codes with a first stab at implementing the 404 / 410 codes in the appropriate circumstances. However, the results are U-G-L-Y for humans; we should enable the TPAC to handle the corresponding problems more elegantly.

Revision history for this message
Dan Scott (denials) wrote :

Added a second commit to the branch which does the dance described at http://search.cpan.org/~phred/mod_perl-2.0.8/docs/api/Apache2/RequestRec.pod#status of setting the status to the error code, then resetting the apache status to OK so that the HTML can be generated as before, rather than the ugly default server error page. The HTTP header still shows the 404 or 410 as desired, so that machines can do the right thing.

We do this only for the known cases of HTTP_NOT_FOUND and HTTP_GONE for records; these status codes are otherwise not thrown by our application.

tags: added: pullrequest
Revision history for this message
Ben Shum (bshum) wrote :

Assigning milestone to 2.8-beta for review. Thanks Dan, looks like a good change!

Changed in evergreen:
milestone: 2.next → 2.8-beta
status: New → Confirmed
Revision history for this message
Ben Shum (bshum) wrote :

Pushed to master for 2.8 beta. Thanks Dan!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.