You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Geoffrey Young <ge...@modperlcookbook.org> on 2002/01/30 19:24:59 UTC
[RFC] Apache::HEADRegistry
well, thanks to Jean-Michel Hiver, we seem to have a winner with the
Apache::Registry HEAD request issue.
http://www.modperlcookbook.org/~geoff/modules/Apache-HEADRegistry-0.01.tar.gz
below is the README. bascially, Apache::HEADRegistry is just a
subclass of Apache::Registry that is HEAD request aware - it lets you
go about your business as usual, but stops writes to the client short
of the actual content if the request is a HEAD request. You ought to
be able to use it as a drop-in replacement for Apache::Registry, with
the usual caveats that come with Apache::RegistryNG over
Apache::Registry.
It seems fairly reasonable, but some additional smoke testing is
always much appreciated. The only problem encountered so far seems to
be redirect scripts, such as
use CGI;
$cgi = new CGI;
print $cgi->redirect ("http://www.foo.com/");
what happens here is that Apache itself processes the redirect as a
custom response and, due to some mod_perl shenanigans, doesn't respect
the r->header_only request.
so, what we seem to have here is a decent attempt at handling HEAD
requests, without altering mod_perl core, that works for all but
redirects (where the actual content is minimal). as I said, additonal
tests are welcome - it's just a beginning effort.
I am also open to other naming schemes, since I hate naming things.
If folks like the idea, I may include an Apache::Test harness for the
module, if I find some spare tuits.
--Geoff
NAME
Apache::HEADRegistry - Apache::Registry drop-in for HEAD requests
SYNOPSIS
httpd.conf:
PerlModule Apache::HEADRegsitry
<Location /perl-bin>
SetHandler perl-script
PerlHandler Apache::HEADRegistry
Options +ExecCGI
PerlSendHeader On
</Location>
DESCRIPTION
Apache::HEADRegistry is a drop-in for Apache::Registry that
properly handles HEAD requests. Currently, Apache::Registry
has no handling of HEAD requests, so mod_cgi and Apache::Registry
scripts do not behave exactly the same. This module attempts
to bridge that gap by intercepting headers much in the way
that mod_perl does, but then obeying the value of $r->header_only.
NOTES
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 yourself and can therefore
check $r->header_only yourself. This module is meant for those
who want mod_cgi emulation only.
FEATURES/BUGS
No known bugs or features at this time, but consider this module
alphaware.
SEE ALSO
perl(1), mod_perl(3), Apache(3), Apache::Registry(3),
Apache::RegistryNG
AUTHOR
Geoffrey Young <ge...@modperlcookbook.org>
COPYRIGHT
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.
HISTORY
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.