From 2545634200b3af22cc83f97dda1a2a84461db263 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sat, 27 Dec 2014 20:25:50 -0500 Subject: [PATCH] LP#1406025: 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 Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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") -- 2.43.2