RFC: add optional HTTP status argument to output_html_with_http_headers
Hi, The bibliographic details scripts can redirect to errors/404.pl if the requested bib is not found. However, when called like this (as opposed to via ErrorDocument), 404.pl actually returns HTTP status 200. Since users may want to permalink to bibs via /cgi-bin/koha/opac-detail.pl?biblionumber=FOO, having 404.pl actually return a 404 status code would help link checkers. Consequently, I propose to modify C4::Output::output_html_with_http_headers to accept an optional fourth parameter, the HTTP status code and text. For example: output_html_with_http_headers $query, $cookie, $template->output, "404"; or output_html_with_http_headers $query, $cookie, $template->output, "404 Bibliographic record not found"; Any thoughts or objections to this? Regards, Galen -- Galen Charlton Koha Application Developer LibLime galen.charlton@liblime.com p: 1-888-564-2457 x709
That sounds like a very good idea. It might be best to have a seperate function like output_error, though, because otherwise each script that raises a 404 will have to deal with it in the template somehow (and most don't; for instance, opac-detail gives some odd error in C4::XSLT). For instance: output_error "404", sprintf("Biblio #%d was not found", $biblionumber); This could have its own template, along the lines of auth.tmpl but with the menus, etc. Just putting 404 in the HTTP status line would be good, but it'd be nice to give some feedback to the user.
Legitimate HTTP codes are good ideas. On Mon, May 19, 2008 at 3:05 PM, Jesse <pianohacker@gmail.com> wrote:
output_error "404", sprintf("Biblio #%d was not found", $biblionumber);
For consistency and differentiation with (recently added) ajax functions in Output, we might want output_html_error (then possibly output_ajax_error). Or keep it output_error, and let the sub check is_ajax (recently added, also) and behave logically. Related question for Galen (amongst others): is there anything currently preventing Output from using C4::Debug? My impression is that there may have been a conflict once, but should not be one presently. --joe
participants (3)
-
Galen Charlton -
Jesse -
Joe Atzberger