blib/lib/Apache/Auth/Subrequest.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 45 CC 2 SCAR 10.0
CC
2
Cov
0%
handler
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.7
1 package Apache::Auth::Subrequest;
2 use mod_perl2 ;
3 use Apache2::Access ;
4 use Apache2::RequestRec ;
5 use Apache2::RequestUtil ;
6 use Apache2::Const -compile => qw(HTTP_FORBIDDEN OK) ;
7 use Carp;
8 use strict;
9 use warnings;
10  
11 use version; our $VERSION = qv('0.0.1');
12  
13 =head1 NAME
14  
15 Apache::Auth::Subrequest - Allow only if a Subrequest !
16  
17 =head1 SYNOPSIS
18  
19 PerlModule Apache::Auth::Subrequest
20 <LocationMatch "/z/style/[^/]+/xsl>
21 PerlAccessHandler Apache::Auth::Subrequest
22 </Location>
23  
24 =head1 DESCRIPTION
25  
26 Restrict access control to a site/location/directory that
27  
28 =head1 PROBLEMS
29  
30 This is a very simple approach which allows access to systems from wihtin
31 Apache only. This is useful for original images being resized or XSL being
32 applied.
33  
34 It is howerver not foolproof and should not be trusted. E.g. a module which
35 runs XSL over XML could be used to grab the original XSL itself.
36  
37 This module should also allow the opposite - can't think of a good reason now,
38 but there will be one.
39  
40 =cut
41  
42 sub handler {
43 my ($r) = @_;
44 if ($r->is_initial_req()) {
45 return Apache2::Const::HTTP_FORBIDDEN;
46 }
47 return Apache2::Const::OK;
48 }
49  
50 1;