1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
#PerlOpmask default
<IfModule mod_dll.c>
LoadModule perl_module modules/ApacheModulePerl.dll
</IfModule>
AddType text/x-server-parsed-html .shtml
AddType text/perl-module .pm
Action text/perl-module /perl/action.pl
PerlPassEnv TEST_PERL_DIRECTIVES
#these three are passed to perl_parse(),
#which happens before <Perl> sections are processed
#optionally, they can be inside <Perl>, however for testing we want
#warnings and taint checks on while processing <Perl>
#besides that, we rely on the PerlScript below to set @INC to our blib
PerlScript docs/startup.pl
PerlScript docs/stacked.pl
#-Tw
PerlTaintCheck On
PerlWarn On
PerlSetVar KeyForPerlSetVar OK
PerlSetEnv KeyForPerlSetEnv OK
<Perl>
#!perl
use Apache ();
use Apache::Registry ();
use Apache::RegistryNG ();
Apache::Server->register_cleanup(sub {
warn "Apache::Server registered cleanup called for $$\n";
});
if($ENV{TEST_PERL_DIRECTIVES}) {
#t/TestDirectives/TestDirectives.pm
push @INC, map { "t/TestDirectives/blib/$_" } qw(arch lib);
require Apache::TestDirectives;
require Apache::ExtUtils;
my $proto_perl2c = Apache::ExtUtils->proto_perl2c;
$PerlConfig .= "YAC yet another\n";
$PerlConfig .= "<Location /perl>\n";
while(my($pp,$cp) = each %$proto_perl2c) {
my $arg = "A";
$pp =~ s/^\$\$//;
1 while $pp =~ s/(\$|\@)/$arg++ . " "/ge;
$PerlConfig .= "$cp $pp\n";
}
$PerlConfig .= <<EOF;
TestCmd one two
AnotherCmd
CmdIterate A B C D E F
</Location>
<Container /for/whatever>
it's
miller
time
#make that a scotch
</Container>
<Location /perl/io>
TestCmd PerlIO IsStdio
</Location>
EOF
}
$My::config_is_perl = 1;
my $dir = $Apache::Server::CWD;
$dir .= "/t"; # if -d "t";
my $Is_Win32 = ($^O eq "MSWin32");
sub prompt ($;$) {
my($mess,$def) = @_;
print "$mess [$def]";
STDIN->untaint;
chomp(my $ans = <STDIN>);
$ans || $def;
}
$ServerRoot = $dir;
$User = $Is_Win32 ? "nobody" : (getpwuid($>) || $>);
$Group = $Is_Win32 ? "nogroup" : (getgrgid($)) || $));
if($User eq "root") {
my $other = (getpwnam('nobody'))[0];
$User = $other if $other;
}
if($User eq "root") {
print "Cannot run tests as User `$User'\n";
$User = prompt "Which User?", "nobody";
$Group = prompt "Which Group?", $Group;
}
print "Will run tests as User: '$User' Group: '$Group'\n";
require 'net/config.pl';
my $srv = $net::httpserver;
($srv = $net::httpserver) =~ s/\D+$//;
$Port = (split ":", $srv, 2)[1];
$Port ||= 8529;
print "Will bind to Port $Port\n";
$DocumentRoot = "$dir/docs";
$ServerName = "localhost";
push @AddType, ["text/x-server-parsed-html" => ".shtml"];
for (qw(/perl /cgi-bin /dirty-perl /perl_xs)) {
push @Alias, [$_ => "$dir/net/perl/"];
}
my @mod_perl = (
SetHandler => "perl-script",
PerlHandler => "Apache::RegistryNG->handler",
Options => "ExecCGI",
);
$Location{"/dirmagic"} = {
PerlHandler => "My::DirIndex",
};
$Location{"/dirty-perl"} = {
SetHandler => "perl-script",
PerlHandler => "Apache::PerlRun",
Options => "+ExecCGI ",
PerlSendHeader => "On",
};
for (qw(perl perl_xs)) {
$Location{"/$_"} = {
@mod_perl,
PerlSetEnv => [KeyForPerlSetEnv => "OK"],
#PerlSetVar => [KeyForPerlSetVar => "OK"],
};
}
for (qw(perl perl_xs)) {
$Location{"/$_/noenv"} = {
@mod_perl,
PerlSetupEnv => "Off",
};
}
$Location{"/cgi-bin"} = {
SetHandler => "cgi-script",
Options => "ExecCGI",
};
$VirtualHost{"localhost"} = {
Location => {
"/perl/io" => {
@mod_perl,
PerlSendHeader => "On",
PerlSetupEnv => "On",
},
"/perl_xs/io" => {
@mod_perl,
PerlSendHeader => "On",
PerlSetupEnv => "On",
},
},
};
#$Location{"/perl/io"} = {
# @mod_perl,
# PerlSendHeader => "On",
# PerlSetupEnv => "On",
#};
for (qw(perl perl_xs)) {
$Location{"/$_/perl-status"} = {
SetHandler => "perl-script",
PerlHandler => "Apache::Status",
};
}
for (qw(status info)) {
$Location{"/server-$_"} = {
SetHandler => "server-$_",
};
}
$ErrorLog = "logs/mod_perl_error_log";
$PidFile = "logs/mod_perl_httpd.pid";
$AccessConfig = $TypesConfig = $ScoreBoardFile = "$dir/docs/null.txt";
$LockFile = "logs/mod_perl.lock";
#push @PerlChildInitHandler, "My::child_init";
#push @PerlChildExitHandler, "My::child_exit";
$Location{"/STAGE"} = {
ErrorDocument => [
[403 => "/stage-redir"],
[404 => "/stage-redir"],
],
};
$Location{"/stage-redir"} = {
@mod_perl,
PerlHandler => "Apache::Stage",
};
$PerlTransHandler = "PerlTransHandler::handler";
$Location{"/chain"} = {
@mod_perl,
PerlHandler => [map { "Stacked::$_" } qw(one two three four)],
};
$Location{"/death"} = {
@mod_perl,
PerlHandler => "Apache::Death",
};
</Perl>
|