Apache::HEADRegistry - Apache::Registry drop-in for HEAD requests
PerlModule Apache::HEADRegsitry <Location /perl-bin> SetHandler perl-script PerlHandler Apache::HEADRegistry Options +ExecCGI PerlSendHeader On </Location>
Apache::HEADRegistry is a drop-in for Apache::Registry that properly handles HEAD requests. Currently, Apache::Registry incorrectly handles HEAD requests - it acts as though they are GET requests, returning both the headers and content. So, not only does represent a way in which mod_cgi and Apache::Registry are different, but Apache::Registry is not RFC compliant and causes trouble with some modern browsers. This module attempts to correct the wrong in Apache::Registry by intercepting headers much in the way that mod_perl does, but then respecting the value of $r->header_only.
Apache::HEADRegistry is a subclass of Apache::RegistryNG, which means that it doesn't behave _exactly_ the same as Apache::Registry. Namely, it uses the filename of the script to determine the unique package namespace, whereas Apache::Registry uses the URI. HEADRegistry also does not do any of the auto-dereferencing in its print() method - if you want that type of thing, then you are obviously relying on the mod_perl API and can therefore check $r->header_only yourself. This module is meant for those who want mod_cgi emulation only.
The only current bug seems to be for scripts that handle redirects, such as:
use CGI; $cgi = CGI->new; print $cgi->redirect ("http://www.foo.com/");
print "Location: http://www.foo.com/";
What happens is that the default Apache 302 error is displayed instead of just the headers. This is a bug both with Apache::Registry and Apache::HEADRegistry and seems to lie with mod_perl and it's internal messing with the $r->assbackwards flag (but I'm not entirely sure).
This module also does not handle write() calls at the moment - if you have a need for that let me know.
perl(1), mod_perl(3), Apache(3), Apache::Registry(3), Apache::RegistryNG
Geoffrey Young <email@example.com>
Copyright (c) 2002, Geoffrey Young. All rights reserved.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
This code is derived in part from examples in the "The mod_perl Developer's Cookbook"
For more information, visit http://www.modperlcookbook.org/
It also contains code lifted from various mod_perl internal sources, such as Apache.pm and mod_perl.c, and LWP. Thanks all for being good open source contributors.