From: Dan Scott Date: Sun, 28 Dec 2014 01:25:50 +0000 (-0500) Subject: LP1406025 Return 404 or 410 HTTP status codes for bibs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=48cd134555f5744d250daa8988bece4bb91ca403;p=contrib%2FConifer.git LP1406025 Return 404 or 410 HTTP status codes for bibs If a record has been deleted, return a 410 Gone status code; if it doesn't exist at all, return a 404 Not Found code. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 8170b6d141..cf8ea003e4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -1,6 +1,6 @@ package OpenILS::WWW::EGCatLoader; use strict; use warnings; -use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST); +use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_GONE HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST HTTP_NOT_FOUND); use OpenSRF::Utils::Logger qw/$logger/; use OpenILS::Utils::CStoreEditor qw/:funcs/; use OpenILS::Utils::Fieldmapper; @@ -140,6 +140,16 @@ sub load_record { $cstore->kill_me; + # Shortcut and help the machines with a 410 Gone status code + if ($self->ctx->{bib_is_dead}) { + return Apache2::Const::HTTP_GONE; + } + + # Shortcut and help the machines with a 404 Not Found status code + if (!$ctx->{bre_id}) { + return Apache2::Const::HTTP_NOT_FOUND; + } + if ( $ctx->{get_org_setting}-> ($org, "opac.fully_compressed_serial_holdings")