Apache-Access-Headers
view release on metacpan or search on metacpan
# $Id: Headers.pm,v 1.5 2003/01/05 04:56:37 jeffo Exp $
package Apache::Access::Headers ;
use strict ;
use Apache ;
use Apache::Constants qw( :common );
use Apache::Log ;
use XML::Simple ;
# thinking of using XML::XPath instead of XML::Simple.
# use XML::XPath ;
use Data::Dumper ;
# version info
$Apache::Access::Headers::VERSION = '0.01' ;
$Apache::Access::Headers::REVISION = '$Revision: 1.5 $' ;
$Apache::Access::Headers::AUTHOR = '$Author: jeffo $' ;
#
# push the child init handler once,
# i.e. when the server is starting
#
if ( $Apache::Server::Starting )
{
Apache->push_handlers(
PerlChildInitHandler => \&_parseConfFile
) ;
}
# variable for storing conf info
# key => path/regexes as keys, value => arrayref of authorizing headers
our %PATH_TO_HEADERS ;
# keys from %PATH_TO_HEADERS
our @PATH_REGEXES ;
# authorizing referers
our @ALLOWED_REFERERS ;
# header prefix for handling modifying proxies
our $HEADER_PREFIX ;
#
# handler for each request
#
sub handler
{
my $r = shift ;
#
# return DECLINED if this is not the initial request
#
return DECLINED if ( ! $r->is_initial_req() ) ;
# grab apache log
my $e = $r->log() ;
# grab the uri of the request
my $uri = $r->uri() ;
$e->debug( "uri => $uri" ) ;
#
# loop through the regex's from the conf file,
# matching against the uri of the request
#
# used to match on value of header
my $value ;
( run in 1.856 second using v1.01-cache-2.11-cpan-d7f47b0818f )