dougm 01/04/12 18:35:15 Added: t/hooks access.t t/hooks/TestHooks access.pm Log: add PerlAccessHandler test Revision Changes Path 1.1 modperl-2.0/t/hooks/access.t Index: access.t =================================================================== use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestRequest; plan tests => 4, \&have_lwp; my $location = "/TestHooks::access"; ok ! GET_OK $location; my $rc = GET_RC $location; ok $rc == 403; ok GET_OK $location, 'X-Forwarded-For' => '127.0.0.1'; ok ! GET_OK $location, 'X-Forwarded-For' => '666.0.0.1'; 1.1 modperl-2.0/t/hooks/TestHooks/access.pm Index: access.pm =================================================================== package TestHooks::access; use strict; use warnings FATAL => 'all'; use APR::Table (); use Apache::Access (); use Apache::Const -compile => qw(OK FORBIDDEN); my $allowed_ips = qr{^(10|127)\.}; sub handler { my $r = shift; my $fake_ip = $r->headers_in->get('X-Forwarded-For') || ""; return Apache::FORBIDDEN unless $fake_ip =~ $allowed_ips; Apache::OK; } 1; __DATA__ PerlResponseHandler Apache::TestHandler::ok1 SetHandler modperl