Greetings.

Seems I'm confused about how to get mod_perl to send status codes other
than 200 OK.

I want to have my Perl script, upon getting the wrong CGI parameters, to
give a status 404.  Then, the ErrorDocument for 404 goes back to that same
Perl script but with the CGI parameter ?page=error404.

ErrorDocument is currently set up like so:
ErrorDocument 404 /exec/hydrogen.pl?page=error404

This works fine when I'm not having the script generate the 404 error. 
For example, if I visit http://foo/this_page_does_not_exist, then I get
the ?page=error404 error page.  Beautiful.

However, if I access hydrogen.pl?page=this_page_does_not_exist, it needs
to output a 404 status and get on with it.  Presently, I just get a blank
page or IE tells me there is no page.

I'm using ModPerl::Registry, so I can't just return Apache::NOT_FOUND,
which is how I'm apparently supposed to do it, according to what little
documentation I could find.  At the moment, when the Perl script is asked
for a page it can't find, it does this:

$r->status(Apache::NOT_FOUND);
$r->print();
exit;

I have no idea whether this is the right way to do it.  The documentation
on HTTP status codes under mod_perl 2 is quite sparse.

Any thoughts?

Thank you very much.

Colin

-- 
Colin W. Wetherbee
http://hydrogen.denterprises.org/

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to