Codebase list libapache2-mod-perl2 / 5f4c2cb
[svn-upgrade] Integrating new upstream version, libapache2-mod-perl2 (2.0.3) Damyan Ivanov 16 years ago
296 changed file(s) with 4782 addition(s) and 1903 deletion(s). Raw diff Collapse all Expand all
55
66 Stas Bekman <stas@stason.org>
77 Geoffrey Young <geoff@modperlcookbook.org>
8 Philip M. Gollucci <pgollucci@p6m7g8.com>
89
910 with contributions from the following helpful people
1011 (in alphabetical order):
1314 David Wheeler <david@kineticode.com>
1415 Gary Benson <gbenson@redhat.com>
1516 Ken Williams <ken@forum.swarthmore.edu>
16 Philip M. Gollucci <pgollucci@p6m7g8.com>
1717 Randy Kobes <randy@theoryx5.uwinnipeg.ca>
1818 Rick Myers <rik@sumthin.nu>
1919 Steve Hay <steve.hay@uk.radan.com>
55
66 =over 3
77
8 =item 1.27-dev
8 =item 1.29-dev
9
10 Require a minium of Module::Build 0.18 when using Apache::TestMB.
11 PR: 19513
12 [Philip M. Gollucci]
13
14 Teach Apache::TestClient to encode spaces(' ') in query string of URLs
15 as %20. This is not a full mapping of ASCII to URL encoding.
16 If you need this, install LWP -- then Apache-Test will use
17 LWP -- which does this for you.
18 [Philip M. Gollucci]
19
20 Allow Apache::TestClient which is used when LWP is not installed
21 to accept mutiple headers of the same name.
22 [Philip M. Gollucci]
23
24 Add t_start_error_log_watch() and t_finish_error_log_watch()
25 to the Apache::TestUtil API which are only exported unpon request.
26 [Torsten Foertsch <torsten.foertsch@gmx.net>]
27
28 Allow version variants of debuggers to be passed as arguments
29 to -debug. i.e. -debug=gdb65 for systems with multiple
30 versions of the same debugger. [Philip M. Gollucci]
31
32 On Win32, the Apache executable is called httpd.exe in Apache/2.2,
33 so let Apache::TestConfig try to find that if Apache.exe isn't
34 found [Randy Kobes]
35
36 force reconfiguration if existing configuration was generated
37 by an older version of Apache-Test [Geoffrey Young]
38
39 the -t_pid_file code resulted in confusing and fatal error message
40 for people using stale 1.27 configurations. so take steps to make
41 sure things continue to work. [Geoffrey Young]
42
43
44 =item 1.28 - February 22, 2006
45
46 add need_imagemap() and have_imagemap() to check for mod_imap
47 or mod_imagemap [ Colm MacCárthaigh ]
48
49 shortcuts like need_cgi() and need_php() no longer spit out
50 bogus skip messages [Geoffrey Young]
51
52 Adjust Apache::TestConfig::untaint_path() to handle relative paths
53 that don't start with /. [Stas]
54
55 If perlpath is longer than 62 chars, some shells on certain platforms
56 won't be able to run the shebang line, so when seeing a long perlpath
57 use the eval workaround [Mike Smith <mike@mailchannels.com>]
58
59 Location of the pid file is now configurable via the command line
60 -t_pid_file option [Joe Orton]
61
62 remove the mod_perl.pm entry from %INC after Apache::Test finishes
63 initializing itself. because both mp1 and mp2 share the entry,
64 leaving it around means that Apache::Test might prevent later modules
65 from loading the real mod_perl module they're interested in, leading
66 to bad things [Geoffrey Young]
67
68 use which("cover") to find the cover utility from Devel::Cover and run
69 it only if found. [Stas]
70
71 Devel::Cover magic is now fully integrated. no more modperl_extra.pl
72 or extra.conf.in fiddling - 'make testcover' should be all you need
73 to do now [Geoffrey Young]
74
75 Implemented a magic @NextAvailablePort@ to be used in config files to
76 automatically allocate the next available port [Stas]
77
78 Adjust Apache::TestConfig::add_inc to add lib/ in separate call to
79 lib::->import at the very end of @INC manipulation to ensure it'll be
80 on top of @INC. For some reason lib has changed to add directories in
81 a different order than it did before. [Stas]
82
83
84
85 =item 1.27 - October 20, 2005
986
1087 localize ScriptSock directive to always point to t/logs/cgisock
1188 regardless of inherited and custom mod_cgid settings
123123 my $fh = Symbol::gensym();
124124 open $fh, 'Changes' or die "Can't open Changes: $!";
125125 while (<$fh>) {
126 if(/^=item.*-dev/) {
127 $VERSION .= '-dev';
126 if(/^=item.*-(dev|rc\d+)/) {
127 $VERSION .= "-$1";
128128 last;
129129 }
130130 last if /^=item/;
138138 # it then decides that it's a part of the modperl-2.0 build and
139139 # will try to use modperl httpd/apxs arguments which could be
140140 # unset or wrong
141 if (TOP_LEVEL && -e "../lib/mod_perl.pm") {
141 if (TOP_LEVEL && -e "../lib/mod_perl2.pm") {
142142 error "Do not run 'perl Makefile.PL' when Apache-Test is a " .
143143 "subdirectory of modperl-2.0. Copy it elsewhere and run " .
144144 "from there.";
3030 moderated, so unless you are subscribed to it it may take some time
3131 for your post to make it to the list.
3232
33 For more information see: http://perl.apache.org/docs/Apache-Test/
33 For more information see: http://perl.apache.org/projects/Apache-Test/index.html
3434
3535 List Archives:
3636 # www.apachelabs.org
00 Instructions for Apache-Test Release Manager
1
2 0. Ask the PMC to verify that you have the appropriate CPAN permissions
3 on test-dev@.
14
25 1. 'make dist' - to make sure nothing is missing from the manifest,
36 etc. Now test this generated package (not svn) with as many
47 configurations as possible on as many platforms as possible.
5 Note, in step 3a, removing the "-dev" line changes the package version
6 name. i.e. (1.27-dev to 1.27)
78
8 a. nuke any preinstalled Apache-Test libs and run 'make test'
9 a. edit ./Changes:
10 - change -dev to -rc\d+ starting with -rc1
911
10 b. test that you can 'make install' and then run 'make test' again
12 b. nuke any preinstalled Apache-Test libs and run 'make test'
1113
12 c. test whether we still 100% OK on systems with no LWP:
14 c. test that you can 'make install' and then run 'make test' again
15
16 d. test whether we still 100% OK on systems with no LWP:
1317
1418 % APACHE_TEST_PRETEND_NO_LWP=1 make test
1519
1822 to the various lists
1923
2024 o test-dev/perl.apache.org
21 o test-dev/httpd.apache.org
22 o dev perl/apache.org
25 o dev/perl.apache.org
2326 o modperl/perl.apache.org
27 o dev/httpd.apache.org
2428
2529 (or maybe longer to give most people a chance to catch up). no need
2630 to tag this package
31
32 Subject: [RELEASE CANDIDATE] Apache-Test-1.29 RC\d+
2733
2834 a. if problems are detected during stage 2, repeat stages 1 and 2.
2935
3137 package to be released
3238
3339 a. edit ./Changes:
34 - remove '-dev'
40 - remove -rc\d+
3541 - add release date
3642
3743 b. rerun:
5561 5. Announce the package
5662
5763 a. post ... to the modperl, announce lists
58 Subject: [ANNOUNCE] Apache-Test 1.27
64 Subject: [ANNOUNCE] Apache-Test 1.29
5965 include
6066 - MD5 sig (as it comes from CPAN upload announce).
6167 - the latest Changes
6773 b. edit ./Changes:
6874 - start a new item with incremented version + '-dev'
6975
70 =item 1.28-dev
76 =item 1.30-dev
7177
7278 c. bump up version numbers in this file to make it easier to do the
7379 next release.
7480
75 perl -pi -e 's/\.28/.29/g' RELEASE
76 perl -pi -e 's/\.27/.28/g' RELEASE
77
78 now reload this file and bump up the last number of the first
79 command.
81 $ perl -pi -e 's/(\d+)\.(\d+)/join(".", $1, $2+1)/eg' RELEASE
8082
8183 d. commit Changes
82 % svn ci -m "start 1.27-dev cycle" Changes RELEASE lib/Apache/Test.pm
84 % svn ci -m "start 1.30-dev cycle" Changes RELEASE lib/Apache/Test.pm
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
2121 use Config;
2222 use Apache::TestConfig ();
2323
24 BEGIN {
25 # Apache::Test loads a bunch of mp2 stuff while getting itself
26 # together. because we need to choose one of mp1 or mp2 to load
27 # check first (and we choose mp2) $mod_perl::VERSION == 2.0
28 # just because someone loaded Apache::Test. This Is Bad. so,
29 # let's try to correct for that here by removing mod_perl from
30 # %INC after the above use() statements settle in. nobody
31 # should be relying on us loading up mod_perl.pm anyway...
32
33 delete $INC{'mod_perl.pm'};
34 }
35
2436 use vars qw(@ISA @EXPORT %EXPORT_TAGS $VERSION %SubTests @SkipReasons);
2537
26 $VERSION = '1.27';
38 $VERSION = '1.29';
2739
2840 my @need = qw(need_lwp need_http11 need_cgi need_access need_auth
2941 need_module need_apache need_min_apache_version
3042 need_apache_version need_perl need_min_perl_version
3143 need_min_module_version need_threads need_apache_mpm
32 need_php need_php4 need_ssl);
44 need_php need_php4 need_ssl need_imagemap);
3345
3446 my @have = map { (my $need = $_) =~ s/need/have/; $need } @need;
3547
335347 }
336348
337349 sub need_cgi {
338 need_module('cgi') || need_module('cgid');
350 return _need_multi(qw(cgi cgid));
339351 }
340352
341353 sub need_php {
342 need_module('php4') || need_module('php5') || need_module('sapi_apache2.c');
354 return _need_multi(qw(php4 php5 sapi_apache2.c));
343355 }
344356
345357 sub need_php4 {
346 need_module('php4') || need_module('sapi_apache2.c');
358 return _need_multi(qw(php4 sapi_apache2.c));
347359 }
348360
349361 sub need_access {
350 need_module('access') || need_module('authz_host');
362 return _need_multi(qw(access authz_host));
351363 }
352364
353365 sub need_auth {
354 need_module('auth') || need_module('auth_basic');
366 return _need_multi(qw(auth auth_basic));
367 }
368
369 sub need_imagemap {
370 return need_module("imagemap") || need_module("imap");
371 }
372
373 sub _need_multi {
374
375 my @check = @_;
376
377 my $rc = 0;
378
379 {
380 local @SkipReasons;
381
382 foreach my $module (@check) {
383 $rc ||= need_module($module);
384 }
385 }
386
387 my $reason = join ' or ', @check;
388
389 push @SkipReasons, "cannot find one of $reason"
390 unless $rc;
391
392 return $rc;
355393 }
356394
357395 sub need_apache {
608646 skipped if need_module() returns false (which happens when at least
609647 one C or Perl module from the list cannot be found).
610648
649 Watch out for case insensitive file systems or duplicate modules
650 with the same name. I.E. If you mean mod_env.c
651 need_module('mod_env.c')
652 Not
653 need_module('env')
654
611655 =item * a C<CODE> reference
612656
613657 the tests will be skipped if the function returns a false value. For
698742 plan tests => 5, need_php4;
699743
700744 Requires a PHP version 4 module to be installed.
745
746 =item need_imagemap
747
748 plan tests => 5, need_imagemap;
749
750 Requires a mod_imagemap or mod_imap be installed
701751
702752 =item need_apache
703753
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2002-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
2929 my $CRLF = "\015\012";
3030
3131 sub request {
32 my($method, $url, $headers) = @_;
32 my($method, $url, @headers) = @_;
33
34 my @real_headers = ();
35 my $content;
36
37 for (my $i = 0; $i < scalar @headers; $i += 2) {
38 if ($headers[$i] =~ /^content$/i) {
39 $content = $headers[$i+1];
40 }
41 else {
42 push @real_headers, ($headers[$i], $headers[$i+1]);
43 }
44 }
45
46 ## XXX:
47 ## This is not a FULL URL encode mapping
48 ## space ' '; however is very common, so this
49 ## is useful to convert
50 $url =~ s/ /%20/g;
3351
3452 my $config = Apache::Test::config();
3553
3654 $method ||= 'GET';
3755 $url ||= '/';
38 $headers ||= {};
56 my %headers = ();
3957
4058 my $hostport = Apache::TestRequest::hostport($config);
41 $headers->{Host} = (split ':', $hostport)[0];
59 $headers{Host} = (split ':', $hostport)[0];
4260
4361 my $s = Apache::TestRequest::vhost_socket();
4462
4765 return undef;
4866 }
4967
50 my $content = delete $headers->{'content'};
5168 if ($content) {
52 $headers->{'Content-Length'} ||= length $content;
53 $headers->{'Content-Type'} ||= 'application/x-www-form-urlencoded';
69 $headers{'Content-Length'} ||= length $content;
70 $headers{'Content-Type'} ||= 'application/x-www-form-urlencoded';
5471 }
5572
5673 #for modules/setenvif
57 $headers->{'User-Agent'} ||= 'libwww-perl/0.00';
74 $headers{'User-Agent'} ||= 'libwww-perl/0.00';
5875
5976 my $request = join $CRLF,
6077 "$method $url HTTP/1.0",
61 (map { "$_: $headers->{$_}" } keys %$headers), $CRLF;
78 (map { "$_: $headers{$_}" } keys %headers);
79
80 $request .= $CRLF;
81
82 for (my $i = 0; $i < scalar @real_headers; $i += 2) {
83 $request .= "$real_headers[$i]: $real_headers[$i+1]$CRLF";
84 }
85
86 $request .= $CRLF;
6287
6388 # using send() avoids the need to use SIGPIPE if the server aborts
6489 # the connection
122147 no strict 'refs';
123148 *$method = sub {
124149 my $url = shift;
125 my $headers = { @_ };
126 request($method, $url, $headers);
150 request($method, $url, @_);
127151 };
128152 }
129153
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2002-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
2222 use constant CYGWIN => $^O eq 'cygwin';
2323 use constant NETWARE => $^O eq 'NetWare';
2424 use constant SOLARIS => $^O eq 'solaris';
25 use constant WINFU => WIN32 || CYGWIN || NETWARE;
25 use constant WINFU => WIN32 || NETWARE;
2626 use constant COLOR => ($ENV{APACHE_TEST_COLOR} && -t STDOUT) ? 1 : 0;
2727
2828 use constant DEFAULT_PORT => 8529;
7474 t_dir => 'the t/ test directory (default is $top_dir/t)',
7575 t_conf => 'the conf/ test directory (default is $t_dir/conf)',
7676 t_logs => 'the logs/ test directory (default is $t_dir/logs)',
77 t_pid_file => 'location of the pid file (default is $t_logs/httpd.pid)',
7778 t_conf_file => 'test httpd.conf file (default is $t_conf/httpd.conf)',
7879 src_dir => 'source directory to look for mod_foos.so',
7980 serverroot => 'ServerRoot (default is $t_dir)',
102103 );
103104
104105 my %filepath_conf_opts = map { $_ => 1 }
105 qw(top_dir t_dir t_conf t_logs t_conf_file src_dir serverroot
106 qw(top_dir t_dir t_conf t_logs t_pid_file t_conf_file src_dir serverroot
106107 documentroot bindir sbindir httpd apxs httpd_conf httpd_conf_extra
107108 perlpod sslca libmodperl);
108109
307308 $vars->{sslcaorg} ||= 'asf';
308309 $vars->{t_logs} ||= catfile $vars->{serverroot}, 'logs';
309310 $vars->{t_conf_file} ||= catfile $vars->{t_conf}, 'httpd.conf';
311 $vars->{t_pid_file} ||= catfile $vars->{t_logs}, 'httpd.pid';
310312
311313 if (WINFU) {
312314 for (keys %$vars) {
713715 for my $bindir (qw(bin sbin)) {
714716 my $httpd = catfile $p, $bindir, $vars->{target};
715717 return $httpd if -e $httpd;
718 # The executable on Win32 in Apache/2.2 is httpd.exe,
719 # so try that if Apache.exe doesn't exist
720 if (WIN32) {
721 $httpd = catfile $p, $bindir, 'httpd.EXE';
722 if (-e $httpd) {
723 $vars->{target} = 'httpd.EXE';
724 return $httpd;
725 }
726 }
716727 }
717728 }
718729 }
885896 sub genwarning {
886897 my($self, $filename, $from_filename) = @_;
887898 return unless $filename;
899 my $time = scalar localtime;
888900 my $warning = "WARNING: this file is generated";
889901 $warning .= " (from $from_filename)" if defined $from_filename;
890902 $warning .= ", do not edit\n";
903 $warning .= "generated on $time\n";
891904 $warning .= calls_trace();
892905 return $self->warn_style_sub_ref($filename)->($warning);
893906 }
10231036
10241037 my $fh = $self->genfile($file, undef, 1);
10251038
1026 # shebang
1027 print $fh "#!$Config{perlpath}\n";
1039 my $shebang = make_shebang();
1040 print $fh $shebang;
10281041
10291042 $self->genfile_warning($file, undef, $fh);
10301043
10321045
10331046 close $fh;
10341047 chmod 0755, $file;
1048 }
1049
1050 sub make_shebang {
1051 # if perlpath is longer than 62 chars, some shells on certain
1052 # platforms won't be able to run the shebang line, so when seeing
1053 # a long perlpath use the eval workaround.
1054 # see: http://en.wikipedia.org/wiki/Shebang
1055 # http://homepages.cwi.nl/~aeb/std/shebang/
1056 my $shebang = length $Config{perlpath} < 62
1057 ? "#!$Config{perlpath}\n"
1058 : <<EOI;
1059 $Config{'startperl'}
1060 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
1061 if \$running_under_some_shell;
1062 EOI
1063
1064 return $shebang;
10351065 }
10361066
10371067 sub cpfile {
11101140 }
11111141 }
11121142
1143 my %special_tokens = (
1144 nextavailableport => sub { shift->server->select_next_port }
1145 );
1146
11131147 sub replace {
11141148 my $self = shift;
11151149 my $file = $Apache::TestConfig::File
11171151
11181152 s[@(\w+)@]
11191153 [ my $key = lc $1;
1120 exists $self->{vars}->{$key}
1121 ? $self->{vars}->{$key}
1122 : die "invalid token: \@$1\@ $file\n";
1154 if (my $callback = $special_tokens{$key}) {
1155 $self->$callback;
1156 }
1157 elsif (exists $self->{vars}->{$key}) {
1158 $self->{vars}->{$key};
1159 }
1160 else {
1161 die "invalid token: \@$1\@ $file\n";
1162 }
11231163 ]ge;
11241164 }
11251165
15481588
15491589 $self->preamble_run($out);
15501590
1551 for my $name (qw(user group)) { #win32/cygwin do not support
1591 for my $name (qw(user group)) { #win32
15521592 if ($vars->{$name}) {
15531593 print $out qq[\u$name "$vars->{$name}"\n];
15541594 }
16241664 if (my @env_vars = grep { $ENV{$_} } keys %$passenv) {
16251665 push @reasons, "environment variables (@env_vars) are set";
16261666 }
1667 }
1668
1669 # if the generated config was created with a version of Apache-Test
1670 # less than the current version
1671 {
1672 my $current = Apache::Test->VERSION;
1673 my $config = $self->{apache_test_version};
1674
1675 if (! $config || $config < $current) {
1676 push @reasons, "configuration generated with old Apache-Test";
1677 }
16271678 }
16281679
16291680 return @reasons;
17121763 $self->{_apxs}{$q};
17131764 }
17141765
1715 # Temporarily untaint PATH
1766 # return an untainted PATH
17161767 sub untaint_path {
17171768 my $path = shift;
17181769 ($path) = ( $path =~ /(.*)/ );
17191770 # win32 uses ';' for a path separator, assume others use ':'
17201771 my $sep = WIN32 ? ';' : ':';
17211772 # -T disallows relative and empty directories in the PATH
1722 return join $sep, grep !/^(\.|$)/, split /$sep/, $path;
1773 return join $sep, grep File::Spec->file_name_is_absolute($_),
1774 grep length($_), split /$sep/, $path;
17231775 }
17241776
17251777 sub pop_dir {
17461798 my $apache_test_dir = catdir $top_dir, "Apache-Test";
17471799 unshift @dirs, $apache_test_dir if -d $apache_test_dir;
17481800
1801 lib::->import(@dirs);
1802
17491803 if ($ENV{APACHE_TEST_LIVE_DEV}) {
1804 # add lib/ in a separate call to ensure that it'll end up on
1805 # top of @INC
17501806 my $lib_dir = catdir $top_dir, "lib";
1751 push @dirs, $lib_dir if -d $lib_dir;
1752 }
1753
1754 lib::->import(@dirs);
1807 lib::->import($lib_dir) if -d $lib_dir;
1808 }
1809
17551810 #print join "\n", "add_inc", @INC, "";
17561811 }
17571812
18021857 my($self) = @_;
18031858
18041859 return unless $self->{save};
1860
1861 # add in the Apache-Test version for later comparisions
1862 $self->{apache_test_version} = Apache::Test->VERSION;
18051863
18061864 my $name = 'apache_test_config';
18071865 my $file = catfile $self->{vars}->{t_conf}, "$name.pm";
25332591 interactive config won't be skipped (if needed).
25342592
25352593
2536
2594 =head1 Special Placeholders
2595
2596 When generating configuration files from the I<*.in> templates,
2597 special placeholder variables get substituted. To embed a placeholder
2598 use the C<@foo@> syntax. For example in I<extra.conf.in> you can
2599 write:
2600
2601 Include @ServerRoot@/conf/myconfig.conf
2602
2603 When I<extra.conf> is generated, C<@ServerRoot@> will get replaced
2604 with the location of the server root.
2605
2606 Placeholders are case-insensitive.
2607
2608 Available placeholders:
2609
2610 =head2 Configuration Options
2611
2612 All configuration variables that can be passed to C<t/TEST>, such as
2613 C<MaxClients>, C<DocumentRoot>, C<ServerRoot>, etc. To see the
2614 complete list run:
2615
2616 % t/TEST --help
2617
2618 and you will find them in the C<configuration options> sections.
2619
2620 =head2 NextAvailablePort
2621
2622 Every time this placeholder is encountered it'll be replaced with the
2623 next available port. This is very useful if you need to allocate a
2624 special port, but not hardcode it. Later when running:
2625
2626 % t/TEST -port=select
2627
2628 it's possible to run several concurrent test suites on the same
2629 machine, w/o having port collisions.
25372630
25382631 =head1 AUTHOR
25392632
25502643 ServerRoot "@ServerRoot@"
25512644 DocumentRoot "@DocumentRoot@"
25522645
2553 PidFile @t_logs@/httpd.pid
2646 PidFile @t_pid_file@
25542647 ErrorLog @t_logs@/error_log
25552648 LogLevel debug
25562649
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
346346 cmodule_define($_);
347347 } @cmodule_config_names;
348348
349 my $cmodule_config_extra =
350 "#ifndef APACHE_HTTPD_TEST_EXTRA_HOOKS\n".
351 "#define APACHE_HTTPD_TEST_EXTRA_HOOKS(p) do { } while (0)\n".
352 "#endif\n";
353
349354 my $cmodule_config_hooks = join ",\n ", map {
350355 cmodule_define_name($_);
351356 } @cmodule_config_names;
396401 static void name ## _register_hooks(apr_pool_t *p)
397402 {
398403 @cmodule_hooks
404 APACHE_HTTPD_TEST_EXTRA_HOOKS(p);
399405 }
400406
401407 module AP_MODULE_DECLARE_DATA name ## _module = {
434440 }
435441
436442 print $fh @cmodule_hook_defines, @cmodule_config_defines;
443
444 print $fh $cmodule_config_extra;
437445
438446 print $fh $self->cmodules_module_template;
439447
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
9393
9494 my $dir = catfile $self->{vars}->{t_dir}, lc $path;
9595 my $t = catfile $dir, $file;
96 my $php_t = catfile $dir, $test;
9697 return if -e $t;
9798
98 unless (-e $t) {
99 $self->gendir($dir);
100 my $fh = $self->genfile($t);
101
102 print $fh <<EOF;
99 # don't write out foo.t if foo.php already exists
100 return if -e $php_t;
101
102 $self->gendir($dir);
103 my $fh = $self->genfile($t);
104
105 print $fh <<EOF;
103106 use Apache::TestRequest 'GET_BODY_ASSERT';
104107 print GET_BODY_ASSERT "/$location/$test";
105108 EOF
106109
107 close $fh or die "close $t: $!";
108 }
110 close $fh or die "close $t: $!";
109111
110112 # write out an all.t file for the directory
111113 # that will skip running all PHP test unless have_php
422424 * PROJECT INFORMATION *
423425 * *
424426 * Project: Apache-Test *
425 * URL: http://httpd.apache.org/test/ *
426 * Notice: Copyright (c) 2004 The Apache Software Foundation *
427 * URL: http://perl.apache.org/Apache-Test/ *
428 * Notice: Copyright (c) 2006 The Apache Software Foundation *
427429 * *
428430 *********************************************************************
429431 * LICENSE INFORMATION *
453455 * Originally inspired by work from Andy Lester. Written and *
454456 * maintained by Chris Shiflett. For contact information, see: *
455457 * *
456 * http://shiflett.org/contact *
458 * http://shiflett.org/ *
457459 * *
458460 \*******************************************************************/
459461
460462 header('Content-Type: text/plain');
461463 register_shutdown_function('_test_end');
462464
463 $_no_plan = false;
465 $_no_plan = FALSE;
464466 $_num_failures = 0;
465467 $_num_skips = 0;
466468 $_test_num = 0;
467469
468470 function plan($plan)
469471 {
470 # plan('no_plan');
471 # plan('skip_all');
472 # plan(array('skip_all' => 'My reason is...'));
473 # plan(23);
472 /*
473 plan('no_plan');
474 plan('skip_all');
475 plan(array('skip_all' => 'My reason is...'));
476 plan(23);
477 */
474478
475479 global $_no_plan;
476480 global $_skip_all;
479483 switch ($plan)
480484 {
481485 case 'no_plan':
482 $_no_plan = true;
486 $_no_plan = TRUE;
483487 break;
484488
485489 case 'skip_all':
486490 echo "1..0\n";
487 exit;
488491 break;
489492
490493 default:
510513 if ($_num_skips)
511514 {
512515 $_num_skips--;
513 return true;
514 }
515
516 if (!empty($test_name))
516 return TRUE;
517 }
518
519 if (!empty($test_name) && $test_name[0] != '#')
517520 {
518521 $test_name = "- $test_name";
519522 }
551554 function is($this, $that, $test_name = '')
552555 {
553556 $pass = ($this == $that);
557
554558 ok($pass, $test_name);
555559
556560 if (!$pass)
565569 function isnt($this, $that, $test_name = '')
566570 {
567571 $pass = ($this != $that);
572
568573 ok($pass, $test_name);
569574
570575 if (!$pass)
571576 {
572577 diag(" '$this'");
573 diag(" !=");
578 diag(' !=');
574579 diag(" '$that'");
575580 }
576581
577582 return $pass;
578583 }
579584
580 function like($string, $regex, $test_name = '')
581 {
582 $pass = preg_match($regex, $string);
585 function like($string, $pattern, $test_name = '')
586 {
587 $pass = preg_match($pattern, $string);
588
583589 ok($pass, $test_name);
584590
585591 if (!$pass)
586592 {
587593 diag(" '$string'");
588 diag(" doesn't match '$regex'");
594 diag(" doesn't match '$pattern'");
589595 }
590596
591597 return $pass;
592598 }
593599
594 function unlike($string, $regex, $test_name = '')
595 {
596 $pass = !preg_match($regex, $string);
600 function unlike($string, $pattern, $test_name = '')
601 {
602 $pass = !preg_match($pattern, $string);
603
597604 ok($pass, $test_name);
598605
599606 if (!$pass)
600607 {
601608 diag(" '$string'");
602 diag(" matches '$regex'");
609 diag(" matches '$pattern'");
603610 }
604611
605612 return $pass;
607614
608615 function cmp_ok($this, $operator, $that, $test_name = '')
609616 {
610 eval('$pass = ($this ' . $operator . ' $that);');
617 eval("\$pass = (\$this $operator \$that);");
618
611619 ok($pass, $test_name);
612620
613621 if (!$pass)
621629
622630 function can_ok($object, $methods)
623631 {
624 $pass = true;
632 $pass = TRUE;
625633 $errors = array();
626634
627635 foreach ($methods as $method)
628636 {
629637 if (!method_exists($object, $method))
630638 {
631 $pass = false;
639 $pass = FALSE;
632640 $errors[] = " method_exists(\$object, $method) failed";
633641 }
634642 }
635643
636644 if ($pass)
637645 {
638 ok(true, "method_exists(\$object, ...)");
646 ok(TRUE, "method_exists(\$object, ...)");
639647 }
640648 else
641649 {
642 ok(false, "method_exists(\$object, ...)");
650 ok(FALSE, "method_exists(\$object, ...)");
643651 diag($errors);
644652 }
645653
661669
662670 if ($pass)
663671 {
664 ok(true, "$object_name isa $expected_class");
672 ok(TRUE, "$object_name isa $expected_class");
665673 }
666674 else
667675 {
668 ok(false, "$object_name isn't a '$expected_class' it's a '$got_class'");
676 ok(FALSE, "$object_name isn't a '$expected_class' it's a '$got_class'");
669677 }
670678
671679 return $pass;
673681
674682 function pass($test_name = '')
675683 {
676 return ok(true, $test_name);
684 return ok(TRUE, $test_name);
677685 }
678686
679687 function fail($test_name = '')
680688 {
681 return ok(false, $test_name);
689 return ok(FALSE, $test_name);
682690 }
683691
684692 function diag($message)
719727
720728 for ($i = 0; $i < $num; $i++)
721729 {
722 # FIXME: The pound sign should replace the hyphen
723730 pass("# SKIP $message");
724731 }
725732
726733 $_num_skips = $num;
727734 }
728735
729 # function todo()
730 # {
731 # }
732
733 # function todo_skip()
734 # {
735 # }
736
737 # function is_deeply()
738 # {
739 # }
740
741 # function eq_array()
742 # {
743 # }
744
745 # function eq_hash()
746 # {
747 # }
748
749 # function eq_set()
750 # {
751 # }
736 /*
737
738 TODO:
739
740 function todo()
741 {
742 }
743
744 function todo_skip()
745 {
746 }
747
748 function is_deeply()
749 {
750 }
751
752 function eq_array()
753 {
754 }
755
756 function eq_hash()
757 {
758 }
759
760 function eq_set()
761 {
762 }
763
764 */
752765
753766 function _test_end()
754767 {
766779 diag("Looks like you failed $_num_failures tests of $_test_num.");
767780 }
768781 }
782
769783 ?>
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
144144 close $fh or die "close $t: $!";
145145 }
146146
147 # propogate trace overrides to the server
148 sub configure_trace {
147 # propogate PerlPassEnv settings to the server
148 sub configure_env {
149149 my $self = shift;
150 $self->postamble(IfModule => 'mod_perl.c',
151 "PerlPassEnv APACHE_TEST_TRACE_LEVEL\n");
150 $self->preamble(IfModule => 'mod_perl.c',
151 [ qw(PerlPassEnv APACHE_TEST_TRACE_LEVEL
152 PerlPassEnv HARNESS_PERL_SWITCHES)
153 ]);
152154 }
153155
154156 sub startup_pl_code {
155157 my $self = shift;
156158 my $serverroot = $self->{vars}->{serverroot};
159
160 my $cover = <<'EOF';
161 if (($ENV{HARNESS_PERL_SWITCHES}||'') =~ m/Devel::Cover/) {
162 eval {
163 # 0.48 is the first version of Devel::Cover that can
164 # really generate mod_perl coverage statistics
165 require Devel::Cover;
166 Devel::Cover->VERSION(0.48);
167
168 # this ignores coverage data for some generated files
169 Devel::Cover->import('+inc' => 't/response/',);
170
171 1;
172 } or die "Devel::Cover error: $@";
173 }
174 EOF
157175
158176 return <<"EOF";
159177 BEGIN {
162180 eval { require "conf/\$file" } or
163181 die if grep { -e "\$_/conf/\$file" } \@INC;
164182 }
183
184 $cover
165185 }
166186
167187 1;
536556 my @handler_cfg = ($handler => $module);
537557
538558 if ($outside_container{$handler}) {
539 $self->postamble(@handler_cfg);
559 my $cfg = $self->massage_config_args(@handler_cfg);
560 $self->postamble(IfModule => 'mod_perl.c', $cfg);
540561 } else {
541562 push @args, @handler_cfg;
542563 }
543564 }
544565
545 $self->postamble($self->$container($module), \@args) if @args;
566 if (@args) {
567 my $cfg = $self->massage_config_args($self->$container($module), \@args);
568 $self->postamble(IfModule => 'mod_perl.c', $cfg);
569 }
546570 }
547571
548572 $self->write_pm_test($module, lc $sub, map { lc } @base);
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
109109 sub prune {
110110 my($self, @tests) = @_;
111111 my(@new_tests, %skip_dirs);
112 local $_;
113
114 for (@tests) {
115 next if /\.#/; # skip temp emacs files
116 my $dir = dirname $_;
117 if (m:\Wall\.t$:) {
118 unless ($self->run_t($_)) {
112
113 foreach my $test (@tests) {
114 next if $test =~ /\.#/; # skip temp emacs files
115 my $dir = dirname $test;
116 if ($test =~ m:\Wall\.t$:) {
117 unless ($self->run_t($test)) {
119118 $skip_dirs{$dir} = 1;
120 @new_tests = grep { m:\Wall\.t$: || not $skip_dirs{dirname $_} } @new_tests;
121 push @new_tests, $_;
119 @new_tests = grep { m:\Wall\.t$: ||
120 not $skip_dirs{dirname $_} } @new_tests;
121 push @new_tests, $test;
122122 }
123123 }
124124 elsif (!$skip_dirs{$dir}) {
125 push @new_tests, $_;
125 push @new_tests, $test;
126126 }
127127 }
128128
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15
016 package Apache::TestMB;
117
218 use strict;
319 use vars qw(@ISA);
4 use Module::Build;
20 use Module::Build 0.18;
521 use Apache::Test ();
622 use Apache::TestConfig ();
723 @ISA = qw(Module::Build);
6480
6581 unless ($self->find_module_by_name('Devel::Cover', \@INC)) {
6682 warn("Cannot run testcover action unless Devel::Cover "
67 . "is installed.\n");
83 . "is installed.\n" .
84 "Don't forget to rebuild your Makefile after "
85 . "installing Devel::Cover\n");
6886 return;
6987 }
7088
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
5252 sub test {
5353 my $self = shift;
5454 my $env = Apache::TestConfig->passenv_makestr();
55 my $tests = 'TEST_FILES = ' . (exists $self->{'test'} ? $self->{'test'}->{'TESTS'} : '') . "\n";
55
56 my $tests = "TEST_FILES =\n";
57
58 if (ref $self && exists $self->{'test'}) {
59 $tests = 'TEST_FILES = ' . $self->{'test'}->{'TESTS'} . "\n";
60 }
5661
5762 my $preamble = Apache::TestConfig::WIN32 ? "" : <<EOF;
5863 PASSENV = $env
6368 if (eval { require Devel::Cover }) {
6469 my $atdir = File::Spec->catfile($ENV{HOME}, '.apache-test');
6570
66 $cover = <<"EOF"
67
68 testcover :
69 -\@cover -delete
70 -HARNESS_PERL_SWITCHES=-MDevel::Cover=+inc,$atdir \\
71 APACHE_TEST_EXTRA_ARGS=-one-process \$(MAKE) test
72 -\@cover
73 EOF
71 my $cover_exec = Apache::TestConfig::which("cover");
72
73 my @cover = ("", "testcover :", );
74 push @cover, "\t-\@$cover_exec -delete" if $cover_exec;
75 push @cover, "\t-HARNESS_PERL_SWITCHES=-MDevel::Cover=+inc,$atdir \\",
76 "\tAPACHE_TEST_EXTRA_ARGS=-one-process \$(MAKE) test";
77 push @cover, "\t-\@$cover_exec" if $cover_exec;
78 $cover = join "\n", @cover, "";
7479 }
7580 else {
7681
7883
7984 testcover :
8085 @echo "Cannot run testcover action unless Devel::Cover is installed"
86 @echo "Don't forget to rebuild your Makefile after installing Devel::Cover"
8187 EOF
8288 }
8389
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
330330 $opts->{'run-tests'} = 1;
331331 }
332332 else {
333 #default is server-server run-tests stop-server
333 #default is start-server run-tests stop-server
334334 $opts->{$_} = 1 for @std_run;
335335 }
336336 }
534534 }
535535 else {
536536 warning "server $self->{server}->{name} is not running";
537 # cleanup a stale httpd.pid file if found
538 my $t_logs = $self->{test_config}->{vars}->{t_logs};
539 my $pid_file = catfile $t_logs, "httpd.pid";
537 # cleanup a stale pid file if found
538 my $pid_file = $self->{test_config}->{vars}->{t_pid_file};
540539 unlink $pid_file if -e $pid_file;
541540 }
542541 exit_perl $ok;
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
7272 Apache::TestRun::exit_perl(0);
7373 }
7474
75 $test_config->preamble_register(qw(configure_libmodperl));
75 $test_config->preamble_register(qw(configure_libmodperl
76 configure_env));
7677
7778 $test_config->postamble_register(qw(configure_inc
78 configure_trace
7979 configure_pm_tests_inc
8080 configure_startup_pl
8181 configure_pm_tests));
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
117117
118118 sub pid_file {
119119 my $self = shift;
120 catfile $self->{config}->{vars}->{t_logs}, 'httpd.pid';
120
121 my $vars = $self->{config}->{vars};
122
123 return $vars->{t_pid_file} || catfile $vars->{t_logs}, 'httpd.pid';
121124 }
122125
123126 sub dversion {
265268 $command = qq{ddd --gdb --debugger "gdb -command $file" $httpd};
266269 }
267270 else {
268 $command = "gdb $httpd -command $file";
271 ## defaults to gdb if not set in %ENV or via -debug
272 $command = "$debugger $httpd -command $file";
269273 }
270274
271275 $self->note_debugging;
296300
297301 $opts->{debugger} ||= $ENV{MP_DEBUGGER} || 'gdb';
298302
299 unless ($debuggers{ $opts->{debugger} }) {
303 # XXX: FreeBSD 5.2+
304 # gdb 6.1 and before segfaults when trying to
305 # debug httpd startup code. 6.5 has been proven
306 # to work. FreeBSD typically installs this as
307 # gdb65.
308 # Is it worth it to check the debugger and os version
309 # and die ?
310
311 unless (grep { /^$opts->{debugger}/ } keys %debuggers) {
300312 error "$opts->{debugger} is not a supported debugger",
301313 "These are the supported debuggers: ".
302314 join ", ", sort keys %debuggers;
303315 die("\n");
304316 }
305317
306 my $method = "start_" . $debuggers{ $opts->{debugger} };
318 my $debugger = $opts->{debugger};
319 $debugger =~ s/\d+$//;
320
321 my $method = "start_" . $debuggers{$debugger};
322
323 ## $opts->{debugger} is passed through unchanged
324 ## so when we try to run it next, its found.
307325 $self->$method($opts);
308326 }
309327
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
2525 use File::Basename qw(dirname);
2626 use File::Spec::Functions qw(catfile file_name_is_absolute);
2727 use Symbol ();
28 use Fcntl qw(SEEK_END);
2829
2930 use Apache::Test ();
3031 use Apache::TestConfig ();
3132
3233 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %CLEAN);
3334
34 $VERSION = '0.01';
35 $VERSION = '0.02';
3536 @ISA = qw(Exporter);
3637
3738 @EXPORT = qw(t_cmp t_debug t_append_file t_write_file t_open_file
4142 );
4243
4344 @EXPORT_OK = qw(t_write_perl_script t_write_shell_script t_chown
44 t_catfile_apache t_catfile);
45 t_catfile_apache t_catfile
46 t_start_error_log_watch t_finish_error_log_watch);
4547
4648 %CLEAN = ();
4749
5052 # 5.005's Data::Dumper has problems to dump certain datastructures
5153 use constant HAS_DUMPER => eval { $] >= 5.6 && require Data::Dumper; };
5254 use constant INDENT => 4;
55
56 {
57 my $f;
58 sub t_start_error_log_watch {
59
60 my $name = File::Spec->catfile(Apache::Test::vars->{t_logs}, 'error_log');
61 open $f, "$name" or die "ERROR: Cannot open $name: $!\n";
62 seek $f, 0, SEEK_END;
63
64 return;
65 }
66
67 sub t_finish_error_log_watch {
68
69 local $/ = "\n";
70 my @lines = <$f>;
71 undef $f;
72
73 return @lines;
74 }
75 }
5376
5477 # because of the prototype and recursive call to itself a forward
5578 # declaration is needed
772795 which uses a Unix-style specification with forward slashes for
773796 directory separators. The function is not exported by default.
774797
798 =item t_start_error_log_watch(), t_finish_error_log_watch()
799
800 This pair of functions provides an easy interface for checking
801 the presence or absense of any particular message or messages
802 in the httpd error_log that were generated by the httpd daemon
803 as part of a test suite. It is likely, that you should proceed
804 this with a call to one of the t_*_is_expected() functions.
805
806 t_start_error_log_watch();
807 do_it;
808 ok grep {...} t_finish_error_log_watch()
809
775810 =back
776811
777812 =head1 AUTHOR
0 # Copyright 2001-2005 The Apache Software Foundation or its licensors, as
1 # applicable.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
66 #
77 # http://www.apache.org/licenses/LICENSE-2.0
88 #
0 use Apache::Test;
1
2 plan tests => 1;
3
4 ok (0, 'this test should never run');
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4
5 plan tests => 1, skip_reason('testing all.t');
6
7 ok 1;
0 use Apache::Test;
1
2 plan tests => 1;
3
4 ok (0, 'this test should never run');
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4
5 plan tests => 1, skip_reason('testing more than one all.t');
6
7 ok 1;
0 use strict;
1
2 print "Content-Type: text/plain\n\n";
3 print $ENV{NextAvailablePort} || '';
3535 AllowOverride None
3636 Options +ExecCGI
3737 </Directory>
38
39 # t/next_available_port.t
40 <IfModule mod_env.c>
41 SetEnv NextAvailablePort @NextAvailablePort@
42 </IfModule>
43
3844 </IfModule>
3945
0 # this test tests how a cookie jar can be passed (needs lwp)
1
2 use strict;
3 use warnings FATAL => 'all';
4
5 use Apache::Test;
6 use Apache::TestRequest;
7 use Apache::TestUtil;
8
9 plan tests => 1, need need_cgi, need_module('mod_env.c');
10
11 my $url = '/cgi-bin/next_available_port.pl';
12
13 my $port = GET_BODY($url) || '';
14 ok $port, qr/^\d+$/, "next available port number";
88 Also refer to the Apache::Test changes log file, at Apache-Test/Changes
99
1010 =over 3
11
12 =item 2.0.3 November 28, 2006
13
14 Prevent things in %INC that are not stat() able
15 from breaking Apache2::Status 'Loaded Modules'
16 under fatal warnings.
17 [Philip M. Gollucci <pgollucci@p6m7g8.com>]
18
19 When using MP_AP_PREFIX on WIN32 make sure that its
20 a valid directory.
21 [Nikolay Ananiev <ananiev@thegdb.com>]
22
23 Fix bug concerning 'error-notes' having no value on
24 errordocument redirect.
25 [Guy Albertelli II <guy@albertelli.com>]
26
27 Multi-line $PerlConfig is now working [Gozer]
28
29 PerlOptions None was previously incorrectly reported as invalid
30 inside <VirtualHost> or <Directory> blocks.
31 [Philip M. Gollucci]
32
33 Require B::Size 0.07 and B::TerseSize 0.07 for Apache2::Status
34 [Philip M. Gollucci]
35
36 Apache2::Status was expecting B::TerseSize to return
37 an op count for things that it didn't causing
38 requests like http://localhost/perl-status/main?noh_b_package_size
39 to cause 405s
40 [Philip M. Gollucci]
41
42 Updates for Win32 to allow building and testing on Apache/2.2:
43 - use httpd.exe as the Apache binary name when installing apxs
44 - use new apr library names (libapr-1.lib and libaprutil-1.lib)
45 [Randy Kobes]
46
47 Make sure that additional library paths are included in the build flags
48 so that mod_perl will use the same versions of libraries that APR does.
49 [Mike Smith <mike@mailchannels.com>]
50
51 Added $r->connection->pnotes, identical to $r->pnotes, but
52 for the entire lifetime of the connection
53 [Geoffrey Young, Gozer]
54
55 Fixed problems with add_config() and thread-safety: [Gozer]
56 - $s->add_config is not allowed anymore after server startup
57 - $r->add_config can only affect configuration for the current
58 request, just like .htaccess files do
59
60 Make sure that LIBS and other MakeMaker command line flags are not
61 ignored by the top level Makefile.PL and xs/APR/APR/Makefile.PL [Stas]
62
63 Corrected a typo that would cause the corruption of $), the
64 effective group id as Perl sees it [Gozer]
65
66 Added support for httpd-2.2's new override_opts in Apache2::Access.
67 Calls to add_config() now accept an override_opts value as the 4th
68 argument. [Torsten Foertsch <torsten.foertsch@gmx.net>, Gozer]
69
70 Fix 'PerlSwitches +inherit' that got broken somewhere along
71 the way to 2.0. You can also use 'PerlOptions +InheritSwitches'
72 for the same result. [Gozer]
73
74 Add perl API corresponding to User and Group directives in httpd.conf:
75 Apache2::ServerUtil->user_id and Apache2::ServerUtil->group_id
76 [Stas]
77
78 Apache2::Reload now first unloads all modified modules before
79 trying to reload them. This way, inter-module dependencies
80 are more likely to be correctly satisfied when reloaded
81 [Javier Uruen Val <juruen@warp.es>, Gozer]
82
83 $r->add_config() can now take an optionnal 3rd argument that
84 specifies what pseudo <Location $path> the configuration is
85 evaluated into [Torsten Foertsch <torsten.foertsch@gmx.net>]
86
87 remove -DAP_HAVE_DESIGNATED_INITIALIZER and -DAP_DEBUG from
88 MP_MAINTAINER mode to avoid collisions [Joe Orton]
89
90 Back out r280262 which was causing Apache2::Reload to misbehave.
91 [JT Smith <jt@plainblack.com>]
92
93 Perl_do_open/close fixes to make mod_perl 2.0 compile with
94 blead-perl@25889+ (5.9.3+) [Stas]
95
96 Added Apache2::PerlSections->server, returning the server
97 into which the <Perl> section is defined [Gozer]
98
99 Require B::Size and B::TerseSize v0.06 for Apache2::Status
100 options StatusTerse and StatusTerseSize which has now been
101 updated to support the new mod_perl2 api post RC5.
102 [Philip M. Gollucci]
103
104 When using Apache2::PerlSections->dump, the configuration
105 would print out in the correct order, but when the configuration was
106 passed off to Apache the ordering was lost.
107 [Scott Wessels <swessels@usgn.net>]
11108
12109 =item 2.0.2 - October 20, 2005
13110
4141 Apache-Test/lib/Apache/TestUtil.pm
4242 Apache-Test/lib/Bundle/ApacheTest.pm
4343 Apache-Test/t/TEST.PL
44 Apache-Test/t/alltest/01bang.t
45 Apache-Test/t/alltest/all.t
46 Apache-Test/t/alltest2/01bang.t
47 Apache-Test/t/alltest2/all.t
4448 Apache-Test/t/bad_coding.t
4549 Apache-Test/t/cgi-bin/cookies.pl.PL
50 Apache-Test/t/cgi-bin/next_available_port.pl.PL
4651 Apache-Test/t/conf/extra.conf.in
4752 Apache-Test/t/conf/modperl_extra.pl.in
4853 Apache-Test/t/cookies.t
5156 Apache-Test/t/more/03testpm.t
5257 Apache-Test/t/more/04testmore.t
5358 Apache-Test/t/more/all.t
59 Apache-Test/t/next_available_port.t
5460 Apache-Test/t/ping.t
5561 Apache-Test/t/redirect.t
5662 Apache-Test/t/request.t
119125 ModPerl-Registry/t/conf/extra.conf.in
120126 ModPerl-Registry/t/conf/modperl_extra_startup.pl
121127 ModPerl-Registry/t/dirindex.t
128 ModPerl-Registry/t/fatalstobrowser.t
122129 ModPerl-Registry/t/flush.t
123130 ModPerl-Registry/t/ithreads.t
124131 ModPerl-Registry/t/nph.t
168175 docs/api/Apache2/CmdParms.pod
169176 docs/api/Apache2/Command.pod
170177 docs/api/Apache2/Connection.pod
178 docs/api/Apache2/ConnectionUtil.pod
171179 docs/api/Apache2/Const.pod
172180 docs/api/Apache2/Directive.pod
173181 docs/api/Apache2/Filter.pod
219227 docs/devel/core/mod_perl_specific.pod
220228 docs/devel/core/mpms.pod
221229 docs/devel/debug/c.pod
230 docs/devel/debug/code/.debug-inline
231 docs/devel/debug/code/.debug-modperl-init
232 docs/devel/debug/code/.debug-modperl-register
233 docs/devel/debug/code/.debug-modperl-xs
222234 docs/devel/debug/perl.pod
223235 docs/devel/help/help.pod
224236 docs/devel/performance/size_matters.pod
466478 t/apache/scanhdrs2.t
467479 t/apache/send_cgi_header.t
468480 t/api/access2.t
481 t/api/add_config.t
469482 t/api/content_encoding.t
470483 t/api/custom_response.t
471484 t/api/err_headers_out.t
590603 t/hooks/TestHooks/authz.pm
591604 t/hooks/TestHooks/cleanup.pm
592605 t/hooks/TestHooks/cleanup2.pm
606 t/hooks/TestHooks/error.pm
593607 t/hooks/TestHooks/fixup.pm
594608 t/hooks/TestHooks/headerparser.pm
595609 t/hooks/TestHooks/hookrun.pm
610624 t/hooks/authz.t
611625 t/hooks/cleanup.t
612626 t/hooks/cleanup2.t
627 t/hooks/error.t
613628 t/hooks/hookrun.t
614629 t/hooks/init.t
615630 t/hooks/inlined_handlers.t
619634 t/hooks/stacked_handlers2.t
620635 t/hooks/startup.t
621636 t/hooks/trans.t
637 t/htdocs/TestAPI__add_config/htaccess
622638 t/htdocs/api/auth-groups
623639 t/htdocs/api/auth-users
624640 t/htdocs/api/custom_response.txt
669685 t/modperl/cookie2.t
670686 t/modperl/exit.t
671687 t/modperl/getc.t
688 t/modperl/local_env.t
672689 t/modperl/merge.t
673690 t/modperl/merge2.t
674691 t/modperl/merge3.t
675692 t/modperl/perl_options.t
693 t/modperl/perl_options2.t
694 t/modperl/pnotes.t
676695 t/modperl/post_utf8.t
677696 t/modperl/print_utf8.t
678697 t/modperl/print_utf8_2.t
714733 t/protocol/pseudo_http.t
715734 t/response/TestAPI/access.pm
716735 t/response/TestAPI/access2.pm
736 t/response/TestAPI/add_config.pm
717737 t/response/TestAPI/aplog.pm
718738 t/response/TestAPI/command.pm
719739 t/response/TestAPI/conn_rec.pm
767787 t/response/TestApache/cgihandler.pm
768788 t/response/TestApache/conftree.pm
769789 t/response/TestApache/content_length_header.pm
790 t/response/TestApache/daemon.pm
770791 t/response/TestApache/discard_rbody.pm
771792 t/response/TestApache/post.pm
772793 t/response/TestApache/read.pm
815836 t/response/TestModperl/getc.pm
816837 t/response/TestModperl/io_nested_with_closed_stds.pm
817838 t/response/TestModperl/io_with_closed_stds.pm
839 t/response/TestModperl/local_env.pm
818840 t/response/TestModperl/merge.pm
819841 t/response/TestModperl/method.pm
820842 t/response/TestModperl/methodname.pm
821843 t/response/TestModperl/methodobj.pm
822844 t/response/TestModperl/perl.pm
823845 t/response/TestModperl/perl_options.pm
846 t/response/TestModperl/perl_options2.pm
824847 t/response/TestModperl/pnotes.pm
825848 t/response/TestModperl/post_utf8.pm
826849 t/response/TestModperl/print.pm
922945 xs/Apache2/CmdParms/Apache2__CmdParms.h
923946 xs/Apache2/Command/Apache2__Command.h
924947 xs/Apache2/Connection/Apache2__Connection.h
948 xs/Apache2/ConnectionUtil/Apache2__ConnectionUtil.h
925949 xs/Apache2/Const/Const.pm
926950 xs/Apache2/Const/Const.xs
927951 xs/Apache2/Const/Makefile.PL
289289 exit(1);
290290 }
291291
292 printf "Configuring Apache/%s mod_perl2/%s Perl/v%vd\n",
292 printf "Configuring Apache/%s mod_perl/%s Perl/v%vd\n",
293293 $httpd_version, $VERSION, $^V;
294294
295295 my $apr_config = $build->get_apr_config; #cache it
479479
480480 open my $fh, 'Changes';
481481 while (<$fh>) {
482 if (/^=item.*-dev/) {
483 $VERSION .= '-dev';
482 if (/^=item.*-(dev|rc\d+)/) {
483 $VERSION .= "-$1";
484484 last;
485485 }
486486 last if /^=item/;
815815
816816 tag :
817817 svn copy https://svn.apache.org/repos/asf/perl/modperl/trunk https://svn.apache.org/repos/asf/perl/modperl/tags/$(VERSION_SYM)
818 svn copy https://svn.apache.org/repos/asf/perl/modperl/docs/trunk https://svn.apache.org/repos/asf/perl/modperl/docs/tags/$(VERSION_SYM)
818819 @$(ECHO) update mod_perl2.pm VERSION now
819820 EOF
820821
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4 use Apache::TestUtil qw(
5 t_cmp t_write_perl_script
6 t_client_log_error_is_expected
7 );
8 use Apache::TestRequest qw(GET);
9
10 use File::Spec::Functions qw(catfile);
11
12 plan tests => 4, need need_module(qw(mod_alias)),
13 need_cgi,
14 need_min_module_version CGI => 99.99,
15 skip_reason('fatalsToBrowser known not to work');
16
17 my $file = catfile(Apache::Test::vars('serverroot'),
18 qw(cgi-bin fatalstobrowser.pl));
19
20 t_write_perl_script($file, <DATA>);
21
22 foreach my $base (qw(cgi-bin registry)) {
23
24 my $url = "$base/fatalstobrowser.pl";
25 my $res = GET $url;
26
27 ok t_cmp($res->code,
28 200,
29 "error intercepted");
30
31 t_client_log_error_is_expected();
32
33 ok t_cmp($res->content,
34 qr/uninitiated_scalar/,
35 "error message captured and returned");
36 }
37
38 __END__
39 use strict;
40 use CGI::Carp qw (fatalsToBrowser);
41
42 use CGI;
43
44 my $cgi = new CGI;
45 print $cgi->header;
46
47 print "$uninitiated_scalar";
48
49 print "Hello World";
0 This is mod_perl version 2.0-tobe
0 This is mod_perl version 2.0
11
22 *** Prerequisites ***
33
44 Apache:
5 Dynamic mod_perl (DSO): Apache 2.0.47 - 2.0.55.
6 Static mod_perl: Apache 2.0.51 - 2.0.55.
5 Dynamic mod_perl (DSO): Apache 2.0.47 - 2.0.59.
6 Static mod_perl: Apache 2.0.51 - 2.0.59.
77
88 Newer Apache versions may work with this version of mod_perl. If
99 not, the svn version likely will, which can be obtained from:
4141
4242 *** Todo ***
4343
44 mod_perl-2.0-tobe is not 100% feature complete with the 1.xx version.
44 mod_perl-2.0 is not 100% feature complete with the 1.xx version.
4545 See the files in the todo/ directory for what remains to be done. Some
4646 of those features will be implemented after 2.0 is released. The goal
4747 is to empty the file todo/release and document/test/verify the API
6666 *** Authors ***
6767
6868 mod_perl-2.0 was designed and written by Doug MacEachern, with
69 contributions from many others (see the CREDITS and Changes files).
69 contributions from many others (see Changes files).
3030 assuming you have already been granted commit access to the repository,
3131 you should follow the following steps to checkout mod_perl
3232
33 $ ssh svn.apache.org svnpasswd
33 Change your password via:
34 https://svn.apache.org/change-password
35
3436 $ svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0
3537
3638 if you want to test that your commit access is working, this file is
1212
1313 http://people.apache.org/~geoff/gpghowto.html
1414
15 Copy the KEYS file into place:
16 % scp KEYS www.apache.org:/www/www.apache.org/dist/perl/KEYS
17
18 If this is your first release, ask someone with APML karma on PAUSE
19 to verify you have the appropriate permissions. Likely someone on
20 the PMC can do this.
21
22 a. login into https://pause.perl.org
23 b. menu click: Select Mailinglist/Action
24 c. choose APML and share_perms and click go
25 d. click 3.1 Make somebody else co-maintainer
26 e. choose the modules to give the perms to
27 type the username of the new co-maintainer
28 f. if you happen to know that packages were added this release,
29 make sure you give the correct permissions to them.
30
1531 1. 'make dist' - to make sure nothing is missing from the manifest,
16 etc. Now test this generated package mod_perl-2.0.2.tar.gz (not
32 etc. Now test this generated package mod_perl-2.0.3.tar.gz (not
1733 the current build) with as many
1834 configurations as possible on as many platforms as possible,
1935 unpacking the package each time afresh.
20 Note, in step 3a, removing the "-dev" line changes the package version
21 name. i.e. (2.0.2-dev to 2.0.2)
22
23 a. nuke any preinstalled mod_perl libs and run 'make test'
24
25 b. test that you can 'make install' and then run 'make test' again
26
27 c. test whether we still 100% OK on systems with no LWP:
36
37 a. edit ./Changes
38 - change -dev to -rc\d+ starting with -rc1
39
40 b. nuke any preinstalled mod_perl libs and run 'make test'
41
42 c. test that you can 'make install' and then run 'make test' again
43
44 d. test whether we still 100% OK on systems with no LWP:
2845
2946 % APACHE_TEST_PRETEND_NO_LWP=1 make test
3047
31 d. build and test as root. double check that you have started from a
48 e. build and test as root. double check that you have started from a
3249 fresh source, without having any stale dirs from the previous
3350 build laying around.
3451
3754 to the modperl/dev list (may be longer to give most people a chance
3855 to catch up). no need to tag this package
3956
57 Subject: [RELEASE CANDIDATE]: mod_perl-2.0.3 RC\d+
58
4059 2a. if problems are detected during stage 2, repeat stages 1 and 2.
4160
4261 3. when the package has been reported to be good, prepare a new
4362 package to be released
4463
4564 a. edit ./Changes:
46 - remove '-dev'
65 - remove -rc\d+
4766 - add release date
4867
4968 b. check ./README and ./Makefile.PL
6079 e. tag
6180 % make tag
6281
63 f. create the final package
82 f. Update the svn:externals in the new tag
83 (you can't propedit remotely yet in svn)
84 svn co https://svn.apache.org/repos/asf/perl/tags/2_0_3
85 svn propedit svn:xternals 2_0_3
86 Update the Apache-Test line to the tag you previously created.
87 Update the docs line to the current tag.
88 svn ci
89
90 g. create the final package
6491 % make dist
6592
66 g. test the final package again at least once
67
68 4. Release the package and update links (e.g. mod_perl-2.0.2.tar.gz)
93 h. test the final package again at least once
94
95 4. Release the package and update links (e.g. mod_perl-2.0.3.tar.gz)
6996
7097 a. upload to www.apache.org:/www/perl.apache.org/dist/
7198
72 % scp mod_perl-2.0.2.tar.gz perl.apache.org:/www/perl.apache.org/dist/
99 % scp mod_perl-2.0.3.tar.gz perl.apache.org:/www/perl.apache.org/dist/
73100
74101 b. ssh to perl.apache.org, unpack the package, update symlinks to the
75102 tar ball and unpacked distro:
76103
77104 % ssh perl.apache.org
78105 % cd /www/perl.apache.org/dist/
79 % ln -sf mod_perl-2.0.2.tar.gz mod_perl-2.0-current.tar.gz
80 % tar -xzvf mod_perl-2.0.2.tar.gz
106 % ln -sf mod_perl-2.0.3.tar.gz mod_perl-2.0-current.tar.gz
107 % tar -xzvf mod_perl-2.0.3.tar.gz
81108 % rm /www/perl.apache.org/dist/mod_perl-2.0-current
82 % ln -sf mod_perl-2.0.2 mod_perl-2.0-current
109 % ln -sf mod_perl-2.0.3 mod_perl-2.0-current
83110
84111 c. archive older releases (keep current + one prior release)
85112
96123
97124 % /home/perlwww/apache.org/modperl-docs/bin/site_build
98125
126 e. update our projects.apache.org doap file with the new release
127 version and date
128
129 % vi modperl-docs/doap_Perl.rdf
130
99131 5. Upload the package to CPAN
100132
101133 6. Tarball signing
105137
106138 a. sign your local copy of the tarball:
107139
108 % gpg --detach-sign --armor mod_perl-2.0.2.tar.gz
109
110 % pgps -b --armor mod_perl-2.0.2.tar.gz
140 % gpg --detach-sign --armor mod_perl-2.0.3.tar.gz
141
142 % pgps -b --armor mod_perl-2.0.3.tar.gz
111143
112144 b. upload the generated sig file to www.apache.org:
113145
114 % scp mod_perl-2.0.2.tar.gz.asc perl.apache.org:/www/perl.apache.org/dist/
146 % scp mod_perl-2.0.3.tar.gz.asc perl.apache.org:/www/perl.apache.org/dist/
115147 % ssh www.apache.org
116148 % cd /www/perl.apache.org/dist/
117 % chmod 0664 mod_perl-2.0.2.tar.gz.asc
118 % ln -sf mod_perl-2.0.2.tar.gz.asc mod_perl-2.0-current.tar.gz.asc
149 % chmod 0664 mod_perl-2.0.3.tar.gz.asc
150 % ln -sf mod_perl-2.0.3.tar.gz.asc mod_perl-2.0-current.tar.gz.asc
119151
120152 c. ask one of the other developers to double check the signature file
121153 and tarball: download both files and verify the signature:
122154
123 http://perl.apache.org/dist/mod_perl-2.0.2.tar.gz.asc
124 http://perl.apache.org/dist/mod_perl-2.0.2.tar.gz
125
126 % gpg --verify mod_perl-2.0.2.tar.gz.asc
127
128 % pgpv mod_perl-2.0.2.tar.gz.asc
155 http://perl.apache.org/dist/mod_perl-2.0.3.tar.gz.asc
156 http://perl.apache.org/dist/mod_perl-2.0.3.tar.gz
157
158 % gpg --verify mod_perl-2.0.3.tar.gz.asc
159
160 % pgpv mod_perl-2.0.3.tar.gz.asc
129161
130162 d. make sure that the files you just created are group rw so
131163 all the dist admins can make changes:
139171 a. unpack the package, update symlinks to the tarball and unpacked distro:
140172
141173 % cd /www/www.apache.org/dist/perl/
142 % cp /www/perl.apache.org/dist/mod_perl-2.0.2.tar.gz* .
143 % tar -xzvf mod_perl-2.0.2.tar.gz
174 % cp /www/perl.apache.org/dist/mod_perl-2.0.3.tar.gz* .
175 % tar -xzvf mod_perl-2.0.3.tar.gz
144176 % mv mod_perl-2.0.0.tar.gz* /www/archive.apache.org/dist/perl/
145177 % rm -rf mod_perl-2.0.0
146178
154186 8. Announce the package
155187
156188 a. post ... to the modperl, announce lists
157 Subject: [ANNOUNCE] mod_perl 2.0.2
189 Note, to post to announce@, you must be sending from an apache.org address.
190 Subject: [ANNOUNCE] mod_perl 2.0.3
158191 include
159192 - link at perl.apache.org:
160 http://apache.org/dist/perl/mod_perl-2.0.2.tar.gz
161 http://apache.org/dist/perl/mod_perl-2.0.2.tar.gz.asc (pgp sig)
193 http://apache.org/dist/perl/mod_perl-2.0.3.tar.gz
194 http://apache.org/dist/perl/mod_perl-2.0.3.tar.gz.asc (pgp sig)
162195 - MD5 sig (as it comes from CPAN upload announce).
163196 - the latest Changes
164197
176209 d. update this file versions to make it easy to copy-n-paste things
177210 on the next release:
178211
179 perl -pi -e 's/2.0.0/2.0.0/g' RELEASE
180 perl -pi -e 's/2.0.3/2.0.3/g' RELEASE
181 perl -pi -e 's/2.0.2/2.0.3/g' RELEASE
182 perl -pi -e 's/2.0.1/2.0.2/g' RELEASE
183 perl -pi -e 's/2.0.0/2.0.1/g' RELEASE
184 perl -ni -e 'print unless /2.0.0/' RELEASE
185
186 now reload this file and bump up the last number of the first
187 two commands.
212 $ perl -pi -e 's/(\d+)\.(\d+)\.(\d+)/join(".", $1, $2, $3+1)/eg' RELEASE
188213
189214 e. commit the changed files
190215
00 mod_perl 2.0 STATUS: -*-text-*-
1 Last modified at [$Date: 2005-06-17 16:53:37 -0400 (Fri, 17 Jun 2005) $]
1 Last modified at [$Date: 2005-10-20 18:43:55 -0700 (Thu, 20 Oct 2005) $]
22
33 Release:
44 --------
5 2.000.02 : Released Oct 20, 2005
56 2.000.01 : Released Jun 17, 2005
67 2.000.00 : Released May 20, 2005
78 1.999.23 : Released May 03, 2005
00 #!perl
1 # Copyright 2003-2005 The Apache Software Foundation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
67 #
78 # http://www.apache.org/licenses/LICENSE-2.0
89 #
55 my $dev_build = is_dev_build();
66 my $release = $dev_build ? svn_release() : 1;
77 my $version = $mod_perl2::VERSION_TRIPLET;
8 my $path = $dev_build ? "mod_perl-$version-dev" : "mod_perl-$version";
8 my $path = $dev_build ? "mod_perl-$version-$dev_build" : "mod_perl-$version";
99 my $tarname = "$path.tar.gz";
1010
1111 my $httpd_ver = min_httpd_ver();
134134 my $dev;
135135 open my $fh, 'Changes';
136136 while (<$fh>) {
137 if (/^=item.*-dev/) {
138 $dev = 1;
137 if (/^=item.*-(dev|rc\d+)/) {
138 $dev = $1;
139139 last;
140140 }
141141 last if /^=item/;
00 #!/bin/bash
11 # automatic SVN merging
2 #
3 # when used for the first time, first run:
4 # svn propset merge-point $revision
5 # where $revision is the rev number when a branch was made
26
3 root=`svn info . | sed -n '/^URL/{s,/branches/.*,,;s/^URL: //;p}'`
7 root=`svn info . | perl -007 -ne 'm|URL: (.*?)/branches|s and print $1'`
48 trunk=${root}/trunk
59
610 # svn 1.2.x supports "svn info URL". Without that, a stupid
711 # ls command is needed to find the current revision of the trunk
812 #next=`svn info $trunk | sed -n '/^Revision: /{s/.*: //g;p}'`
913
10 next=`svn ls --verbose $root | sed -n '/ trunk/{s/^ *//g;s/ .*//g;p}'`
14 next=`svn ls --verbose $root | perl -ne 'm|^\s+(\d+).*trunk/$| and print $1'`
1115 last=`svn propget merge-point .`
1216
1317 echo "$0: merging from trunk from r$last to r$next"
5858 my $ans = prompt('Install apxs now?', 'yes');
5959 exit 0 unless $ans =~ /^y/i;
6060
61 my $prog;
62 for my $trial(qw(Apache.exe httpd.exe)) {
63 next unless -e File::Spec->catfile($prefix, 'bin', $trial);
64 $prog = $trial;
65 last;
66 }
67 die "Could not determine the Apache2 binary name" unless $prog;
68
6169 require LWP::Simple;
6270 LWP::Simple->import(qw(is_success getstore));
6371
8088 print "chdir $dir\n";
8189 chdir $dir or die "chdir to $dir failed: $!";
8290
83 my @args = ($^X, 'Configure.pl', "--with-apache2=$prefix");
91 my @args = ($^X, 'Configure.pl',
92 "--with-apache2=$prefix",
93 "--with-apache-prog=$prog");
8494 print "@args\n";
8595 system(@args) == 0 or die "system @args failed: $?";
8696
33 mp2 Utilities need to be documented (a separate document?):
44
55 mp2bug - (should also be mentioned in user/help/help.pod)
6
7 mp2doc - replacement for perldoc for modules that get installed into Apache2/
86
97 *** General items ***
108
3434 use it with mod_perl 2.0. For example to get a random unique string
3535 you could call:
3636
37 % perl -MApache2 -MAPR::UUID -le 'print APR::UUID->new->format'
37 % perl -MAPR::UUID -le 'print APR::UUID->new->format'
3838
3939
4040
1818
1919 # Apache AllowOverride value
2020 $allow_override = $r->allow_overrides();
21
22 # which Options are allowed by AllowOverride (since Apache 2.2)
23 $allow_override_opts = $r->allow_override_opts();
2124
2225 # auth name ("foo bar")
2326 $auth_name = $r->auth_name();
192195 use Apache2::Const -compile => qw(:override);
193196 $r->allow_overrides & Apache2::Const::OR_AUTHCFG; # TRUE
194197 $r->allow_overrides & Apache2::Const::OR_LIMIT; # FALSE
198
199
200
201
202
203
204 =head2 C<allow_override_opts>
205
206 Retrieve the bitmask of allowed C<Options> set by C<AllowOverride Options=...>
207 for this request
208
209 $override_opts = $r->allow_override_opts();
210
211 Enabling single options was introduced in Apache 2.2. For Apache 2.0 this
212 function returns
213 C<L<Apache2::Const::OPT_UNSET|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_UNSET_>> |
214 C<L<Apache2::Const::OPT_ALL|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_ALL_>> |
215 C<L<Apache2::Const::OPT_INCNOEXEC|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_INCNOEXEC_>> |
216 C<L<Apache2::Const::OPT_SYM_OWNER|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_SYM_OWNER_>> |
217 C<L<Apache2::Const::OPT_MULTI|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_MULTI_>>,
218 which corresponds to the default value (if not set) for Apache 2.2.
219
220 =over 4
221
222 =item obj: C<$r>
223 ( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
224
225 The current request
226
227 =item ret: C<$override_opts> ( integer )
228
229 the override options bitmask. Normally used with bitlogic operators
230 against C<L<Apache2::Const :options
231 constants|docs::2.0::api::Apache2::Const/C__options_>>.
232
233 =item since: 2.0.3
234
235 =back
236
237 For example if the configuration for the current request was:
238
239 AllowOverride Options=Indexes,ExecCGI
240
241 The following applies:
242
243 use Apache2::Const -compile => qw(:options);
244 $r->allow_override_opts & Apache2::Const::OPT_EXECCGI; # TRUE
245 $r->allow_override_opts & Apache2::Const::OPT_SYM_LINKS; # FALSE
195246
196247
197248
4646
4747 # which allow-override bits are set
4848 $override = $parms->override;
49
50 # which Options are allowed by AllowOverride (since Apache 2.2)
51 $override = $parms->override_opts;
4952
5053 # the path this command is being invoked in
5154 $path = $parms->path;
312315
313316
314317
318 =head2 C<override_opts>
319
320 Which options are allowed to be overridden by C<.htaccess> files. This is
321 set by C<AllowOverride Options=...>.
322
323 $override_opts = $parms->override_opts;
324
325 Enabling single options was introduced with Apache 2.2. For Apache 2.0 this
326 function simply returns a bitmask with all options allowed.
327
328 =over 4
329
330 =item obj: C<$parms>
331 ( C<L<Apache2::CmdParms object|docs::2.0::api::Apache2::CmdParms>> )
332
333 =item ret: C<$override_opts> ( bitmask )
334
335 the bitmask, which can be tested against
336 C<L<Apache2::Const :options
337 constants|docs::2.0::api::Apache2::Const/C__override_>>.
338
339 =item since: 2.0.3
340
341 =back
342
343
344
345
346
347
348
315349 =head2 C<path>
316350
317351 The current pathname/location/match of the block this command is in
77 =head1 Synopsis
88
99 use Apache2::Connection ();
10
10 use Apache2::RequestRec ();
11
12 my $c = $r->connection;
13
14 my $c = $r->connection;
1115 # is connection still open?
1216 $status = $c->aborted;
1317
0 =head1 NAME
1
2 Apache2::ConnectionUtil - Perl API for Apache connection utils
3
4
5
6
7 =head1 Synopsis
8
9 use Apache2::Connection ();
10 use Apache2::ConnectionUtil ();
11 use Apache2::RequestRec ();
12
13 # grab the connection object;
14 my $c = $r->connection;
15
16 # share perl objects like $r->pnotes
17 $old_val = $c->pnotes($key => $value);
18
19
20
21
22
23
24 =head1 Description
25
26 C<Apache2::ConnectionUtil> provides the
27 L<Apache connection record object|docs::2.0::api::Apache2::Connection>
28 utilities API.
29
30
31
32
33
34 =head1 API
35
36 C<Apache2::ConnectionUtil> provides the following functions and/or
37 methods:
38
39
40
41
42
43
44
45
46 =head2 C<pnotes>
47
48 Share Perl variables between requests over the lifetime of the
49 connection.
50
51 $old_val = $c->pnotes($key => $val);
52 $val = $c->pnotes($key);
53 $hash_ref = $c->pnotes();
54
55
56
57 =over 4
58
59 =item obj: C<$c>
60 ( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )
61
62 =item opt arg1: C<$key> ( string )
63
64 A key value
65
66 =item opt arg2: C<$val> ( SCALAR )
67
68 Any scalar value (e.g. a reference to an array)
69
70 =item ret: (3 different possible values)
71
72 if both, C<$key> and C<$val> are passed the previous value for C<$key> is
73 returned if such existed, otherwise undef is returned.
74
75 if only C<$key> is passed, the current value for the given key is returned.
76
77 if no arguments are passed, a hash reference is returned, which can then
78 be directly accessed without going through the C<pnotes()> interface.
79
80 =item since: 2.0.3
81
82 =back
83
84 See
85 (C<L<Apache2::RequestUtil::pnotes|docs::2.0::api::Apache2::RequestUtil/C_pnotes_>>)
86 for the details of the C<pnotes> method usage. The usage is identical
87 except for a few differences. First is the use of C<$c> instead of
88 C<$r> as
89 the invocant. The second is that the the data persists for the lifetime of
90 the connection instead of the lifetime of the request. If the connection is
91 lost, so is the data stored in C<pnotes>.
92
93
94
95 =head1 See Also
96
97 L<Apache2::Connection|docs::2.0::api::Apache2::Connection>.
98
99 L<Apache2::RequestUtil::pnotes|docs::2.0::api::Apache2::RequestUtil/C_pnotes_>.
100
101 L<mod_perl 2.0 documentation|docs::2.0::index>.
102
103
104 =head1 Copyright
105
106 mod_perl 2.0 and its core modules are copyrighted under
107 The Apache Software License, Version 2.0.
108
109
110
111
112 =head1 Authors
113
114 L<The mod_perl development team and numerous
115 contributors|about::contributors::people>.
116
117 =cut
118
119
25822582
25832583 L<mod_perl 2.0 documentation|docs::2.0::index>.
25842584
2585
2585 L<HTTP Status Codes|docs::2.0::user::handlers::http/HTTP_Status_Codes>.
25862586
25872587
25882588 =head1 Copyright
356356
357357 is the same as:
358358
359 $s->log_error(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING,
360 APR::Const::SUCCESS, @warnings)
359 $s->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING,
360 APR::Const::SUCCESS, @warnings)
361361
362362 =over 4
363363
526526
527527 is the same as:
528528
529 $r->log_error(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING,
530 APR::Const::SUCCESS, @warnings)
529 $r->log_rerror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING,
530 APR::Const::SUCCESS, @warnings)
531531
532532 =over 4
533533
745745 object.
746746
747747 Inside HTTP request handlers this is possible via
748 C<Apache2-E<gt>request|docs::2.0::api::Apache2::RequestUtil/C_request_>. Which
749 requires either C<L<PerlOptions
748 C<L<Apache2-E<gt>request|docs::2.0::api::Apache2::RequestUtil/C_request_>>.
749 Which requires either C<L<PerlOptions
750750 +GlobalRequest|docs::2.0::user::config::config/C_GlobalRequest_>>
751751 setting or can be also done at runtime if C<$r> is available:
752752
107107 }
108108 </Perl>
109109
110
111
112
113
114 =head1 API
115
116 C<Apache2::PerlSections> provides the following functions and/or methods:
117
118
119 =head2 C<server>
120
121 Get the current server's object for the E<lt>PerlE<gt> section
122
123 <Perl>
124 $s = Apache2::PerlSections->server();
125 </Perl>
126
127 =over 4
128
129 =item obj: C<Apache2::PerlSections> (class name)
130
131 =item ret: C<$s>
132 ( C<L<Apache2::ServerRec object|docs::2.0::api::Apache2::ServerRec>> )
133
134 =item since: 2.0.03
135
136 =back
110137
111138
112139
162162
163163 =head1 Performance Issues
164164
165 This modules is perfectly suited for a development environment. Though
165 This module is perfectly suited for a development environment. Though
166166 it's possible that you would like to use it in a production
167167 environment, since with C<Apache2::Reload> you don't have to restart
168168 the server in order to reload changed modules during software
107107
108108 $r->add_config($lines);
109109 $r->add_config($lines, $override);
110 $r->add_config($lines, $override, $path);
111 $r->add_config($lines, $override, $path, $override_opts);
112
113 Configuration directives are processed as if given in a C<E<lt>LocationE<gt>>
114 block.
110115
111116 =over 4
112117
118123 An ARRAY reference containing configuration lines per element, without
119124 the new line terminators.
120125
121 =item opt arg2: C<$override> ( C<L<APR::Const status
122 constant|docs::2.0::api::APR::Const>> )
126 =item opt arg2: C<$override> ( C<L<Apache2::Const override
127 constant|docs::2.0::api::Apache2::Const>> )
123128
124129 Which allow-override bits are set
125130
126131 Default value is:
127132 C<L<Apache2::Const::OR_AUTHCFG|docs::2.0::api::Apache2::Const/C_Apache2__Const__OR_AUTHCFG_>>
128133
134 =item opt arg3: C<$path> ( string )
135
136 Set the C<L<Apache2::CmdParms object|docs::2.0::api::Apache2::CmdParms>> C<path> component.
137 This is the path of the C<E<lt>LocationE<gt>> block. Some directives need this,
138 for example C<ProxyPassReverse>.
139
140 If an empty string is passed a C<NULL> pointer is passed further at C-level.
141 This is necessary to make something like this work:
142
143 $r->add_config( [
144 '<Directory />',
145 'AllowOverride Options AuthConfig',
146 '</Directory>',
147 ], ~0, '' );
148
149 Note: C<AllowOverride> is valid only in directory context.
150
151 B<Caution:> Some directives need a non-empty path otherwise they cause
152 segfaults. Thus, use the empty path with caution.
153
154 Default value is: C</>
155
156 =item opt arg4: C<$override_opts> ( C<L<Apache2::Const options
157 constant|docs::2.0::api::Apache2::Const>> )
158
159 Apache limits the applicable directives in certain situations with
160 C<AllowOverride>. With Apache 2.2 comes the possibility to enable or
161 disable single options, for example
162
163 AllowOverride AuthConfig Options=ExecCGI,Indexes
164
165 Internally, this directive is parsed into 2 bit fields that are represented
166 by the C<$override> and C<$override_opts> parameters to C<add_config>.
167 The above example is parsed into an C<$override> with 2 bits set, one for
168 C<AuthConfig> the other for C<Options> and an C<$override_opts> with
169 2 bits set for ExecCGI and Indexes.
170
171 When applying other directives, for example C<AuthType> or C<Options> the
172 appropriate bits in C<$override> must be set. For the C<Options> directive
173 additionally C<$override_opts> bits must be set.
174
175 The C<$override> and C<$override_opts> parameters to C<add_config> are
176 valid while applying C<$lines>.
177
178 C<$override_opts> is new in Apache 2.2. The mod_perl implementation for
179 Apache 2.0 lets you pass the parameter but ignores it.
180
181 Default for C<$override_opts> is:
182 C<L<Apache2::Const::OPT_UNSET|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_UNSET_>> |
183 C<L<Apache2::Const::OPT_ALL|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_ALL_>> |
184 C<L<Apache2::Const::OPT_INCNOEXEC|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_INCNOEXEC_>> |
185 C<L<Apache2::Const::OPT_SYM_OWNER|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_SYM_OWNER_>> |
186 C<L<Apache2::Const::OPT_MULTI|docs::2.0::api::Apache2::Const/C_Apache2__Const__OPT_MULTI_>>
187
188 That means, all options are allowed.
189
129190 =item ret: no return value
130191
131 =item since: 2.0.00
192 =item since: 2.0.00, C<$path> and C<$override_opts> since 2.0.3
132193
133194 =back
134195
137198
138199 For example:
139200
140 use Apache2::ServerUtil ();
201 use Apache2::RequestUtil ();
202 use Apache2::Access ();
203
141204 $r->add_config(['require valid-user']);
142205
143
206 # this regards the current AllowOverride setting
207 $r->add_config(['AuthName secret',
208 'AuthType Basic',
209 'Options ExecCGI'],
210 $r->allow_override, $path, $r->allow_override_opts);
144211
145212
146213
580647
581648 =head2 C<location_merge>
582649
583 Merge a given C<E<lt>LocationE<lt>> container into the current request
650 Merge a given C<E<lt>LocationE<gt>> container into the current request
584651 object:
585652
586653 $ret = $r->location_merge($location);
592659
593660 =item arg1: C<$location> ( string )
594661
595 The argument in a C<E<lt>LocationE<lt>> section. For example to merge
662 The argument in a C<E<lt>LocationE<gt>> section. For example to merge
596663 a container:
597664
598665 <Location /foo>
712779 $old_val = $r->pnotes($key => $val);
713780 $val = $r->pnotes($key);
714781 $hash_ref = $r->pnotes();
782
783 B<Note:> sharing variables really means it. The variable is not copied.
784 Only its reference count is incremented. If it is changed after being
785 put in pnotes that change also affects the stored value. The following
786 example illustrates the effect:
787
788 my $v=1; my $v=1;
789 $r->pnotes( 'v'=>$v ); $r->pnotes->{v}=$v;
790 $v++; $v++;
791 my $x=$r->pnotes('v'); my $x=$r->pnotes->{v};
792
793 In both cases C<$x> is C<2> not C<1>. See also C<Apache2::SafePnotes> on
794 CPAN.
715795
716796 =over 4
717797
5151 # do something only when the server restarts
5252 my $cnt = Apache2::ServerUtil::restart_count();
5353 do_something_once() if $cnt > 1;
54
55
56
54
55 # get the resolved ids from Group and User entries
56 my $user_id = Apache2::ServerUtil->user_id;
57 my $group_id = Apache2::ServerUtil->group_id;
5758
5859
5960 =head1 Description
186187
187188
188189
189 =head2 C<server_shutdown_cleanup_register>
190
191 Register server shutdown cleanup callback:
192
193 Apache2::ServerUtil::server_shutdown_cleanup_register($sub);
194
195 =over 4
196
197 =item arg1: C<$sub> ( CODE ref or SUB name )
198
199
200
201 =item ret: no return value
202
203 =item since: 2.0.00
204
205 =back
206
207 This function can be used to register a callback to be run once at the
208 server shutdown (compared to
209 C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>>
210 which will execute the callback for each exiting child process).
211
212 For example in order to arrange the function C<do_my_cleanups()> to be
213 run every time the server shuts down (or restarts), run the following
214 code at the server startup:
215
216 Apache2::ServerUtil::server_shutdown_cleanup_register(\&do_my_cleanups);
217
218 It's necessary to run this code at the server startup (normally
219 F<startup.pl>. The function will croak if run after the
220 C<L<PerlPostConfigHandler|docs::2.0::user::handlers::server/C_PerlPostConfigHandler_>>
221 phase.
222
223
224
225
226
227190
228191 =head2 C<dir_config>
229192
411374 =item since: 2.0.00
412375
413376 =back
377
378
379
380
381
382
383
384
385
386 =head2 C<group_id>
387
388 Get the group id corresponding to the C<Group> directive in
389 F<httpd.conf>:
390
391 $gid = Apache2::ServerUtil->group_id;
392
393 =over 4
394
395 =item obj: C<Apache2::ServerUtil> (class name)
396
397 =item ret: C<$gid> ( integer )
398
399 On Unix platforms returns the gid corresponding to the value used in
400 the C<Group> directive in F<httpd.conf>. On other platforms returns 0.
401
402 =item since: 2.0.03
403
404 =back
405
406
407
414408
415409
416410
647641
648642 =over 4
649643
650 =item obj: C<Apache2> (class name)
644 =item obj: C<Apache2::ServerUtil> (class name)
651645
652646 =item ret: C<$main_s>
653647 ( C<L<Apache2::ServerRec object|docs::2.0::api::Apache2::ServerRec>> )
770764
771765
772766
767 =head2 C<server_shutdown_cleanup_register>
768
769 Register server shutdown cleanup callback:
770
771 Apache2::ServerUtil::server_shutdown_cleanup_register($sub);
772
773 =over 4
774
775 =item arg1: C<$sub> ( CODE ref or SUB name )
776
777 =item ret: no return value
778
779 =item since: 2.0.00
780
781 =back
782
783 This function can be used to register a callback to be run once at the
784 server shutdown (compared to
785 C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>>
786 which will execute the callback for each exiting child process).
787
788 For example in order to arrange the function C<do_my_cleanups()> to be
789 run every time the server shuts down (or restarts), run the following
790 code at the server startup:
791
792 Apache2::ServerUtil::server_shutdown_cleanup_register(\&do_my_cleanups);
793
794 It's necessary to run this code at the server startup (normally
795 F<startup.pl>. The function will croak if run after the
796 C<L<PerlPostConfigHandler|docs::2.0::user::handlers::server/C_PerlPostConfigHandler_>>
797 phase.
798
799
800
801
802
773803
774804 =head2 C<set_handlers>
775805
833863 or
834864
835865 $r->set_handlers(PerlCleanupHandler => undef);
866
867
868
869
870 =head2 C<user_id>
871
872 Get the user id corresponding to the C<User> directive in
873 F<httpd.conf>:
874
875 $uid = Apache2::ServerUtil->user_id;
876
877 =over 4
878
879 =item obj: C<Apache2::ServerUtil> (class name)
880
881 =item ret: C<$uid> ( integer )
882
883 On Unix platforms returns the uid corresponding to the value used in
884 the C<User> directive in F<httpd.conf>. On other platforms returns 0.
885
886 =item since: 2.0.03
887
888 =back
889
890
891
892
836893
837894
838895
2020 Apache2/CmdParms.pod
2121 Apache2/Command.pod
2222 Apache2/Connection.pod
23 Apache2/ConnectionUtil.pod
2324 Apache2/Const.pod
2425 Apache2/Directive.pod
2526 Apache2/Filter.pod
44 <body bgcolor="white">
55 <p>See
66 <a href="http://search.cpan.org/search?query=Apache&mode=module">search.cpan.org</a>
7 or <a href="http://www.perldoc.com">www.perldoc.com</a> for
7 or <a href="http://perldoc.perl.org">perldoc.perl.org</a> for
88 documentation of the 3rd party <code>Apache::</code> modules.</p>
99 </body>
1010 </html>
116116 project build process, since the source scanning is not stable yet,
117117 therefore everytime the map files change, C<make source_scan> should
118118 be run manually and the updated files ending up in the
119 I<xs/tables/current/> directory should be committed to the cvs
119 I<xs/tables/current/> directory should be committed to the svn
120120 repository.
121121
122 The I<source_scan> make target simply executes
123 I<build/source_scan.pl>, which can be run directly without needing to
124 create I<Makefile> first.
122 I<lib/ModPerl/CScan.pm> requires Data::Flow from CPAN
123 which is used by I<build/source_scan.pl>
125124
126125 There are three different types of map files in the I<xs/maps/>
127126 directory:
1313 Make sure to read also: L<Debugging mod_perl C
1414 Internals|docs::2.0::devel::debug::c>.
1515
16 META: these notes are a bit out of sync with the latest cvs, but will
16 META: these notes are a bit out of sync with the latest svn, but will
1717 be updated once the innovation dust settles down.
1818
1919 =head1 Perl Interpreters
55
66 Discover what are the available MPMs and how they work with mod_perl.
77
8 META: This doc is under construction. Owners are wanted.
8 META: This doc is under construction. Owners are wanted. -- pgollucci volunteering
99
1010 =head1 MPMs Overview
1111
3838
3939 META: incomplete
4040
41 =head1 The Event MPM
42
4143 =head1 Maintainers
4244
4345 Maintainer is the person(s) you should contact with updates,
4749
4850 =item *
4951
50 Stas Bekman E<lt>stas (at) stason.orgE<gt>
52 Philip M. Gollucci E<lt>pgollucci (at) p6m7g8.comE<gt>
5153
5254 =back
5355
5961 =item *
6062
6163 Stas Bekman E<lt>stas (at) stason.orgE<gt>
64 Philip M. Gollucci E<lt>pgollucci (at) p6m7g8.comE<gt>
6265
6366 =back
6467
0
1 # save this file as .debug and execute this as:
2 # gdb -command=.debug
3 # or if you prefer gui
4 # ddd -command=.debug
5 #
6 # NOTE: Adjust the path to the perl executable
7 # also this perl should be built with debug enabled
8 file /usr/bin/perl
9
10 # If you need to debug with gdb a live script and not a library, you
11 # are going to have a hard time to set any breakpoint in the C code.
12 # the workaround is force Inline to compile and load .so, by putting
13 # all the code in the BEGIN {} block and call Inline->init from there.
14 #
15 # you also need to prevent from Inline deleting autogenerated .xs so
16 # you can step through the C source code, and of course you need to
17 # add '-g' so .so won't be stripped of debug info
18 #
19 # here is a sample perl script that can be used with this gdb script
20 #
21 # test.pl
22 # #-----#
23 # use strict;
24 # use warnings;
25 #
26 # BEGIN {
27 # use Inline Config =>
28 # #FORCE_BUILD => 1,
29 # CLEAN_AFTER_BUILD => 0;
30 #
31 # use Inline C => Config =>
32 # OPTIMIZE => '-g';
33 #
34 # use Inline C => <<EOI;
35 # void my_bp() {
36 # dTHX;
37 # Perl_warn(aTHX_ "starting debug\n");
38 # }
39 # EOI
40 #
41 # Inline->init;
42 #
43 # }
44 #
45 # my_bp();
46
47 tb main
48 # NOTE: adjust the name of the script that you run
49 run test.pl
50
51 # when Perl_runops_debug breakpoint is hit Inline will already load
52 # the autogenerated .so, so we can set the bp in it (that's only if
53 # you have run 'Inline->init' inside the BEGIN {} block
54
55 b S_run_body
56 continue
57 b Perl_runops_debug
58 continue
59
60 # here you set your breakpoints
61 b my_bp
62 continue
0 # This gdb startup script breaks at the modperl_hook_init() function,
1 # which is useful for debug things at the modperl init phase.
2 #
3 # Invoke as:
4 # gdb -command=.debug-modperl-init
5 #
6 # see ADJUST notes for things that may need to be adjusted
7
8 # ADJUST: the path to the httpd executable if needed
9 file ~/httpd/worker/bin/httpd
10 handle SIGPIPE nostop
11 handle SIGPIPE pass
12 set auto-solib-add 0
13
14 define myrun
15 tbreak main
16 break ap_run_pre_config
17 # ADJUST: the httpd.conf file's path if needed
18 # ADJUST: add -DPERL_USEITHREADS to debug threaded mpms
19 run -d `pwd`/t -f `pwd`/t/conf/httpd.conf -DONE_PROCESS -DAPACHE2
20 continue
21 end
22
23 define modperl_init
24 sharedlibrary mod_perl
25 b modperl_hook_init
26 continue
27 end
28
29 define sharedap
30 # ADJUST: uncomment next line to debug threaded mpms
31 #sharedlibrary libpthread
32 sharedlibrary apr
33 sharedlibrary aprutil
34 #sharedlibrary mod_ssl.so
35 continue
36 end
37
38 define sharedperl
39 sharedlibrary libperl
40 end
41
42 # start the server and run till modperl_hook_init on start
43 myrun
44 modperl_init
45
46 # ADJUST: uncomment to reach modperl_hook_init on restart
47 #continue
48 #continue
49
50 # ADJUST: uncomment if you need to step through the code in apr libs
51 #sharedap
52
53 # ADJUST: uncomment if you need to step through the code in perlib
54 #sharedperl
0 # This gdb startup script allows to break at the very first invocation
1 # of mod_perl initialization, just after it was loaded. When the
2 # perl_module is loaded, and its pointer struct is added via
3 # ap_add_module(), the first hook that will be called is
4 # modperl_register_hooks().
5 #
6 # Invoke as:
7 # gdb -command=.debug-modperl-register
8 #
9 # see ADJUST notes for things that may need to be adjusted
10
11 define sharedap
12 sharedlibrary apr
13 sharedlibrary aprutil
14 #sharedlibrary mod_ssl.so
15 end
16
17 define sharedperl
18 sharedlibrary libperl
19 end
20
21 ### Run ###
22
23 # ADJUST: the path to the httpd executable if needed
24 file ~/httpd/prefork/bin/httpd
25 handle SIGPIPE nostop
26 handle SIGPIPE pass
27 set auto-solib-add 0
28
29 tbreak main
30
31 # assuming that mod_dso is compiled in
32 b load_module
33
34
35 # ADJUST: the httpd.conf file's path if needed
36 # ADJUST: add -DPERL_USEITHREADS to debug threaded mpms
37 run -d `pwd`/t -f `pwd`/t/conf/httpd.conf \
38 -DONE_PROCESS -DNO_DETACH -DAPACHE2
39
40 # skip over 'tbreak main'
41 continue
42
43 # In order to set the breakpoint in mod_perl.so, we need to get to
44 # the point where it's loaded.
45 #
46 # With static mod_perl, the bp can be set right away
47 #
48
49 # With DSO mod_perl, mod_dso's load_module() loads the mod_perl.so
50 # object and it immediately calls ap_add_module(), which calls
51 # modperl_register_hooks(). So if we want to bp at the latter, we need
52 # to stop at load_module(), set the 'bp modperl_register_hooks' and
53 # then continue.
54
55 # Assuming that 'LoadModule perl_module' is the first LoadModule
56 # directive in httpd.conf, you need just one 'continue' after
57 # 'ap_add_module'. If it's not the first one, you need to add as many
58 # 'continue' commands as the number of 'LoadModule foo' before
59 # perl_module, but before setting the 'ap_add_module' bp.
60 #
61 # If mod_perl is compiled statically, everything is already preloaded,
62 # so you can set modperl_* the breakpoints right away
63
64 b ap_add_module
65 continue
66
67 sharedlibrary mod_perl
68 b modperl_register_hooks
69 continue
70
71 #b modperl_hook_init
72 #b modperl_config_srv_create
73 #b modperl_startup
74 #b modperl_init_vhost
75 #b modperl_dir_config
76 #b modperl_cmd_load_module
77 #modperl_config_apply_PerlModule
78
79 # ADJUST: uncomment next line to debug threaded mpms
80 #sharedlibrary libpthread
81
82 # ADJUST: uncomment if you need to step through the code in apr libs
83 #sharedap
84
85 # ADJUST: uncomment if you need to step through the code in perlib
86 #sharedperl
87
88
89
90
91
0 # This gdb startup script breaks at the mpxs_Apache__Filter_print()
1 # function from the XS code, as an example how you can debug the code
2 # in XS extensions.
3 #
4 # Invoke as:
5 # gdb -command=.debug-modperl-xs
6 # and then run:
7 # t/TEST -v -run -ping=block filter/api
8 #
9 # see ADJUST notes for things that may need to be adjusted
10
11 # ADJUST: the path to the httpd executable if needed
12 file /home/stas/httpd/worker/bin/httpd
13 handle SIGPIPE nostop
14 handle SIGPIPE pass
15 set auto-solib-add 0
16
17 define myrun
18 tbreak main
19 break ap_run_pre_config
20 # ADJUST: the httpd.conf file's path if needed
21 # ADJUST: add -DPERL_USEITHREADS to debug threaded mpms
22 run -d `pwd`/t -f `pwd`/t/conf/httpd.conf \
23 -DONE_PROCESS -DNO_DETACH -DAPACHE2
24 continue
25 end
26
27 define sharedap
28 # ADJUST: uncomment next line to debug threaded mpms
29 #sharedlibrary libpthread
30 sharedlibrary apr
31 sharedlibrary aprutil
32 #sharedlibrary mod_ssl.so
33 continue
34 end
35
36 define sharedperl
37 sharedlibrary libperl
38 end
39
40 define gopoll
41 b apr_poll
42 continue
43 continue
44 end
45
46 define mybp
47 # load Apache/Filter.so
48 sharedlibrary Filter
49 b mpxs_Apache__Filter_print
50 # no longer needed and they just make debugging harder under threads
51 disable 2
52 disable 3
53 continue
54 end
55
56 myrun
57 gopoll
58 mybp
59
60 # ADJUST: uncomment if you need to step through the code in apr libs
61 #sharedap
62
63 # ADJUST: uncomment if you need to step through the code in perlib
64 #sharedperl
44 =head1 Description
55
66 This document explains how to debug Perl code under mod_perl.
7
8 Most of the L<mod_perl 1.0 debug
9 documentation|docs::1.0::guide::debug> applies to mod_perl 2.0:
10
11
12
13
14
15 =head2 Detecting Hanging Processes
16
17 See L<Hanging Processes: Detection and
18 Diagnostics|docs::1.0::guide::debug/Hanging_Processes__Detection_and_Diagnostics>
19 for the explanation, but under mp2 to use signals to detect where the
20 process is spinning, you can't use C<$SIG{USR2}>, you have to use
21 POSIX signals. i.e. the code becomes:
22
23 use Carp ();
24 use POSIX qw(SIGUSR2);
25 my $mask = POSIX::SigSet->new( SIGUSR2 );
26 my $action = POSIX::SigAction->new(\&tell_where_spinning, $mask);
27 my $oldaction = POSIX::SigAction->new();
28 POSIX::sigaction(SIGUSR2, $action, $oldaction );
29
30 sub tell_where_spinning {
31 Carp::confess("caught SIGUSR2!");
32 };
33
34 and then:
35
36 % kill USR2 <pid_of_the_spinning_process>
37
38 and watch for the trace in F<error_log>.
39
40
41
42
743
844 =head1 Maintainers
945
6363 backtrace|user::help::help/Resolving_Segmentation_Faults> to the
6464 modperl developers list.
6565
66 =head2 mod_perl 2.0 Core Development CVS Commits List
67
68 This list's traffic is comprised of solely cvs commits, so this is the
66 =head2 mod_perl 2.0 Core Development SVN Commits List
67
68 This list's traffic is comprised of solely svn commits, so this is the
6969 place to be if you want to see mod_perl 2.0 evolve before your eyes.
7070
7171 =over
8484
8585 The C<Apache-Test> project, originally developed as a part of mod_perl
8686 2.0, is now a part of the Apache C<httpd-test> project. You get this
87 repository automatically when checking out the mod_perl-2.0 cvs
87 repository automatically when checking out the mod_perl-2.0 svn
8888 repository.
8989
9090 To retrieve the whole httpd-test project, run:
9191
92 cvs co httpd-test
92 svn co http://svn.pache.org/repos/asf/httpd/httpd-test
9393
9494 =over
9595
9999
100100 archive: META: ???
101101
102 =item cvs commits
102 =item svn commits
103103
104104 mailing list subscription: mailto:test-cvs-subscribe@httpd.apache.org
105105
120120
121121 archive: http://marc.theaimsgroup.com/?l=apache-new-httpd&r=1&w=
122122
123 =item cvs commits
123 =item svn commits
124124
125125 mailing list subscription: mailto:httpd-2.0-cvs-subscribe@perl.apache.org
126126
160160
161161 archive: http://marc.theaimsgroup.com/?l=apr-dev&r=1&w=2
162162
163 =item cvs commits
163 =item svn commits
164164
165165 mailing list subscription: mailto:apr-cvs-subscribe@perl.apache.org
166166
1313 request at a time. This effectively prevents concurrent processing,
1414 which can have serious implications for busy sites. This problem is
1515 addressed in the multi-thread/multi-process approach of mod_perl
16 2.0/Apache 2.0, which consequently requires a Perl built with ithreads
16 2.0/Apache 2.x, which consequently requires a Perl built with ithreads
1717 enabled.
1818
1919 There are some threading issues in perl-5.6
2121 problems with mod_perl 2.0 on Win32. Consequently, the minimum
2222 required perl version is 5.8 (upon which ActivePerl builds 8xx are based)
2323 for use with mod_perl 2.0 on Win32.
24
25 Note that, at the present time, mod_perl 2 is in a development
26 stage, with a version number C<1.99_xx>.
2724
2825 =head1 Installing
2926
108105 your F</Path/to/Apache2/modules/> directory.
109106
110107 If this build fails, or you want features not present in the official
111 releases, you may want to try the sources obtained from cvs - see the
108 releases, you may want to try the sources obtained from svn - see the
112109 discussion on the L<2.0 Development Source
113110 Distribution|download::source/Development_mod_perl_2_0_Source_Distribution>
114111 for details. Be aware, though, that as well as providing bug fixes,
115 there may be new features being added and tested in the cvs versions,
112 there may be new features being added and tested in the svn versions,
116113 so at any given time there are no guarantees that these packages will
117114 build and test successfully.
118115
119116 =head2 PPM Packages
120117
121118 The following assumes you already have ActivePerl 8xx (I<not> 6xx)
122 from L<http://www.activestate.com/> and a Win32 Apache 2.0 binary from
119 from L<http://www.activestate.com/> and a Win32 Apache 2.x binary from
123120 L<http://httpd.apache.org/>. In installing this, you might avoid
124121 some future problems by choosing installation directories that do
125122 not have spaces in their names (eg, F<C:/Apache2>). At this time
126123 you must have version 2.0.47 or greater of Apache2 in order to
127124 install the mod_perl 2 ppm package.
128125
129 After installing Perl and Apache 2.0, you can then install mod_perl
126 After installing Perl and Apache 2.x, you can then install mod_perl
130127 via the C<PPM> utility. ActiveState does not maintain mod_perl in
131128 their ppm repository, so you must get it from a different location
132129 other than ActiveState's site. A quick way to do this is to download
142139 C:\> ppm install
143140 http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd
144141
145 Another way, which will be useful if you plan on installing
146 additional Apache modules, is to set the repository
142 for Apache/2.0, and
143
144 C:\> ppm install
145 http://theoryx5.uwinnipeg.ca/ppms/mod_perl-2.2.ppd
146
147 for Apache/2.2. Another way, which will be useful if you plan on
148 installing additional Apache modules, is to set the repository
147149 within the C<ppm> shell utility to
148150
149151 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58
151153 using the C<repository add alias location> for I<ppm3> (the
152154 default with ActivePerl 8xx), and using C<set repository alias location>
153155 for C<ppm2>; see the help utility within the C<ppm> shell for
154 details. mod_perl 2.0 can then be installed as C<install mod_perl>
155 within the ppm shell, which
156 will install the necessary modules under an F<Apache2>
156 details. mod_perl 2.0 can then be installed, within the ppm shell, as
157
158 ppm> install mod_perl
159
160 for Apache/2.0, and as
161
162 ppm> install mod_perl-2.2
163
164 for Apache/2.2. This will install the necessary modules under an F<Apache2>
157165 subdirectory in your Perl tree, so as not to disturb a possible existing
158166 F<Apache> directory from mod_perl 1.0. See the section below on
159167 configuring mod_perl to add this directory to the C<@INC> path for
169177 Note that, because of binary incompatibilities, one should
170178 I<not> install packages for ActivePerl 8xx from a repository
171179 containing packages for ActivePerl 6xx, and vice-versa, particularly
172 if these packages contain XS-based modules.
180 if these packages contain XS-based modules. Also note that
181 modules compiled under Apache/2.0 are not compatible with
182 modules compiled under Apache/2.2, so be sure to install the
183 mod_perl ppm package appropriate for your version of Apache/2.x.
173184
174185 The mod_perl package available from this site will always
175186 use the latest mod_perl sources available from CPAN
221232
222233 DeveloperSide.NET for Windows at
223234 L<http://www.devside.net/web/server/free/software>
235
236 =item *
237
238 zangweb from
239 L<http://www.arbingersys.com/hostsites/zangweb/>
224240
225241 =back
226242
1919 die "This only works for Win32" unless $^O =~ /Win32/i;
2020 die "No mod_perl ppm package available for this Perl" if ($] < 5.006001);
2121
22 my ($apache2, $apache);
22 my ($apache2, $apache, $apache22);
2323 my @drives = drives();
2424
2525 # find a possible Apache2 directory
7171 unless $vers =~ m!Apache/1.3!;
7272 }
7373 else {
74 $vers = qx{"$apache2/bin/apache.exe" -v};
75 die qq{"$apache2" does not appear to be version 2.0}
76 unless $vers =~ m!Apache/2.0!;
74 my $vers;
75 for my $binary(qw(Apache.exe httpd.exe)) {
76 my $b = File::Spec->catfile($apache2, 'bin', $binary);
77 next unless -x $b;
78 $vers = qx{$b -v};
79 last;
80 }
81 die qq{Cannot determine the Apache version} unless $vers;
82 die qq{"$apache2" does not appear to be version 2.x}
83 unless $vers =~ m!Apache/2.!;
84 $apache22 = 1 if $vers =~ m!Apache/2.2!;
7785 }
7886 }
7987 # prompt to get an Apache installation directory
142150 if ($apache2) {
143151 my $ans = prompt('Do you want the latest mod_perl 2 development version?', 'no');
144152 if ($ans =~ /^n/i) {
145 $ppdfile = 'mod_perl.ppd';
146 $tgzfile = 'mod_perl.tar.gz';
147 $so_fake = 'mod_perl.so';
148 }
153 if ($apache22) {
154 $ppdfile = 'mod_perl-2.2.ppd';
155 $tgzfile = 'mod_perl-2.2.tar.gz';
156 $so_fake = 'mod_perl-2.2.so';
157 }
158 else {
159 $ppdfile = 'mod_perl.ppd';
160 $tgzfile = 'mod_perl.tar.gz';
161 $so_fake = 'mod_perl.so';
162 }
163 }
149164 else {
150165 $ppdfile = 'mod_perl-dev.ppd';
151166 $tgzfile = 'mod_perl-dev.tar.gz';
152 $so_fake = 'mod_perl-dev.so';
167 $so_fake = 'mod_perl-dev.so';
153168 }
154169 $ppd = $ppms . $ppdfile;
155170 $tgz = $ppmsx86 . $tgzfile;
201216 unless (verifyMD5($cksum, $tgzfile));
202217 die qq{CHECKSUM check for "$so_fake" failed.\n}
203218 unless (verifyMD5($cksum, $so_fake));
204 rename($so_fake, $so) or die "Rename of $so_fake to $so failed: $!";
219 unless ($so_fake eq $so) {
220 rename($so_fake, $so) or die "Rename of $so_fake to $so failed: $!";
221 }
205222
206223 # edit the ppd file to reflect a local installation
207224 my $old = $ppdfile . '.old';
274291 LoadModule perl_module modules/$so
275292
276293 in the section where other apache modules are loaded.
277 You should also either have a directive 'PerlModule Apache2'
278 in httpd.conf or put in a 'use Apache2 ();' in a startup
279 script. You may also have to add $Config{bin}
294 You may also have to add $Config{bin}
280295 to your PATH environment variable.
281296
282297 For more information, visit http://perl.apache.org/.
99 The most recent changes are listed first.
1010
1111 =head1 ...
12
13 Replaced the idiom of using $mod_perl::VERSION as a test for whether
14 or not you're running under mod_perl 1.x or mod_perl 2.x with a more
15 accurate and general test. By Frank Wiles E<lt>frankE<lt>atE<gt>wiles.orgE<gt>.
1216
1317 A new troubleshooting section on how to resolve can't locate file foo,
1418 when there is a system limit on the maximum open files. By Ken Simpson
2222 =head1 Techniques
2323
2424
25
2625 =head2 Method Handlers
2726
28 In mod_perl 2.0 method handlers are declared using the C<method>
29 attribute:
30
31 package Bird;
32 @ISA = qw(Eagle);
27 In addition to function handlers method handlers can be used. Method
28 handlers are useful when you want to write code that takes advantage
29 of inheritance. To make the handler act as a method under mod_perl 2,
30 use the C<method> attribute.
31
32 See the Perl I<attributes> manpage for details on the attributes
33 syntax (C<perldoc attributes>).
34
35 For example:
36
37 package Bird::Eagle;
38 @ISA = qw(Bird);
3339
3440 sub handler : method {
35 my ($class, $r) = @_;
41 my ($class_or_object, $r) = @_;
3642 ...;
3743 }
38
39 See the I<attributes> manpage.
40
41 If C<Class-E<gt>method> syntax is used for a C<Perl*Handler>, the
42 C<:method> attribute is not required.
43
44 META: need to port the method handlers document from mp1 guide, may be
45 keep it as a separate document. Meanwhile refer to L<that
46 document|docs::1.0::guide::method_handlers>, though L<replace the C<$$>
47 prototype with the C<:method> attribute
48 |docs::2.0::user::porting::compat/Method_Handlers>.
44
45 sub new { bless {}, __PACKAGE__ }
46
47 and then register it as:
48
49 PerlResponseHandler Bird::Eagle
50
51 When mod_perl sees that the handler has a method attribute, it passes
52 two arguments to it: the calling object or a class, depending on how
53 it was called, and the request object, as shown above.
54
55 If C<Class-E<gt>method> syntax is used for a C<Perl*Handler>, e.g.:
56
57 PerlResponseHandler Bird::Eagle->handler;
58
59 the C<:method> attribute is not required.
60
61 In the preceding configuration example, the C<handler()> method will
62 be called as a class (static) method.
63
64 Also, you can use objects created at startup to call methods. For example:
65
66 <Perl>
67 use Bird::Eagle;
68 $Bird::Global::object = Bird::Eagle->new();
69 </Perl>
70 ...
71 PerlResponseHandler $Bird::Global::object->handler
72
73 In this example, the C<handler()> method will be called as an instance
74 method on the global object $C<Bird::Global::object>.
75
76
4977
5078
5179 =head2 Cleaning up
130158 C<$ENV{MOD_PERL}> - is set to the mod_perl version the server is
131159 running under. e.g.:
132160
133 mod_perl/1.99_03-dev
161 mod_perl/2.000002
134162
135163 If C<$ENV{MOD_PERL}> doesn't exist, most likely you are not running
136164 under mod_perl.
141169 following technique:
142170
143171 use mod_perl;
144 use constant MP2 => ($mod_perl::VERSION >= 1.99);
172 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
173 $ENV{MOD_PERL_API_VERSION} >= 2 );
174
145175 # die "I want mod_perl 2.0!" unless MP2;
146176
147177 =back
374404 If you use C<$r> to set headers as explained at the beginning of this
375405 section, you won't encounter any of these problems.
376406
377 Finally, If you don't want Apache to send its own headers and you want
407 Finally, if you don't want Apache to send its own headers and you want
378408 to send your own set of headers (non-parsed headers handlers) use the
379409 C<L<$r-E<gt>assbackwards|docs::2.0::api::Apache2::RequestRec/C_assbackwards_>>
380410 method. Notice that registry handlers will do that for you if the
814844 this problem.
815845
816846 For more information refer to the I<perlthrtut>
817 (I<http://perldoc.com/perl5.8.0/pod/perlthrtut.html>) manpage.
847 (I<http://perldoc.perl.org/perlthrtut.html>) manpage.
818848
819849
820850
125125
126126 =head2 C<PerlAddVar>
127127
128 META: to be written
129
128 C<PerlAddVar> is useful if you need to pass in multiple values into the
129 same variable emulating arrays and hashes. For example:
130
131 PerlAddVar foo bar
132 PerlAddVar foo bar1
133 PerlAddVar foo bar2
134
135 You would retrieve these values with:
136
137 my @foos = $r->dir_config('foo');
138
139 This would fill the I<@foos> array with 'bar', 'bar1', and 'bar2'.
140
141 To pass in hashed values you need to ensure that you use an even number
142 of directives per key. For example:
143
144 PerlAddVar foo key1
145 PerlAddVar foo value1
146 PerlAddVar foo key2
147 PerlAddVar foo value2
148
149 You can then retrieve these values with:
150
151 my %foos = $r->dir_config('foo');
152
153 Where I<%foos> will have a structure like:
154
155 %foos = (
156 key1 => 'value1',
157 key2 => 'value2',
158 );
130159
131160 See also: L<this directive argument types and allowed
132161 location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>.
171200 C<L<PerlModule|/C_PerlModule_>>, in a sense that it loads a
172201 module. The difference is that it's used to triggers L<an early Perl
173202 startup|docs::2.0::user::handlers::server/mod_perl_Startup>. This can
174 be usefull for modules that need to be loaded early, as is the case
203 be useful for modules that need to be loaded early, as is the case
175204 for modules that implement L<new Apache
176205 directives|docs::2.0::user::config::custom>, which are needed during
177206 the configuration phase.
260289 host to have its own pool, that host will continue to reuse the Perl
261290 allocations in their specific modules.
262291
263 When cloning a Perl interpreter, to inherit base Perl interpreter's
264 C<PerlSwitches> use:
292 =head3 C<InheritSwitches>
293
294 Off by default, can be used to have a C<VirtualHost> inherit the value
295 of the C<PerlSwitches> from the parent server.
296
297 For instance, when cloning a Perl interpreter, to inherit the base Perl
298 interpreter's C<PerlSwitches> use:
265299
266300 <VirtualHost ...>
301 PerlOptions +Clone +InheritSwitches
267302 ...
268 PerlSwitches +inherit
269303 </VirtualHost>
270
271304
272305 =head3 C<Parent>
273306
366399 PerlModule Apache::Magick
367400
368401 in our example.
402
403 Another way to preload only specific modules is to add + when
404 configuring those, for example:
405
406 PerlResponseHandler +Apache::Magick
407
408 will automatically preload the C<Apache::Magick> module.
409
369410
370411 =head3 C<GlobalRequest>
371412
555596
556597 =head2 C<PerlPassEnv>
557598
558 META: to be written
599 C<PerlPassEnv> instructs mod_perl to pass the environment variables you
600 specify to your mod_perl handlers. This is useful if you need to set
601 the same environment variables for your shell as well as mod_perl. For
602 example if you had this in your .bash_profile:
603
604 export ORACLE_HOME=/oracle
605
606 And defined the following in your I<httpd.conf>:
607
608 PerlPassEnv ORACLE_HOME
609
610 The your mod_perl handlers would have access to the value via the standard
611 Perl mechanism:
612
613 my $oracle_home = $ENV{'ORACLE_HOME'};
559614
560615 See also: L<this directive argument types and allowed
561616 location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>.
638693
639694 =head2 C<PerlSetEnv>
640695
641 META: to be written
696 C<PerlSetEnv> allows you to specify system environment variables and pass
697 them into your mod_perl handlers. These values are then available through
698 the normal perl C<%ENV> mechanisms. For example:
699
700 PerlSetEnv TEMPLATE_PATH /usr/share/templates
701
702 would create C<$ENV{'TEMPLATE_PATH'}> and set it to I</usr/share/templates>.
703
704
705
642706
643707 See also: L<this directive argument types and allowed
644708 location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>.
651715
652716 =head2 C<PerlSetVar>
653717
654 META: to be written
718 C<PerlSetVar> allows you to pass variables into your mod_perl handlers from
719 your I<httpd.conf>. This method is preferable to using C<PerlSetEnv> or
720 Apache's C<SetEnv> and C<PassEnv> methods because of the overhead of having
721 to populate C<%ENV> for each request. An example of how this can be used is:
722
723 PerlSetVar foo bar
724
725 To retrieve the value of that variable in your Perl code you would use:
726
727 my $foo = $r->dir_config('foo');
728
729 In this example C<$foo> would then hold the value 'bar'. B<NOTE:> that these
730 directives are parsed at request time which is a slower method than using
731 L<custom Apache configuration directives|docs::2.0::user::config::custom>
655732
656733 See also: L<this directive argument types and allowed
657734 location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>.
724801
725802 =item *
726803
727 C<MOD_PERL> (always)
804 C<MOD_PERL> and C<MOD_PERL_API_VERSION> (always)
728805
729806 =item *
730807
14031480
14041481 If you need to access any of the startup defines in the Perl code you
14051482 use
1406 C<L<Apache2::ServerUtil::exists_config_define()|docs::2.0::Apache2::ServerUtil/C_exists_config_define_>>. For
1483 C<L<Apache2::ServerUtil::exists_config_define()|docs::2.0::api::Apache2::ServerUtil/C_exists_config_define_>>. For
14071484 example in a startup file you can say:
14081485
14091486 use Apache2::ServerUtil ();
821821 use Apache2::Module ();
822822 use Apache2::CmdParms ();
823823 my @directives = (...);
824 Apache2::Module::add(__PACKLAGE__, \@directives);
824 Apache2::Module::add(__PACKAGE__, \@directives);
825825 ...
826826 sub SERVER_CREATE {
827827 my ($class, $parms) = @_;
15091509 >>> connection output filter
15101510 o bucket 1: HEAP
15111511 [HTTP/1.1 200 OK
1512 Date: Fri, 04 Jun 2004 09:13:26 GMT
1513 Server: Apache/2.0.50-dev (Unix) mod_perl/1.99_15-dev
1514 Perl/v5.8.4 mod_ssl/2.0.50-dev OpenSSL/0.9.7c DAV/2
1512 Date: Tue, 07 Mar 2006 10:59:08 GMT
1513 Server: Apache/2.0.55 (Unix) mod_perl/2.000002
1514 Perl/v5.8.4 mod_ssl/2.0.55 OpenSSL/0.9.7c DAV/2
15151515 Connection: close
15161516 Transfer-Encoding: chunked
15171517 Content-Type: text/plain; charset=ISO-8859-1
1212 All HTTP Request handlers have the following structure:
1313
1414 package MyApache2::MyHandlerName;
15
15
1616 # load modules that are going to be used
1717 use ...;
18
18
1919 # compile (or import) constants
2020 use Apache2::Const -compile => qw(OK);
21
21
2222 sub handler {
2323 my $r = shift;
2424
184184 $r->content_type('text/plain');
185185
186186 my $conf_file = catfile Apache2::ServerUtil::server_root,
187 "conf", "httpd.conf";
187 "conf", "httpd.conf";
188188
189189 printf "$conf_file is %0.2f minutes old\n", 60*24*(-M $conf_file);
190190
505505 sub send_email_handler {
506506 my $r = shift;
507507
508 my %headers = map {$_ => $r->headers_in->get($_)} qw(To From Subject);
509 my $content = content($r);
508 my %headers = map {$_ => $r->headers_in->get($_)}
509 qw(To From Subject);
510
511 my $content = content($r);
510512
511513 my $status = send_email(\%headers, \$content);
512514
542544 my $data = '';
543545 my $seen_eos = 0;
544546 do {
545 $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES,
546 APR::Const::BLOCK_READ, IOBUFSIZE);
547 $r->input_filters->get_brigade($bb,
548 Apache2::Const::MODE_READBYTES,
549 APR::Const::BLOCK_READ, IOBUFSIZE);
547550
548551 for (my $b = $bb->first; $b; $b = $bb->next($b)) {
549552 if ($b->is_eos) {
602605 response handler consists of three parts. Retrieve the email headers
603606 C<To>, C<From> and C<Subject>, and the body of the message:
604607
605 my %headers = map {$_ => $r->headers_in->get($_)} qw(To From Subject);
608 my %headers = map {$_ => $r->headers_in->get($_)}
609 qw(To From Subject);
606610 my $content = $r->content;
607611
608612 Then send the email:
737741
738742 The following example handler denies requests made from IPs on the
739743 blacklist.
744
740745
741746 #file:MyApache2/BlockByIP.pm
742747 #--------------------------
11941199 and the callback if needed:
11951200
11961201 if (defined $exts{$ext}->[CALLBACK]) {
1197 $r->set_handlers(PerlResponseHandler => $exts{$ext}->[CALLBACK]);
1202 $r->set_handlers(
1203 PerlResponseHandler => $exts{$ext}->[CALLBACK]);
11981204 }
11991205
12001206 In this simple example the callback functions don't do much but
15721578 solution. Therefore we need to use a random string. We can either
15731579 either Perl's C<rand>, some CPAN module or the APR's C<APR::UUID>:
15741580
1575 sub unique_id {
1576 require APR::UUID;
1577 return APR::UUID->new->format;
1578 }
1581 sub unique_id {
1582 require APR::UUID;
1583 return APR::UUID->new->format;
1584 }
15791585
15801586 Now the problem is how do we tell the cleanup handler what file should
15811587 be cleaned up? We could have stored it in the C<$r-E<gt>notes> table
15871593 better version of the response and cleanup handlers, that uses this
15881594 technique:
15891595
1590 #file:MyApache2/Cleanup2.pm
1591 #-------------------------
1592 package MyApache2::Cleanup2;
1593
1594 use strict;
1595 use warnings FATAL => 'all';
1596
1597 use File::Spec::Functions qw(catfile);
1598
1599 use Apache2::RequestRec ();
1600 use Apache2::RequestIO ();
1601 use Apache2::RequestUtil ();
1602 use APR::UUID ();
1603 use APR::Pool ();
1604
1605 use Apache2::Const -compile => qw(OK DECLINED);
1606 use APR::Const -compile => 'SUCCESS';
1607
1608 my $file_base = catfile "/tmp", "data-";
1609
1610 sub handler {
1611 my $r = shift;
1612
1613 $r->content_type('text/plain');
1614 my $file = $file_base . APR::UUID->new->format;
1615
1616 local @ENV{qw(PATH BASH_ENV)};
1617 qx(/bin/ls -l > $file);
1618
1619 my $status = $r->sendfile($file);
1620 die "sendfile has failed" unless $status == APR::Const::SUCCESS;
1621
1622 $r->pool->cleanup_register(\&cleanup, $file);
1623
1624 return Apache2::Const::OK;
1625 }
1626
1627 sub cleanup {
1628 my $file = shift;
1629
1630 die "Can't find file: $file" unless -e $file;
1631 unlink $file or die "failed to unlink $file";
1632
1633 return Apache2::Const::OK;
1634 }
1635 1;
1596 #file: MyApache2/Cleanup2.pm
1597 #-------------------------
1598 package MyApache2::Cleanup2;
1599
1600 use strict;
1601 use warnings FATAL => 'all';
1602
1603 use File::Spec::Functions qw(catfile);
1604
1605 use Apache2::RequestRec ();
1606 use Apache2::RequestIO ();
1607 use Apache2::RequestUtil ();
1608 use APR::UUID ();
1609 use APR::Pool ();
1610
1611 use Apache2::Const -compile => qw(OK DECLINED);
1612 use APR::Const -compile => 'SUCCESS';
1613
1614 my $file_base = catfile "/tmp", "data-";
1615
1616 sub handler {
1617 my $r = shift;
1618
1619 $r->content_type('text/plain');
1620 my $file = $file_base . APR::UUID->new->format;
1621
1622 local @ENV{qw(PATH BASH_ENV)};
1623 qx(/bin/ls -l > $file);
1624
1625 my $status = $r->sendfile($file);
1626 die "sendfile has failed" unless $status == APR::Const::SUCCESS;
1627
1628 $r->pool->cleanup_register(\&cleanup, $file);
1629
1630 return Apache2::Const::OK;
1631 }
1632
1633 sub cleanup {
1634 my $file = shift;
1635
1636 die "Can't find file: $file" unless -e $file;
1637 unlink $file or die "failed to unlink $file";
1638
1639 return Apache2::Const::OK;
1640 }
1641 1;
16361642
16371643 Similarly to the first handler, we add the configuration:
16381644
1639 <Location /cleanup2>
1640 SetHandler modperl
1641 PerlResponseHandler MyApache2::Cleanup2
1642 </Location>
1645 <Location /cleanup2>
1646 SetHandler modperl
1647 PerlResponseHandler MyApache2::Cleanup2
1648 </Location>
16431649
16441650 And now when requesting I</cleanup2> we still get the same output --
16451651 the listing of the current directory -- but this time this code will
16721678 early|docs::1.0::guide::porting/Generating_correct_HTTP_Headers> from
16731679 the handler:
16741680
1675 return Apache2::Const::OK if $r->header_only;
1681 return Apache2::Const::OK if $r->header_only;
16761682
16771683 This logic should not be used in mod_perl 2.0, because Apache 2.0
16781684 automatically discards the response body for HEAD requests. It expects
17101716 For more discussion on why it is important to get HEAD requests right,
17111717 see these threads from the mod_perl list:
17121718
1713 http://marc.theaimsgroup.com/?l=apache-modperl&m=108647669726915&w=2
1714 http://marc.theaimsgroup.com/?t=109122984600001&r=1&w=2
1719 http://marc.theaimsgroup.com/?l=apache-modperl&m=108647669726915&w=2
1720 http://marc.theaimsgroup.com/?t=109122984600001&r=1&w=2
17151721
17161722 as well as this bug report from mozilla, which shows how C<HEAD>
17171723 requests are used in the wild:
17181724
1719 http://bugzilla.mozilla.org/show_bug.cgi?id=245447
1725 http://bugzilla.mozilla.org/show_bug.cgi?id=245447
17201726
17211727 =item * Not getting C<Content-Length> header with C<HEAD> requests
17221728
17371743 C<EOS> was sent (which happens when the response handler returns). The
17381744 simplest solution is to use rflush():
17391745
1740 if ($r->header_only) { # HEAD
1741 $body_len = calculate_body_len();
1742 $r->set_content_length($body_len);
1743 $r->rflush;
1744 }
1745 else { # GET
1746 # generate and send the body
1747 }
1746 if ($r->header_only) { # HEAD
1747 $body_len = calculate_body_len();
1748 $r->set_content_length($body_len);
1749 $r->rflush;
1750 }
1751 else { # GET
1752 # generate and send the body
1753 }
17481754
17491755 now if the handler sets the C-L header it'll be delivered to the
17501756 client unmodified.
17761782 backend: mod_rpaf: http://stderr.net/apache/rpaf/
17771783
17781784 =back
1779
17801785
17811786
17821787
17871792 details.
17881793
17891794
1790
1791
1792
1795 =head1 HTTP Status Codes
1796
1797 The Hypertext Transfer Protocol (HTTP) is an application-level
1798 protocol for distributed, collaborative, hypermedia information
1799 systems. It is a generic, stateless, protocol which can be used for
1800 many tasks beyond its use for hypertext, such as name servers and
1801 distributed object management systems, through extension of its
1802 request methods, error codes and headers. A feature of HTTP is the
1803 typing and negotiation of data representation, allowing systems to be
1804 built independently of the data being transferred.
1805
1806 HTTP 1.0 is described in Requests For Comments (RFC) 1945. HTTP 1.1 is
1807 the latest version of the specifications and as of this writing HTTP
1808 1.1 is covered in RFC 2616.
1809
1810 When writing mod_perl applications, usually only a small subset of HTTP
1811 response codes is used, but sometimes you need to know others as
1812 well. We will give a short description of each code and you will find
1813 the extended explanation in the appropriate RFC. (Section 9 in RFC
1814 1945 and section 10 in RFC 2616). You can always find the latest link
1815 to these RFCs at the Web Consortium site,
1816 I<http://www.w3.org/Protocols/>.
1817
1818 While HTTP 1.1 is widely supported, HTTP 1.0 still remains the
1819 mainstream standard. Therefore we will supply a summary of the both
1820 versions including the corresponding Apache constants.
1821
1822 In mod_perl these constants can be accessed the
1823 C<L<Apache::Constants|docs::1.0::api::Apache::Constants>>
1824 package (e.g., to access the HTTP_OK constant use
1825 C<Apache::Constants::HTTP_OK>). See the
1826 C<L<Apache::Constants|docs::1.0::api::Apache::Constants>> manpage
1827 for more information.
1828
1829 In mod_perl2 these constants can be accessed the
1830 C<L<Apache2::Const|docs::2.0::api::Apache2::Const>>
1831 package (e.g., to access the HTTP_OK constant use
1832 C<Apache2::Const::HTTP_OK>). See the
1833 C<L<Apache2::Const|docs::2.0::api::Apache2::Const>> manpage
1834 for more information.
1835
1836 =head2 HTTP 1.0 Status Codes
1837
1838 =over 4
1839
1840 =item *
1841
1842 Successful 2xx:
1843
1844 200 HTTP_OK OK
1845 201 HTTP_CREATED Created
1846 202 HTTP_ACCEPTED Accepted
1847 204 HTTP_NO_CONTENT No Content
1848
1849 =item *
1850
1851 Redirection 3xx:
1852
1853 300 HTTP_MOVED_PERMANENTLY Multiple Choices
1854 301 HTTP_MOVED_TEMPORARILY Moved Permanently
1855 302 HTTP_SEE_OTHER Moved Temporarily
1856 304 HTTP_NOT_MODIFIED Not Modified
1857
1858 =item *
1859
1860 Client Error 4xx:
1861
1862 400 HTTP_BAD_REQUEST Bad Request
1863 401 HTTP_UNAUTHORIZED Unauthorized
1864 403 HTTP_FORBIDDEN Forbidden
1865 404 HTTP_NOT_FOUND Not Found
1866
1867 =item *
1868
1869 Server Error 5xx:
1870
1871 500 HTTP_INTERNAL_SERVER_ERROR Internal Server Error
1872 501 HTTP_NOT_IMPLEMENTED Not Implemented
1873 502 HTTP_BAD_GATEWAY Bad Gateway
1874 503 HTTP_SERVICE_UNAVAILABLE Service UnavailableStatus Codes
1875
1876 =back
1877
1878 =head2 HTTP 1.1 Status Codes
1879
1880 =over 4
1881
1882 =item *
1883
1884 Informational 1xx:
1885
1886 100 HTTP_CONTINUE Continue
1887 101 HTTP_SWITCHING_PROTOCOLS Switching Protocols
1888
1889 =item *
1890
1891 Successful 2xx:
1892
1893 200 HTTP_OK OK
1894 201 HTTP_CREATED Created
1895 202 HTTP_ACCEPTED Accepted
1896 203 HTTP_NON_AUTHORITATIVE Non-Authoritative Information
1897 204 HTTP_NO_CONTENT No Content
1898 205 HTTP_RESET_CONTENT Reset Content
1899 206 HTTP_PARTIAL_CONTENT Partial Content
1900
1901 =item *
1902
1903 Redirection 3xx:
1904
1905 300 HTTP_MULTIPLE_CHOICES Multiple Choices
1906 301 HTTP_MOVED_PERMANENTLY Moved Permanently
1907 302 HTTP_MOVED_TEMPORARILY Found
1908 303 HTTP_SEE_OTHER See Other
1909 304 HTTP_NOT_MODIFIED Not Modified
1910 305 HTTP_USE_PROXY Use Proxy
1911 306 (Unused)
1912 307 HTTP_TEMPORARY_REDIRECT Temporary Redirect
1913
1914 =item *
1915
1916 Client Error 4xx:
1917
1918 400 HTTP_BAD_REQUEST Bad Request
1919 401 HTTP_UNAUTHORIZED Unauthorized
1920 402 HTTP_PAYMENT_REQUIRED Payment Required
1921 403 HTTP_FORBIDDEN Forbidden
1922 404 HTTP_NOT_FOUND Not Found
1923 405 HTTP_METHOD_NOT_ALLOWED Method Not Allowed
1924 406 HTTP_NOT_ACCEPTABLE Not Acceptable
1925 407 HTTP_PROXY_AUTHENTICATION_REQUIRED Proxy Authentication Required
1926 408 HTTP_REQUEST_TIMEOUT Request Timeout
1927 409 HTTP_CONFLICT Conflict
1928 410 HTTP_GONE Gone
1929 411 HTTP_LENGTH REQUIRED Length Required
1930 412 HTTP_PRECONDITION_FAILED Precondition Failed
1931 413 HTTP_REQUEST_ENTITY_TOO_LARGE Request Entity Too Large
1932 414 HTTP_REQUEST_URI_TOO_LARGE Request-URI Too Long
1933 415 HTTP_UNSUPPORTED_MEDIA_TYPE Unsupported Media Type
1934 416 HTTP_RANGE_NOT_SATISFIABLE Requested Range Not Satisfiable
1935 417 HTTP_EXPECTATION_FAILED Expectation Failed
1936
1937 =item *
1938
1939 Server Error 5xx:
1940
1941 500 HTTP_INTERNAL_SERVER_ERROR Internal Server Error
1942 501 HTTP_NOT IMPLEMENTED Not Implemented
1943 502 HTTP_BAD_GATEWAY Bad Gateway
1944 503 HTTP_SERVICE_UNAVAILABLE Service Unavailable
1945 504 HTTP_GATEWAY_TIME_OUT Gateway Timeout
1946 505 HTTP_VERSION_NOT_SUPPORTED HTTP Version Not Supported
1947
1948 =back
1949
1950 =head2 References
1951
1952 All the information related to web protocols can be found at the World
1953 Wide Web Consortium site, I<http://www.w3.org/Protocols/>.
1954
1955 There are many mirrors of the RFCs all around the world. One of the
1956 good starting points might be I<http://www.rfc-editor.org/>.
1957
1958 The Eagle Book provided much of the HTTP constants material shown here
1959 I<http://www.modperl.com/book/chapters/ch9.html#The_Apache_Constants_Class>
17931960
17941961 =head1 Maintainers
17951962
18001967
18011968 =item *
18021969
1970 L<The mod_perl development team and numerous
1971 contributors|about::contributors::people>.
1972
1973
1974 =back
1975
1976
1977 =head1 Authors
1978
1979 =over
1980
1981 =item *
1982
18031983 Stas Bekman E<lt>stas (at) stason.orgE<gt>
1804
1805 =back
1806
1807
1808 =head1 Authors
1809
1810 =over
1811
1812 =item *
18131984
18141985 =back
18151986
645645 use warnings FATAL => 'all';
646646
647647 use Apache2::Connection ();
648 use Apache2::RequestRec ();
648649 use Apache2::RequestUtil ();
649650 use Apache2::HookRun ();
650651 use Apache2::Access ();
191191
192192 Do the following:
193193
194 % cd modperl-1.99_xx
194 % cd modperl-2.0.xx
195195 % make test TEST_VERBOSE=1 \
196196 TEST_FILES="compat/apache_util.t modperl/pnotes.t"
197197
198198 or use an alternative way:
199199
200 % cd modperl-1.99_xx
200 % cd modperl-2.0.xx
201201 % t/TEST -clean
202202 % t/TEST -verbose compat/apache_util.t modperl/pnotes.t
203203
217217 I<t/logs/error_log> file and re-run tests in the verbose mode. For
218218 example:
219219
220 % cd modperl-1.99_xx/ModPerl-Registry
220 % cd modperl-2.0.xx/ModPerl-Registry
221221 % t/TEST -clean
222222 % t/TEST -verbose closure.t
223223
158158
159159 # (--delete to ensure a clean state)
160160 % rsync -acvz --delete --force \
161 rsync://ftp.linux.activestate.com/perl-current/ perl-current
161 rsync://public.activestate.com/perl-current/ perl-current
162162
163163 If you are re-building Perl after rsync-ing, make sure to cleanup first:
164164
276276 I<http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz>.
277277
278278 For the purpose of examples in this chapter we will use the package
279 named I<mod_perl-2.x.xx.tar.gz>, where I<x.xx> should be replaced with
279 named I<mod_perl-2.x.x.tar.gz>, where I<x.x> should be replaced with
280280 the real version number.
281281
282282 Open the package with:
283283
284 % tar -xvzf mod_perl-2.x.xx.tar.gz
284 % tar -xvzf mod_perl-2.x.x.tar.gz
285285
286286 or an equivalent command.
287287
303303 Like any other Perl module, mod_perl is configured via the
304304 I<Makefile.PL> file, but requires one or more configuration options:
305305
306 % cd modperl-1.99_xx
306 % cd modperl-2.x.x
307307 % perl Makefile.PL <options>
308308
309309 where I<options> is an optional list of key/value pairs. These
375375 This will configure Apache by passing C<L<MP_AP_CONFIGURE|/MP_AP_CONFIGURE>>
376376 to Apache's F<./configure> script.
377377
378 Here is an example:
379
380 % cd ~/src
381 % tar -xvzf perl-5.8.x.tar.gz
382 % cd perl-5.8.x
383 % ./Configure -des
384 % make install
385 % cd ..
386 % tar -xvzf httpd-2.0.xx.tar.gz
387 % tar -xvzf mod_perl-2.x.x.tar.gz
388 % perl5.8.x Makefile.PL \
389 MP_USE_STATIC=1 \
390 MP_AP_PREFIX="$HOME/src/httpd-2.0.xx" \
391 MP_AP_CONFIGURE="--with-mpm=prefork"
392 % make
393 % make test
394 % make install
395 % ./httpd -l | grep perl
396 mod_perl.c
397
378398 =head2 mod_perl Build Options
379399
380400 =head3 Boolean Build Options
469489
470490 -DAP_DEBUG -Wall -Wmissing-prototypes -Wstrict-prototypes \
471491 -Wmissing-declarations \
472 -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER
473
474 If gcc version 3.3.2+ is found and C<-Wdeclaration-after-statement> is
492
493 If gcc version 3.3.2+ is found, not compiling on OpenBSD,
494 and C<-Wdeclaration-after-statement> is
475495 not already part of the C<gcc> flags add it.
476496
477497 To use this mode Apache must be build with
614634 same options. Simply C<chdir(1)> to the mod_perl source directory and
615635 run:
616636
617 % cd modperl-2.x.xx
637 % cd modperl-2.x.
618638 % perl -MApache2::Build -e rebuild
619639
620640
66 This chapter should give you a general idea about what mod_perl 2.0 is
77 and how it differs from mod_perl 1.0. This chapter presents the new
88 features of Apache 2.0, Perl 5.6.0 -- 5.8.0 and their influence on
9 mod_perl 2.0. The new MPM models from Apache 2.0 are discussed.
9 mod_perl 2.0. The new MPM models from Apache 2.0 are also discussed.
1010
1111
1212
6262 stronger and faster implementation based on lessons learned over the
6363 4.5 years since mod_perl was introduced.
6464
65 The new version includes a mechanism for an automatic building of the
65 The new version includes a mechanism for the automatic building of the
6666 Perl interface to Apache API, which allowed us to easily adjust
67 mod_perl 2.0 to ever changing Apache 2.0 API, during its development
67 mod_perl 2.0 to the ever changing Apache 2.0 API, during its development
6868 period. Another important feature is the
6969 C<L<Apache::Test|docs::general::testing::testing>> framework, which
7070 was originally developed for mod_perl 2.0, but then was adopted by
182182 L<threaded
183183 environment|docs::2.0::user::coding::coding/Threads_Coding_Issues_Under_mod_perl>.
184184
185 =item * New Hook Scheme
186
187 In Apache 1.3, modules were registered using the I<module> structure,
188 normally static to I<mod_foo.c>. This structure contains pointers to
189 the command table, configuration creation and merging functions,
190 response handler table and function pointers for all of the other
191 hooks, such as I<child_init> and I<check_user_id>. In Apache 2.0,
192 this structure has been pruned down to the first three items mentioned
193 and a new function pointer added called I<register_hooks>. It is the
194 job of I<register_hooks> to register functions for all other hooks
195 (such as I<child_init> and I<check_user_id>). Not only is hook
196 registration now dynamic, it is also possible for modules to register
197 more than one function per hook, unlike 1.3. The new hook mechanism
198 also makes it possible to sort registered functions, unlike 1.3 with
199 function pointers hardwired into the module structure, and each module
200 structure into a linked list. Order in 1.3 depended on this list,
201 which was possible to order using compile-time and startup-time
202 configuration, but that was left to the user. Whereas in 2.0, the
203 I<add_hook> functions accept an order preference parameter, those
204 commonly used are:
205
206 =over 4
207
208 =item FIRST
209
210 =item MIDDLE
211
212 =item LAST
213
214 =back
215
216 For mod_perl, dynamic registration provides a cleaner way to bypass
217 the C<Perl*Handler> configuration directives. By simply adding this
218 configuration:
219
220 PerlModule Apache2::Foo
221
222 C<Apache2::Foo> can register hooks itself at server startup:
223
224 Apache2::Hook->add(PerlAuthenHandler => \&authenticate,
225 Apache2::Hook::MIDDLE);
226 Apache2::Hook->add(PerlLogHandler => \&logger,
227 Apache2::Hook::LAST);
228
229 META: Not implemented yet (API will change?)
230
231 However, this means that Perl subroutines registered via this
232 mechanism will be called for B<every> request. It will be left to
233 that subroutine to decide if it was to handle or decline the given
234 phase. As there is overhead in entering the Perl runtime, it will
235 most likely be to your advantage to continue using C<Perl*Handler>
236 configuration directives to reduce this overhead. If it is the case
237 that your C<Perl*Handler> should be invoked for every request, the
238 hook registration mechanism will save some configuration keystrokes.
239
240185 =item * Protocol Modules
241186
242187 Apache 1.3 is hardwired to speak only one protocol, HTTP. Apache 2.0
306251 These are the important changes in the recent Perl versions that had
307252 an impact on mod_perl. For a complete list of changes see the
308253 corresponding to the used version I<perldelta> manpages
309 (I<http://perldoc.com/perl5.8.0/pod/perl56delta.html>,
310 I<http://perldoc.com/perl5.8.0/pod/perl561delta.html> and
311 I<http://perldoc.com/perl5.8.0/pod/perldelta.html>).
254 (I<http://perldoc.perl.org/perl56delta.html>,
255 I<http://perldoc.perl.org/perl561delta.html> and
256 I<http://perldoc.perl.org/perldelta.html>).
312257
313258 The 5.6 Perl generation has introduced the following features:
314259
322267 state of any given interpreter, it is possible to compile a piece of
323268 code once in an interpreter, clone that interpreter one or more times,
324269 and run all the resulting interpreters in distinct threads. See the
325 I<perlembed> (I<http://perldoc.com/perl5.6.1/pod/perlembed.html>) and
270 I<perlembed> (I<http://perldoc.perl.org/perlembed.html>) and
326271 I<perl561delta>
327 (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpages.
272 (I<http://perldoc.perl.org/perl561delta.html>) manpages.
328273
329274 =item *
330275
340285
341286 which will abort any code that generates warnings. This pragma also
342287 allows a fine control over what warnings should be reported. See the
343 I<perllexwarn> (I<http://perldoc.com/perl5.6.1/pod/perllexwarn.html>)
288 I<perllexwarn> (I<http://perldoc.perl.org/perllexwarn.html>)
344289 manpage.
345290
346291 =item *
348293 Certain C<CORE::> functions now can be overridden via
349294 C<CORE::GLOBAL::> namespace. For example mod_perl now can override
350295 C<CORE::exit()> via C<CORE::GLOBAL::exit>. See the I<perlsub>
351 (I<http://perldoc.com/perl5.6.1/pod/perlsub.html>) manpage.
296 (I<http://perldoc.perl.org/perlsub.html>) manpage.
352297
353298 =item *
354299
360305 The large file support. If you have filesystems that support "large
361306 files" (files larger than 2 gigabytes), you may now also be able to
362307 create and access them from Perl. See the I<perl561delta>
363 (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpage.
308 (I<http://perldoc.perl.org/perl561delta.html>) manpage.
364309
365310 =item *
366311
367312 Multiple performance enhancements were made. See the I<perl561delta>
368 (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpage.
313 (I<http://perldoc.perl.org/perl561delta.html>) manpage.
369314
370315 =item *
371316
372317 Numerous memory leaks were fixed. See the I<perl561delta>
373 (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpage.
318 (I<http://perldoc.perl.org/perl561delta.html>) manpage.
374319
375320 =item *
376321
377322 Improved security features: more potentially unsafe operations taint
378323 their results for improved security. See the I<perlsec>
379 (I<http://perldoc.com/perl5.6.1/pod/perlsec.html>) and I<perl561delta>
380 (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpages.
324 (I<http://perldoc.perl.org/perlsec.html>) and I<perl561delta>
325 (I<http://perldoc.perl.org/perl561delta.html>) manpages.
381326
382327 =item *
383328
399344 The introduced in 5.6.0 experimental PerlIO layer has been stabilized
400345 and become the default IO layer in 5.8.0. Now the IO stream can be
401346 filtered through multiple layers. See the I<perlapio>
402 (I<http://perldoc.com/perl5.8.0/pod/perlapio.html>) and I<perliol>
403 (I<http://perldoc.com/perl5.8.0/pod/perliol.html>) manpages.
347 (I<http://perldoc.perl.org/perlapio.html>) and I<perliol>
348 (I<http://perldoc.perl.org/perliol.html>) manpages.
404349
405350 For example this allows mod_perl to inter-operate with the APR IO
406351 layer and even use the APR IO layer in Perl code. See the
413358
414359 That is a literal C<undef()>, not an undefined value. See the
415360 C<open()> entry in the I<perlfunc> manpage
416 (I<http://perldoc.com/perl5.8.0/pod/func/open.html>).
361 (I<http://perldoc.perl.org/functions/open.html>).
417362
418363 =item *
419364
420365 More overridable via C<CORE::GLOBAL::> keywords. See the I<perlsub>
421 (I<http://perldoc.com/perl5.8.0/pod/perlsub.html>) manpage.
366 (I<http://perldoc.perl.org/perlsub.html>) manpage.
422367
423368 =item *
424369
440385 warnings are given. This is only meant as a temporary debugging aid
441386 while securing the code of old legacy applications. B<This is not a
442387 substitute for C<-T>.> See the I<perlrun>
443 (I<http://perldoc.com/perl5.8.0/pod/perlrun.html>) manpage.
388 (I<http://perldoc.perl.org/perlrun.html>) manpage.
444389
445390 A new special variable C<${^TAINT}> was introduced. It indicates
446391 whether taint mode is enabled. See the I<perlvar>
447 (I<http://perldoc.com/perl5.8.0/pod/perlvar.html>) manpage.
392 (I<http://perldoc.perl.org/perlvar.html>) manpage.
448393
449394 =item *
450395
498443 interpreter created at startup time compiles any pre-loaded Perl code.
499444 A I<clone> is created from the parent using the Perl API
500445 I<perl_clone()>
501 (I<http://www.perldoc.com/perl5.8.0/pod/perlapi.html#Cloning-an-interpreter>)
446 (I<http://perldoc.perl.org/perlapi.html#Cloning-an-interpreter>)
502447 function. At request time, I<parent> interpreters are only used for
503448 making more I<clones>, as the I<clones> are the interpreters which
504449 actually handle requests. Care is taken by Perl to copy only mutable
577522 the XS code was written for them here and there.
578523
579524 mod_perl 2.0 generates the majority of XS code and provides thin
580 wrappers were needed to make the API more Perlish. As part of this
525 wrappers where needed to make the API more Perlish. As part of this
581526 goal, nearly the entire APR and Apache API, along with their public
582527 data structures are covered from the get-go. Certain functions and
583528 structures which are considered "private" to Apache or otherwise
1313
1414 First, L<download|download::index> the mod_perl 2.0 source.
1515
16 Before installing mod_perl, you need check that you have the
16 Before installing mod_perl, you need to check that you have the
1717 L<mod_perl 2.0
1818 prerequisites|docs::2.0::user::install::install/Prerequisites> B<installed>.
1919 Apache and the right Perl version have to be built and installed
9292
9393 =head1 Registry Scripts
9494
95 To enable registry scripts add to I<httpd.conf>:
95 To enable registry scripts add the following to I<httpd.conf>:
9696
9797 Alias /perl/ /home/httpd/httpd-2.0/perl/
9898 <Location /perl/>
100100 PerlResponseHandler ModPerl::Registry
101101 PerlOptions +ParseHeaders
102102 Options +ExecCGI
103 Order allow,deny
104 Allow from all
103105 </Location>
104106
105107 and now assuming that we have the following script:
126128
127129 For more information on the registry scripts refer to the
128130 C<L<ModPerl::Registry|docs::2.0::api::ModPerl::Registry>>
129 manapage. (XXX: on day there will a tutorial on registry, should port
131 manpage. (XXX: one day there will a tutorial on registry, should port
130132 it from 1.0's docs).
131133
132134
351351 use warnings;
352352
353353 use mod_perl;
354 use constant MP2 => $mod_perl::VERSION >= 1.99;
354 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
355 $ENV{MOD_PERL_API_VERSION} >= 2 );
356
355357
356358 BEGIN {
357359 if (MP2) {
486488 Instead use C<$ENV{MOD_PERL}> (available in both mod_perl
487489 generations), which is set to the mod_perl version, like so:
488490
489 mod_perl/1.99_03-dev
491 mod_perl/2.000002
490492
491493 Therefore in order to check whether you are running under mod_perl,
492494 you'd say:
494496 if ($ENV{MOD_PERL}) { ... }
495497
496498 To check for a specific version it's better to use
497 C<$mod_perl::VERSION>:
499 C<$ENV{MOD_PERL_API_VERSION}>
498500
499501 use mod_perl;
500 use constant MP2 => ($mod_perl::VERSION >= 1.99);
501
502
502 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
503 $ENV{MOD_PERL_API_VERSION} >= 2 );
503504
504505
505506
933934 C<$s-E<gt>register_cleanup> has been replaced with
934935 C<L<APR::Pool::cleanup_register()|docs::2.0::api::APR::Pool/C_cleanup_register_>>
935936 which accepts the pool object as the first argument instead of the
936 server object. e.g.:
937 server object, a callback function as a second and data variable as
938 the optional third argument. If that data argument was provided it is
939 then passed to the callback function when the time comes for the pool
940 object to get destroyed.
937941
938942 use Apache2::ServerUtil ();
939943 sub cleanup_callback {
940 my ($pool, $s) = @_;
944 my $data = shift;
941945 # your code comes here
942 Apache2::Const::OK;
946 return Apache2::Const::OK;
943947 }
944 $s->push_handlers(PerlChildExitHandler => \&my_access);
945
946 where the arguments are the pool and server objects.
948 $s->pool->cleanup_register(\&cleanup_callback, $data);
947949
948950 See also
949951 C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>>.
993995
994996
995997
998 =head2 C<$r-E<gt>print>
999
1000 $r->print($foo);
1001
1002 or
1003
1004 print $foo;
1005
1006 no longer accepts a reference to a scalar as it did in mod_perl
1007 1.0. This optimisation is not needed in the mod_perl 2.0's
1008 implementation of C<print>.
1009
1010
1011
1012
9961013 =head2 C<$r-E<gt>cgi_env>
9971014
9981015 See the next item
11041121 C<L<Apache2::compat|docs::2.0::api::Apache2::compat>> (it's slower).
11051122
11061123 However, now that C<Apache2::Request> has been ported to mod_perl 2.0
1107 you can use it instead and reap the benefits of the fast C impelentations
1124 you can use it instead and reap the benefits of the fast C implementations
11081125 of these functions. For documentation on its uses, please see:
11091126
11101127 http://httpd.apache.org/apreq
12621279
12631280 =head2 C<$r-E<gt>register_cleanup>
12641281
1265 C<$r-E<gt>register_cleanup> has been replaced with
1282 Similarly to C<$s-E<gt>register_cleanup>, C<$r-E<gt>register_cleanup>
1283 has been replaced with
12661284 C<L<APR::Pool::cleanup_register()|docs::2.0::api::APR::Pool/C_cleanup_register_>>
12671285 which accepts the pool object as the first argument instead of the
12681286 request object. e.g.:
18141832 Here is how to write a simple I<Makefile.PL> for modules wanting to
18151833 build XS code against mod_perl 2.0:
18161834
1817 use mod_perl 1.99;
1835 use mod_perl 2.0;
18181836 use ModPerl::MM ();
18191837
18201838 ModPerl::MM::WriteMakefile(
12081208
12091209 To continue our example above, let's say we want to support opening a
12101210 filehandle in both mod_perl 2.0 and mod_perl 1.0. Our code can make
1211 use of the variable C<$mod_perl::VERSION>:
1211 use of the environment variable C<$ENV{MOD_PERL_API_VERSION}>
12121212
12131213 use mod_perl;
1214 use constant MP2 => ($mod_perl::VERSION >= 1.99);
1214 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
1215 $ENV{MOD_PERL_API_VERSION} >= 2 );
12151216 # ...
12161217 require Symbol if MP2;
12171218 # ...
12181219
12191220 my $fh = MP2 ? Symbol::gensym : Apache->gensym;
12201221 open $fh, $file or die "Can't open $file: $!";
1221
1222 Though, make sure that you don't use C<$mod_perl::VERSION> string
1223 anywhere in the code before you have declared your module's own
1224 C<$VERSION>, since PAUSE will pick the wrong version when you submit
1225 the module on CPAN. It requires that module's C<$VERSION> will be
1226 declared first. You can verify whether it'll pick the I<Foo.pm>'s
1227 version correctly, by running this code:
1228
1229 % perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' Foo.pm
1230
1231 There is more information about this issue here:
1232 http://pause.perl.org/pause/query?ACTION=pause_04about#conventions
12331222
12341223 Some modules, like C<CGI.pm> may work under mod_perl and without it,
12351224 and will want to use the mod_perl 1.0 API if that's available, or
12371226 this purpose.
12381227
12391228 use constant MP_GEN => $ENV{MOD_PERL}
1240 ? eval { require mod_perl; $mod_perl::VERSION >= 1.99 ? 2 : 1 }
1229 ? { ( exists $ENV{MOD_PERL_API_VERSION} and
1230 $ENV{MOD_PERL_API_VERSION} >= 2 ) ? 2 : 1 }
12411231 : 0;
12421232
12431233 It sets the constant C<MP_GEN> to 0 if mod_perl is not available, to 1
13211311 use warnings;
13221312
13231313 use mod_perl;
1324 use constant MP2 => $mod_perl::VERSION < 1.99 ? 0 : 1;
1314 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
1315 $ENV{MOD_PERL_API_VERSION >= 2 );
13251316
13261317 BEGIN {
13271318 if (MP2) {
13761367 use warnings;
13771368
13781369 use mod_perl;
1379 use constant MP2 => $mod_perl::VERSION < 1.99 ? 0 : 1;
1370 use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
1371 $ENV{MOD_PERL_API_VERSION >= 2 );
13801372
13811373 BEGIN {
1382 warn "running $mod_perl::VERSION!\n";
1374 warn "running $ENV{MOD_PERL_API_VERSION}\n";
13831375 if (MP2) {
13841376 require Apache2::RequestRec;
13851377 require Apache2::RequestIO;
479479
480480 =head2 Error about not finding I<Apache.pm> with I<CGI.pm>
481481
482 You need to install at least version 2.87 of CGI.pm to work
482 You need to install at least version 3.11 of CGI.pm to work
483483 under mod_perl 2.0, as earlier CGI.pm versions aren't
484484 mod_perl 2.0 aware.
485485
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2000-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
226227
227228 sub apxs_extra_cppflags {
228229 my $who = caller_package(shift);
229 my $flags = $who->apxs('-q' => 'EXTRA_CPPFLAGS');
230 my $flags = $who->apxs('-q' => 'EXTRA_CPPFLAGS') ." ".
231 $who->apxs('-q' => 'NOTEST_CPPFLAGS');
230232 $flags =~ s/\"/\\\"/g;
231233 $flags;
232234 }
523525 $self->{MP_DEBUG} = 1;
524526 if ($self->perl_config('gccversion')) {
525527 #same as --with-maintainter-mode
526 $ccopts .= " $Wall -DAP_DEBUG";
527 $ccopts .= " -DAP_HAVE_DESIGNATED_INITIALIZER";
528 }
529
530 if ($self->has_gcc_version('3.3.2') &&
528 $ccopts .= " $Wall";
529 }
530
531 if (!OPENBSD &&
532 $self->has_gcc_version('3.3.2') &&
531533 $ccopts !~ /declaration-after-statement/) {
532534 debug "Adding -Wdeclaration-after-statement to ccopts";
533535 $ccopts .= " -Wdeclaration-after-statement";
11151117 # first use apu_config_path and then apr_config_path in order to
11161118 # resolve the symbols right during linking
11171119 for ($self->apu_config_path, $self->apr_config_path) {
1118 if (my $link = $_ && -x $_ && qx{$_ --link-ld --libs}) {
1120 my $flags = '--link-ld --libs';
1121 $flags .= ' --ldflags' unless (WIN32);
1122 if (my $link = $_ && -x $_ && qx{$_ $flags}) {
11191123 chomp $link;
11201124
11211125 # Change '/path/to/libanything.la' to '-L/path/to -lanything'
13751379 my $major = $1;
13761380 my $minor = (split /\s+/, scalar(<$fh>))[-1];
13771381 my $patch = (split /\s+/, scalar(<$fh>))[-1];
1378 my $string = (split /\s+/, scalar(<$fh>))[-1];
1379 $version = join '.', $major, $minor, "$patch$string";
1382
1383 my ($define, $macro, $dev) = (split /\s+/, scalar(<$fh>));
1384
1385 if ($macro =~ /AP_SERVER_DEVBUILD_BOOLEAN/ && $dev eq '1') {
1386 $dev = "-dev";
1387 }
1388 else {
1389 $dev = "";
1390 }
1391
1392 $version = join '.', $major, $minor, "$patch$dev";
13801393 $version =~ s/\"//g;
13811394 last;
13821395 }
16431656 sub apache_libs_MSWin32 {
16441657 my $self = shift;
16451658 my $prefix = $self->apxs(-q => 'PREFIX') || $self->dir;
1646 my @libs = map { "$prefix/lib/lib$_.lib" } qw(apr aprutil httpd);
1659 my $lib = catdir $prefix, 'lib';
1660 opendir(my $dir, $lib) or die qq{Cannot opendir $lib: $!};
1661 my @libs = map {catfile($lib, $_)}
1662 grep /^lib(apr|aprutil|httpd)\b\S*?\.lib$/, readdir $dir;
1663 closedir $dir;
16471664 "@libs";
16481665 }
16491666
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2004 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
3940
4041 my @saved;
4142 sub save { return $Apache2::PerlSections::Save }
43 sub server { return $Apache2::PerlSections::Server }
4244 sub saved { return @saved }
4345
4446 sub handler : method {
6365 {
6466 no strict 'refs';
6567 foreach my $package ($self->package) {
66 $self->dump_special(${"${package}::$special"},
67 @{"${package}::$special"} );
68 my @config = map { split /\n/ }
69 grep { defined }
70 (@{"${package}::$special"},
71 ${"${package}::$special"});
72 $self->dump_special(@config);
6873 }
6974 }
7075
128133 sub dump_hash {
129134 my ($self, $name, $hash) = @_;
130135
131 for my $entry (sort keys %{ $hash || {} }) {
136 for my $entry (keys %{ $hash || {} }) {
132137 my $item = $hash->{$entry};
133138 my $type = ref($item);
134139
148153
149154 $self->add_config("<$name $loc>\n");
150155
151 for my $entry (sort keys %{ $hash || {} }) {
156 for my $entry (keys %{ $hash || {} }) {
152157 $self->dump_entry($entry, $hash->{$entry});
153158 }
154159
191196 }
192197
193198 sub add_config {
194 my ($self, $config) = @_;
195 return unless defined $config;
196 chomp($config);
197 push @{ $self->directives }, $config;
199 my ($self, @config) = @_;
200 foreach my $config (@config) {
201 return unless defined $config;
202 chomp($config);
203 push @{ $self->directives }, $config;
204 }
198205 }
199206
200207 sub post_config {
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
130131
131132 my $ReloadDirs = ref($o) && $o->dir_config("ReloadDirectories");
132133 my @watch_dirs = split(/\s+/, $ReloadDirs||'');
134
135 my @changed;
133136 foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
134137 my $file = $Apache2::Reload::INCS{$key};
135138
154157 }
155158
156159 if ($mtime > $Stat{$file}) {
157 my $package = module_to_package($key);
158 ModPerl::Util::unload_package($package);
159 require $key;
160 warn("Apache2::Reload: process $$ reloading $package from $key\n")
161 if $DEBUG;
160 push @changed, $key;
162161 }
163162 $Stat{$file} = $mtime;
163 }
164
165 #First, let's unload all changed modules
166 foreach my $module (@changed) {
167 my $package = module_to_package($module);
168 ModPerl::Util::unload_package($package);
169 }
170
171 #Then, let's reload them all, so that module dependencies can satisfy
172 #themselves in the correct order.
173 foreach my $module (@changed) {
174 my $package = module_to_package($module);
175 require $module;
176 warn("Apache2::Reload: process $$ reloading $package from $module\n")
177 if $DEBUG;
164178 }
165179
166180 return Apache2::Const::OK;
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
129130
130131 if ($ENV{MOD_PERL}) {
131132 if ($ENV{PERL_RLIMIT_DEFAULTS}) {
132 Apache2->server->push_handlers(
133 require Apache2::ServerUtil;
134 Apache2::ServerUtil->server->push_handlers(
133135 PerlChildInitHandler => \&default_handler);
134136 }
135137
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
2930 use constant WIN32 => $^O eq 'MSWin32';
3031 use constant SOLARIS => $^O eq 'solaris';
3132 use constant LINUX => $^O eq 'linux';
32 use constant BSD_LIKE => $^O =~ /(bsd|aix|darwin)/i;
33 use constant BSD_LIKE => $^O =~ /(bsd|aix)/i;
3334
3435 use Apache2::Const -compile => qw(OK DECLINED);
3536
109110 sub linux_smaps_size_check {
110111
111112 my $s = Linux::Smaps->new($$)->all;
112 return ($s->size, $s->shared_cleani + $s->shared_dirty);
113 return ($s->size, $s->shared_clean + $s->shared_dirty);
113114 }
114115
115116 # return process size (in KB)
137138 return ($size, 0);
138139 }
139140
140 sub bsd_size_check {
141 return (BSD::Resource::getrusage())[ 2, 3 ];
141 # rss is in KB but ixrss is in BYTES.
142 # This is true on at least FreeBSD, OpenBSD, NetBSD
143 # Philip M. Gollucci
144 sub _bsd_size_check {
145
146 my @results = BSD::Resource::getrusage();
147 my $max_rss = $results[2];
148 my $max_ixrss = int ( $results[3] / 1024 );
149
150 return ( $max_rss, $max_ixrss );
142151 }
143152
144153 sub win32_size_check {
188197 $START_TIME ||= time;
189198
190199 my ($size, $share) = $HOW_BIG_IS_IT->();
191
192 if (($MAX_PROCESS_SIZE && $size > $MAX_PROCESS_SIZE) ||
193 ($MIN_SHARE_SIZE && $share < $MIN_SHARE_SIZE) ||
194 ($MAX_UNSHARED_SIZE && ($size - $share) > $MAX_UNSHARED_SIZE)) {
195
200 my $unshared = $size - $share;
201
202 my $kill_size = $MAX_PROCESS_SIZE && $size > $MAX_PROCESS_SIZE;
203 my $kill_share = $MIN_SHARE_SIZE && $share < $MIN_SHARE_SIZE;
204 my $kill_unshared = $MAX_UNSHARED_SIZE && $unshared > $MAX_UNSHARED_SIZE;
205
206 if ($kill_size || $kill_share || $kill_unshared) {
196207 # wake up! time to die.
197208 if (WIN32 || ( getppid > 1 )) {
198209 # this is a child httpd
199210 my $e = time - $START_TIME;
200 my $msg = "httpd process too big, exiting at SIZE=$size KB ";
201 $msg .= " SHARE=$share KB " if $share;
211 my $msg = "httpd process too big, exiting at SIZE=$size/$MAX_PROCESS_SIZE KB ";
212 $msg .= " SHARE=$share/$MIN_SHARE_SIZE KB " if $share;
213 $msg .= " UNSHARED=$unshared/$MAX_UNSHARED_SIZE KB " if $unshared;
202214 $msg .= " REQUESTS=$REQUEST_COUNT LIFETIME=$e seconds";
203215 error_log($msg);
204216
205217 $r->child_terminate();
206218 }
207219 else { # this is the main httpd, whose parent is init?
208 my $msg = "main process too big, SIZE=$size KB ";
209 $msg .= " SHARE=$share KB" if $share;
220 my $msg = "main process too big, SIZE=$size/$MAX_PROCESS_SIZE KB ";
221 $msg .= " SHARE=$share/$MIN_SHARE_SIZE KB" if $share;
222 $msg .= " UNSHARED=$unshared/$MAX_UNSHARED_SIZE KB" if $unshared;
210223 error_log($msg);
211224 }
212225 }
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
5859 lexinfo => ["StatusLexInfo", "B::LexInfo", 0, ],
5960 xref => ["StatusXref", "B::Xref", 1.01, ],
6061 terse => ["StatusTerse", "B::Terse", 0, ],
61 tersesize => ["StatusTerseSize", "B::TerseSize", 0, ],
62 packagesize => ["StatusPackageSize", "B::TerseSize", 0, ],
62 tersesize => ["StatusTerseSize", "B::TerseSize", 0.07, ],
63 packagesize => ["StatusPackageSize", "B::TerseSize", 0.07, ],
6364 peek => ["StatusPeek", "Apache::Peek", 1.03, ],
6465 );
6566
215216 $module =~ s,\.pm$,,;
216217 next if $module eq 'mod_perl';
217218 my $v = ${"$module\:\:VERSION"} || '0.00';
219 my $mtime = -e $INC{$file} ? scalar localtime((stat $INC{$file})[9]) :
220 'N/A';
221
218222 push @retval, (
219223 "<tr>",
220224 (map "<td>$_</td>",
221225 qq(<a href="$uri?$module">$module</a>),
222 $v, scalar localtime((stat $INC{$file})[9]), $INC{$file}),
226 $v, $mtime, $INC{$file}),
223227 "</tr>\n"
224228 );
225229 }
547551 $_;
548552 } (sort { $subs->{$b}->{size} <=> $subs->{$a}->{size} } keys %$subs);
549553
550 my $clen = length $subs->{$keys[0]}->{count};
554 my $clen = $subs->{$keys[0]}->{count} ?
555 length $subs->{$keys[0]}->{count} : 0;
551556 my $slen = length $subs->{$keys[0]}->{size};
552557
553558 for my $name (@keys) {
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
7475 $build ||= build_config();
7576 ModPerl::MM::my_import(__PACKAGE__);
7677
77 my $inc = $build->inc;
78 my $inc;
79 $inc = $args{INC} if $args{INC};
80 $inc = " " . $build->inc;
7881 if (my $glue_inc = $build->{MP_XS_GLUE_DIR}) {
7982 for (split /\s+/, $glue_inc) {
8083 $inc .= " -I$_";
8386
8487 my $libs;
8588 my @libs = ();
89 push @libs, $args{LIBS} if $args{LIBS};
8690 if (Apache2::Build::BUILD_APREXT) {
8791 # in order to decouple APR/APR::* from mod_perl.so,
8892 # link these modules against the static MP_APR_LIB lib,
104108 }
105109 $libs = join ' ', @libs;
106110
107 my $ccflags = $build->perl_ccopts . $build->ap_ccopts;
111 my $ccflags;
112 $ccflags = $args{CCFLAGS} if $args{CCFLAGS};
113 $ccflags = " " . $build->perl_ccopts . $build->ap_ccopts;
114
115 my $optimize;
116 $optimize = $args{OPTIMIZE} if $args{OPTIMIZE};
117 $optimize = " " . $build->perl_config('optimize');
118
119 my $lddlflags;
120 $lddlflags = $args{LDDLFLAGS} if $args{LDDLFLAGS};
121 $lddlflags = " " . $build->perl_config('lddlflags');
122
123 my %dynamic_lib;
124 %dynamic_lib = %{ $args{dynamic_lib}||{} } if $args{dynamic_lib};
125 $dynamic_lib{OTHERLDFLAGS} = $build->otherldflags;
108126
109127 my @opts = (
110 INC => $inc,
111 CCFLAGS => $ccflags,
112 OPTIMIZE => $build->perl_config('optimize'),
113 LDDLFLAGS => $build->perl_config('lddlflags'),
114 LIBS => $libs,
115 dynamic_lib => { OTHERLDFLAGS => $build->otherldflags },
128 INC => $inc,
129 CCFLAGS => $ccflags,
130 OPTIMIZE => $optimize,
131 LDDLFLAGS => $lddlflags,
132 LIBS => $libs,
133 dynamic_lib => \%dynamic_lib,
116134 );
117135
118136 my @typemaps;
137 push @typemaps, $args{TYPEMAPS} if $args{TYPEMAPS};
119138 my $pwd = Cwd::fastcwd();
120139 for ('xs', $pwd, "$pwd/..") {
121140 my $typemap = $build->file_path("$_/typemap");
192211 # allow 'make -j'
193212 require ExtUtils::MakeMaker;
194213 my $mm_ver = $ExtUtils::MakeMaker::VERSION;
214 $mm_ver =~ s/_.*//; # handle dev versions like 6.30_01
195215 my $pm_to_blib = ($mm_ver >= 6.22 && $mm_ver <= 6.25)
196216 ? "pm_to_blib.ts"
197217 : "pm_to_blib";
0 # Copyright 2000-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
119120 # MP_AP_PREFIX may not contain spaces
120121 require Win32;
121122 $val = Win32::GetShortPathName($val);
123 }
124
125 if (!$val || !-d $val) {
126 error "MP_AP_PREFIX must point to a valid directory.";
127 die "\n";
122128 }
123129 }
124130
0 # Copyright 2000-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
136137 my @ithread_opts = qw(CLONE PARENT);
137138 my %flags = (
138139 Srv => ['NONE', @ithread_opts, qw(ENABLE AUTOLOAD MERGE_HANDLERS),
139 @hook_flags, 'UNSET'],
140 @hook_flags, 'UNSET','INHERIT_SWITCHES'],
140141 Dir => [qw(NONE PARSE_HEADERS SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)],
141142 Req => [qw(NONE SET_GLOBAL_REQUEST PARSE_HEADERS SETUP_ENV
142143 CLEANUP_REGISTERED PERL_SET_ENV_DIR PERL_SET_ENV_SRV)],
459460 push @lookup, $indent1 . " case '$_':";
460461 push @lookup, map { $indent2 . $_ } @{ $switch{$_} };
461462 }
462 push @lookup, map { $indent1 . $_ } ("}\n", "return 0;\n}\n\n");
463 push @lookup, map { $indent1 . $_ } ("}\n", "return -1;\n}\n\n");
463464
464465 print $c_fh join "\n", @lookup;
465466 print $h_fh "$lookup_proto;\n";
777778 my $xsinit = "$self->{path}/modperl_xsinit.c";
778779 debug "generating...$xsinit";
779780
781 # There's a possibility that $Config{static_ext} may contain spaces
782 # and ExtUtils::Embed::xsinit won't handle the situation right. In
783 # this case we'll get buggy "boot_" statements in modperl_xsinit.c.
784 # Fix this by cleaning the @Extensions array.
785
786 # Loads @Extensions if not loaded
787 ExtUtils::Embed::static_ext();
788
789 @ExtUtils::Embed::Extensions = grep{$_} @ExtUtils::Embed::Extensions;
790
780791 #create bootstrap method for static xs modules
781792 my $static_xs = [keys %{ $build->{XS} }];
782793 ExtUtils::Embed::xsinit($xsinit, 1, $static_xs);
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
33 # * This file generated by ModPerl::WrapXS/0.01
44 # * Any changes made here will be lost
55 # * ***********************************
6 # * 01: lib/ModPerl/Code.pm:708
7 # * 02: lib/ModPerl/WrapXS.pm:1126
8 # * 03: lib/ModPerl/WrapXS.pm:1177
6 # * 01: lib/ModPerl/Code.pm:709
7 # * 02: lib/ModPerl/WrapXS.pm:1127
8 # * 03: lib/ModPerl/WrapXS.pm:1178
99 # * 04: Makefile.PL:423
1010 # * 05: Makefile.PL:325
1111 # * 06: Makefile.PL:56
1313 #
1414
1515 package APR::Util;
16 $APR::Util::VERSION = 0.009000;
16 $APR::Util::VERSION = 0.009000;
1717
1818 package APR::Base64;
19 $APR::Base64::VERSION = 0.009000;
19 $APR::Base64::VERSION = 0.009000;
2020
2121 package Apache2::Process;
22 $Apache2::Process::VERSION = 2.000002;
22 $Apache2::Process::VERSION = 2.000003;
2323
2424 package Apache2::HookRun;
25 $Apache2::HookRun::VERSION = 2.000002;
25 $Apache2::HookRun::VERSION = 2.000003;
2626
2727 package APR::Bucket;
28 $APR::Bucket::VERSION = 0.009000;
28 $APR::Bucket::VERSION = 0.009000;
2929
3030 package Apache2::Command;
31 $Apache2::Command::VERSION = 2.000002;
31 $Apache2::Command::VERSION = 2.000003;
32
33 package Apache2::ConnectionUtil;
34 $Apache2::ConnectionUtil::VERSION = 2.000003;
3235
3336 package APR::Finfo;
34 $APR::Finfo::VERSION = 0.009000;
37 $APR::Finfo::VERSION = 0.009000;
3538
3639 package APR::SockAddr;
37 $APR::SockAddr::VERSION = 0.009000;
40 $APR::SockAddr::VERSION = 0.009000;
3841
3942 package ModPerl::Global;
40 $ModPerl::Global::VERSION = 2.000002;
43 $ModPerl::Global::VERSION = 2.000003;
4144
4245 package Apache2::FilterRec;
43 $Apache2::FilterRec::VERSION = 2.000002;
46 $Apache2::FilterRec::VERSION = 2.000003;
4447
4548 package APR::BucketType;
46 $APR::BucketType::VERSION = 0.009000;
49 $APR::BucketType::VERSION = 0.009000;
4750
4851 package Apache2::MPM;
49 $Apache2::MPM::VERSION = 2.000002;
52 $Apache2::MPM::VERSION = 2.000003;
5053
5154 package Apache2::Directive;
52 $Apache2::Directive::VERSION = 2.000002;
55 $Apache2::Directive::VERSION = 2.000003;
5356
5457 package APR::Error;
55 $APR::Error::VERSION = 0.009000;
58 $APR::Error::VERSION = 0.009000;
5659
5760 package Apache2::Filter;
58 $Apache2::Filter::VERSION = 2.000002;
61 $Apache2::Filter::VERSION = 2.000003;
5962
6063 package Apache2::Util;
61 $Apache2::Util::VERSION = 2.000002;
64 $Apache2::Util::VERSION = 2.000003;
6265
6366 package APR::Date;
64 $APR::Date::VERSION = 0.009000;
67 $APR::Date::VERSION = 0.009000;
6568
6669 package Apache2::CmdParms;
67 $Apache2::CmdParms::VERSION = 2.000002;
70 $Apache2::CmdParms::VERSION = 2.000003;
6871
6972 package Apache2::Log;
70 $Apache2::Log::VERSION = 2.000002;
73 $Apache2::Log::VERSION = 2.000003;
7174
7275 package Apache2::ServerUtil;
73 $Apache2::ServerUtil::VERSION = 2.000002;
76 $Apache2::ServerUtil::VERSION = 2.000003;
7477
7578 package Apache2::RequestUtil;
76 $Apache2::RequestUtil::VERSION = 2.000002;
79 $Apache2::RequestUtil::VERSION = 2.000003;
7780
7881 package Apache2::URI;
79 $Apache2::URI::VERSION = 2.000002;
82 $Apache2::URI::VERSION = 2.000003;
8083
8184 package APR::UUID;
82 $APR::UUID::VERSION = 0.009000;
85 $APR::UUID::VERSION = 0.009000;
8386
8487 package APR::Table;
85 $APR::Table::VERSION = 0.009000;
88 $APR::Table::VERSION = 0.009000;
8689
8790 package APR::Status;
88 $APR::Status::VERSION = 0.009000;
91 $APR::Status::VERSION = 0.009000;
8992
9093 package Apache2::Connection;
91 $Apache2::Connection::VERSION = 2.000002;
94 $Apache2::Connection::VERSION = 2.000003;
9295
9396 package Apache2::ServerRec;
94 $Apache2::ServerRec::VERSION = 2.000002;
97 $Apache2::ServerRec::VERSION = 2.000003;
9598
9699 package ModPerl::Util;
97 $ModPerl::Util::VERSION = 2.000002;
100 $ModPerl::Util::VERSION = 2.000003;
98101
99102 package Apache2::SubRequest;
100 $Apache2::SubRequest::VERSION = 2.000002;
103 $Apache2::SubRequest::VERSION = 2.000003;
101104
102105 package APR::URI;
103 $APR::URI::VERSION = 0.009000;
106 $APR::URI::VERSION = 0.009000;
104107
105108 package Apache2::RequestIO;
106 $Apache2::RequestIO::VERSION = 2.000002;
109 $Apache2::RequestIO::VERSION = 2.000003;
107110
108111 package APR::Brigade;
109 $APR::Brigade::VERSION = 0.009000;
112 $APR::Brigade::VERSION = 0.009000;
110113
111114 package APR::ThreadMutex;
112 $APR::ThreadMutex::VERSION = 0.009000;
115 $APR::ThreadMutex::VERSION = 0.009000;
113116
114117 package APR::BucketAlloc;
115 $APR::BucketAlloc::VERSION = 0.009000;
118 $APR::BucketAlloc::VERSION = 0.009000;
116119
117120 package Apache2::SubProcess;
118 $Apache2::SubProcess::VERSION = 2.000002;
121 $Apache2::SubProcess::VERSION = 2.000003;
119122
120123 package Apache2::Response;
121 $Apache2::Response::VERSION = 2.000002;
124 $Apache2::Response::VERSION = 2.000003;
122125
123126 package APR::IpSubnet;
124 $APR::IpSubnet::VERSION = 0.009000;
127 $APR::IpSubnet::VERSION = 0.009000;
125128
126129 package Apache2::RequestRec;
127 $Apache2::RequestRec::VERSION = 2.000002;
130 $Apache2::RequestRec::VERSION = 2.000003;
128131
129132 package Apache2::Module;
130 $Apache2::Module::VERSION = 2.000002;
133 $Apache2::Module::VERSION = 2.000003;
131134
132135 package APR::OS;
133 $APR::OS::VERSION = 0.009000;
136 $APR::OS::VERSION = 0.009000;
134137
135138 package APR::Socket;
136 $APR::Socket::VERSION = 0.009000;
139 $APR::Socket::VERSION = 0.009000;
137140
138141 package Apache2::Access;
139 $Apache2::Access::VERSION = 2.000002;
142 $Apache2::Access::VERSION = 2.000003;
140143
141144 package APR::String;
142 $APR::String::VERSION = 0.009000;
145 $APR::String::VERSION = 0.009000;
143146
144147 package APR::Pool;
145 $APR::Pool::VERSION = 0.009000;
148 $APR::Pool::VERSION = 0.009000;
146149
147150 package ModPerl::MethodLookup;
148 $ModPerl::MethodLookup::VERSION = 2.000002;
151 $ModPerl::MethodLookup::VERSION = 2.000003;
149152
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2000-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2002-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
3839 my @files;
3940
4041 my $cwd = Cwd::cwd();
41
42 finddepth({ follow => 1, wanted => sub {
43 return unless $_ eq 'entries';
44 return unless $File::Find::dir =~ /\.svn$/;
45
46 my $dir = dirname $File::Find::dir;
47 $dir =~ s,^$cwd/?,,;
48
49 open my $fh, $_ or die "open $_: $!";
50 while (my $line = <$fh>) {
51 if ($line =~ /name\s*=\s*"([^"]*)"/) {
52 my $file = $1;
53 next if $file eq 'svn:this_dir';
54 next if !$file or -d "../$file" or $file =~ /^\./;
55 push @files, $dir ? "$dir/$file" : $file;
56 }
42 my @lines = `svn status -v` ;
43 foreach my $line (@lines) {
44 chomp $line;
45 if ($line =~ /(?:\d+)\s+(?:\d+)\s+(?:\w+)\s+(.*)\s*/) {
46 my $file = $1;
47 if (-e $file && ! -d $file) {
48 push @files, $1 if -e $1;
49 }
5750 }
58 close $fh;
59
60 }}, $cwd);
51 }
6152
6253 # files to add which aren't under svn
6354 push @files, qw(lib/ModPerl/DummyVersions.pm);
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2003-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2002-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 # Copyright 2000-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
1516
1617 use 5.006;
1718 use strict;
18 use File::Spec::Functions;
1919
2020 BEGIN {
21 our $VERSION = "2.000002";
21 our $VERSION = "2.000003";
2222 our $VERSION_TRIPLET;
2323
2424 if ($VERSION =~ /(\d+)\.(\d\d\d)(\d+)/) {
4848 # startup you are protected against loading mod_perl.pm
4949 # (either 1.0 or 1.99) at a later time by accident.
5050 $mod_perl::VERSION = $mod_perl2::VERSION;
51 $INC{"mod_perl.pm"} = File::Spec::Functions::devnull();
51 $INC{"mod_perl.pm"} = __FILE__;
5252
5353 1;
5454 __END__
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
484485 #ifdef USE_ITHREADS
485486 static void modperl_init_clones(server_rec *s, apr_pool_t *p)
486487 {
488 #ifdef MP_TRACE
487489 modperl_config_srv_t *base_scfg = modperl_config_srv_get(s);
488 #ifdef MP_TRACE
489490 char *base_name = modperl_server_desc(s, p);
490491 #endif /* MP_TRACE */
491492
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
3940 #define ap_http_scheme(r) ap_http_method(r)
4041 #endif
4142
43 #if AP_SERVER_MAJORVERSION_NUMBER>2 || AP_SERVER_MINORVERSION_NUMBER>=2
44 #define MP_HTTPD_HAS_OVERRIDE_OPTS
45 #endif
46
47 #define MP_HTTPD_OVERRIDE_HTACCESS (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
48
49 #define MP_HTTPD_OVERRIDE_OPTS_UNSET (-1)
50 #define MP_HTTPD_OVERRIDE_OPTS_DEFAULT (OPT_UNSET | \
51 OPT_ALL | \
52 OPT_INCNOEXEC | \
53 OPT_SYM_OWNER | \
54 OPT_MULTI)
55
4256 #endif /* MODPERL_APACHE_COMPAT_H */
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
129130
130131 if (status == HTTP_INTERNAL_SERVER_ERROR) {
131132 if (r && r->notes) {
132 apr_table_mergen(r->notes, "error-notes", SvPV_nolen(ERRSV));
133 apr_table_merge(r->notes, "error-notes", SvPV_nolen(ERRSV));
133134 }
134135 }
135136
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
155156 return modperl_cmd_too_late(parms);
156157 }
157158 MP_TRACE_d(MP_FUNC, "arg = %s\n", arg);
158 modperl_config_srv_argv_push(arg);
159
160 if (!strncasecmp(arg, "+inherit", 8)) {
161 modperl_cmd_options(parms, mconfig, "+InheritSwitches");
162 }
163 else {
164 modperl_config_srv_argv_push(arg);
165 }
159166 return NULL;
160167 }
161168
484491 #define MP_DEFAULT_PERLSECTION_PACKAGE "Apache2::ReadConfig"
485492 #define MP_PERLSECTIONS_SAVECONFIG_SV \
486493 get_sv("Apache2::PerlSections::Save", FALSE)
494 #define MP_PERLSECTIONS_SERVER_SV \
495 get_sv("Apache2::PerlSections::Server", TRUE)
487496
488497 MP_CMD_SRV_DECLARE(perldo)
489498 {
549558 }
550559
551560 {
561 SV *server = MP_PERLSECTIONS_SERVER_SV;
552562 SV *code = newSVpv(arg, 0);
553563 GV *gv = gv_fetchpv("0", TRUE, SVt_PV);
554564 ENTER;SAVETMPS;
556566 #if PERL_REVISION == 5 && PERL_VERSION >= 9
557567 TAINT_NOT; /* XXX: temp workaround, see my p5p post */
558568 #endif
569 sv_setref_pv(server, "Apache2::ServerRec", (void*)s);
559570 sv_setpv_mg(GvSV(gv), directive->filename);
560571 eval_sv(code, G_SCALAR|G_KEEPERR);
561572 SvREFCNT_dec(code);
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
00
1 /* Copyright 2000-2005 The Apache Software Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
67 *
78 * http://www.apache.org/licenses/LICENSE-2.0
89 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
00
1 /* Copyright 2000-2005 The Apache Software Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
67 *
78 * http://www.apache.org/licenses/LICENSE-2.0
89 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
146147 return rcfg;
147148 }
148149
150 modperl_config_con_t *modperl_config_con_new(conn_rec *c)
151 {
152 modperl_config_con_t *ccfg =
153 (modperl_config_con_t *)apr_pcalloc(c->pool, sizeof(*ccfg));
154
155 MP_TRACE_d(MP_FUNC, "0x%lx\n", (unsigned long)ccfg);
156
157 return ccfg;
158 }
159
149160 modperl_config_srv_t *modperl_config_srv_new(apr_pool_t *p, server_rec *s)
150161 {
151162 modperl_config_srv_t *scfg = (modperl_config_srv_t *)
301312 merge_item(perl);
302313 #endif
303314
304 if (add->argv->nelts == 2 &&
305 strEQ(((char **)add->argv->elts)[1], "+inherit"))
306 {
315 if (MpSrvINHERIT_SWITCHES(add)) {
307316 /* only inherit base PerlSwitches if explicitly told to */
308317 mrg->argv = base->argv;
309318 }
499508 apr_pool_t *ptmp,
500509 int override,
501510 char *path,
511 int override_options,
502512 ap_conf_vector_t *conf,
503513 SV *lines)
504514 {
514524 parms.override = override;
515525 parms.path = path;
516526 parms.pool = p;
527 #ifdef MP_HTTPD_HAS_OVERRIDE_OPTS
528 if (override_options == MP_HTTPD_OVERRIDE_OPTS_UNSET) {
529 parms.override_opts = MP_HTTPD_OVERRIDE_OPTS_DEFAULT;
530 }
531 else {
532 parms.override_opts = override_options;
533 }
534 #endif
517535
518536 if (ptmp) {
519537 parms.temp_pool = ptmp;
560578 parms->temp_pool,
561579 parms->override,
562580 parms->path,
581 #ifdef MP_HTTPD_HAS_OVERRIDE_OPTS
582 parms->override_opts,
583 #else
584 MP_HTTPD_OVERRIDE_OPTS_UNSET,
585 #endif
563586 parms->context,
564587 lines);
565588 }
571594 apr_pool_t *p = s->process->pconf;
572595
573596 return modperl_config_insert(aTHX_ s, p, NULL, override, NULL,
597 MP_HTTPD_OVERRIDE_OPTS_UNSET,
574598 s->lookup_defaults, lines);
575599 }
576600
577601 const char *modperl_config_insert_request(pTHX_
578602 request_rec *r,
579603 SV *lines,
580 int override)
604 int override,
605 char *path,
606 int override_options)
581607 {
582608 const char *errmsg;
583609 ap_conf_vector_t *dconf = ap_create_per_dir_config(r->pool);
584610
585 /* The path argument of "/" is only required to be non-NULL
586 and "/" is as good a default as anything else */
611 if (!path) {
612 /* pass a non-NULL path if nothing else given and for compatibility */
613 path = "/";
614 }
615
587616 errmsg = modperl_config_insert(aTHX_
588617 r->server, r->pool, r->pool,
589 override, "/",
618 override, path, override_options,
590619 dconf, lines);
591620
592621 if (errmsg) {
609638 server_rec *s, const char *name)
610639 {
611640 U32 flag;
612 MP_dSCFG(s);
613641
614642 /* XXX: should we test whether perl is disabled for this server? */
615643 /* if (!MpSrvENABLE(scfg)) { */
617645 /* } */
618646
619647 if (r) {
620 if ((flag = modperl_flags_lookup_dir(name))) {
648 if ((flag = modperl_flags_lookup_dir(name)) != -1) {
621649 MP_dDCFG;
622650 return MpDirFLAGS(dcfg) & flag ? 1 : 0;
623651 }
626654 }
627655 }
628656 else {
629 if ((flag = modperl_flags_lookup_srv(name))) {
657 if ((flag = modperl_flags_lookup_srv(name)) != -1) {
658 MP_dSCFG(s);
630659 return MpSrvFLAGS(scfg) & flag ? 1 : 0;
631660 }
632661 else {
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
2425 modperl_config_dir_t *modperl_config_dir_new(apr_pool_t *p);
2526
2627 modperl_config_req_t *modperl_config_req_new(request_rec *r);
28
29 modperl_config_con_t *modperl_config_con_new(conn_rec *c);
2730
2831 void *modperl_config_srv_create(apr_pool_t *p, server_rec *s);
2932
7780 #define MP_dRCFG \
7881 modperl_config_req_t *rcfg = modperl_config_req_get(r)
7982
83 #define modperl_config_con_init(c, ccfg) \
84 if (!ccfg) { \
85 ccfg = modperl_config_con_new(c); \
86 modperl_set_module_config(c->conn_config, ccfg); \
87 }
88
89 #define modperl_config_con_get(c) \
90 (c ? (modperl_config_con_t *) \
91 modperl_get_module_config(c->conn_config) : NULL)
92
93 #define MP_dCCFG \
94 modperl_config_con_t *ccfg = modperl_config_con_get(c)
95
8096 #define modperl_config_dir_get(r) \
8197 (r ? (modperl_config_dir_t *) \
8298 modperl_get_module_config(r->per_dir_config) : NULL)
130146 apr_pool_t *ptmp,
131147 int override,
132148 char *path,
149 int override_options,
133150 ap_conf_vector_t *conf,
134151 SV *lines);
135152
141158 const char *modperl_config_insert_request(pTHX_
142159 request_rec *r,
143160 SV *lines,
144 int override);
161 int override,
162 char *path,
163 int override_options);
145164
146165 int modperl_config_is_perl_option_enabled(pTHX_ request_rec *r,
147166 server_rec *s, const char *name);
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
1415
1516 #include "mod_perl.h"
1617
17 #define EnvMgObj SvMAGIC((SV*)ENVHV)->mg_ptr
18 #define EnvMgLen SvMAGIC((SV*)ENVHV)->mg_len
18 #define EnvMgOK ((SV*)ENVHV && SvMAGIC((SV*)ENVHV))
19 #define EnvMgObj (EnvMgOK ? SvMAGIC((SV*)ENVHV)->mg_ptr : NULL)
20 #define EnvMgLen (EnvMgOK ? SvMAGIC((SV*)ENVHV)->mg_len : 0)
21 #define EnvMgObjSet(val){ \
22 if (EnvMgOK) SvMAGIC((SV*)ENVHV)->mg_ptr = (char *)val;}
23 #define EnvMgLenSet(val) {\
24 if (EnvMgOK) SvMAGIC((SV*)ENVHV)->mg_len = val;}
1925
2026 /* XXX: move to utils? */
2127 static unsigned long modperl_interp_address(pTHX)
400406
401407 void modperl_env_request_tie(pTHX_ request_rec *r)
402408 {
403 EnvMgObj = (char *)r;
404 EnvMgLen = -1;
409 EnvMgObjSet(r);
410 EnvMgLenSet(-1);
405411
406412 #ifdef MP_PERL_HV_GMAGICAL_AWARE
407413 MP_TRACE_e(MP_FUNC, "[%s/0x%lx] tie %%ENV, $r\n\t (%s%s)",
413419
414420 void modperl_env_request_untie(pTHX_ request_rec *r)
415421 {
416 EnvMgObj = NULL;
422 EnvMgObjSet(NULL);
417423
418424 #ifdef MP_PERL_HV_GMAGICAL_AWARE
419425 MP_TRACE_e(MP_FUNC, "[%s/0x%lx] untie %%ENV; # from r\n\t (%s%s)",
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
8788 modperl_modglobal_key_t *gkey =
8889 modperl_modglobal_lookup(aTHX_ "ANONSUB");
8990 MP_TRACE_h(MP_FUNC, "init $PL_modglobal{ANONSUB} = []");
90 MP_MODGLOBAL_STORE_HV(gkey);
91 (void)MP_MODGLOBAL_STORE_HV(gkey);
9192 }
9293
9394 /* allocate and populate the anon handler sub-struct */
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
120121 TRUE, SVt_PVIO);
121122
122123 /* open my $oldout, "<&STDIN" or die "Can't dup STDIN: $!"; */
123 status = Perl_do_open(aTHX_ handle_save, "<&STDIN", 7, FALSE,
124 O_RDONLY, 0, Nullfp);
124 status = do_open(handle_save, "<&STDIN", 7, FALSE,
125 O_RDONLY, 0, Nullfp);
125126 if (status == 0) {
126127 Perl_croak(aTHX_ "Failed to dup STDIN: %" SVf, get_sv("!", TRUE));
127128 }
129130 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
130131 * have file descriptors, so STDIN must be closed before it can
131132 * be reopened */
132 Perl_do_close(aTHX_ handle, TRUE);
133 do_close(handle, TRUE);
133134 }
134135
135136 sv_setref_pv(sv, "Apache2::RequestRec", (void*)r);
136 status = Perl_do_open9(aTHX_ handle, "<:Apache2", 9, FALSE, O_RDONLY,
137 0, Nullfp, sv, 1);
137 status = do_open9(handle, "<:Apache2", 9, FALSE, O_RDONLY,
138 0, Nullfp, sv, 1);
138139 if (status == 0) {
139140 Perl_croak(aTHX_ "Failed to open STDIN: %" SVf, get_sv("!", TRUE));
140141 }
163164 TRUE, SVt_PVIO);
164165
165166 /* open my $oldout, ">&STDOUT" or die "Can't dup STDOUT: $!"; */
166 status = Perl_do_open(aTHX_ handle_save, ">&STDOUT", 8, FALSE,
167 O_WRONLY, 0, Nullfp);
167 status = do_open(handle_save, ">&STDOUT", 8, FALSE,
168 O_WRONLY, 0, Nullfp);
168169 if (status == 0) {
169170 Perl_croak(aTHX_ "Failed to dup STDOUT: %" SVf, get_sv("!", TRUE));
170171 }
172173 /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't
173174 * have file descriptors, so STDOUT must be closed before it can
174175 * be reopened */
175 Perl_do_close(aTHX_ handle, TRUE);
176 do_close(handle, TRUE);
176177 }
177178
178179 sv_setref_pv(sv, "Apache2::RequestRec", (void*)r);
179 status = Perl_do_open9(aTHX_ handle, ">:Apache2", 9, FALSE, O_WRONLY,
180 0, Nullfp, sv, 1);
180 status = do_open9(handle, ">:Apache2", 9, FALSE, O_WRONLY,
181 0, Nullfp, sv, 1);
181182 if (status == 0) {
182183 Perl_croak(aTHX_ "Failed to open STDOUT: %" SVf, get_sv("!", TRUE));
183184 }
199200 MP_TRACE_o(MP_FUNC, "start");
200201
201202 /* close the overriding filehandle */
202 Perl_do_close(aTHX_ handle_orig, FALSE);
203 do_close(handle_orig, FALSE);
203204
204205 /*
205206 * open STDIN, "<&STDIN_SAVED" or die "Can't dup STDIN_SAVED: $!";
210211
211212 MP_TRACE_o(MP_FUNC, "restoring STDIN");
212213
213 if (Perl_do_open9(aTHX_ handle_orig, "<&", 2, FALSE,
214 O_RDONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
214 if (do_open9(handle_orig, "<&", 2, FALSE,
215 O_RDONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
215216 err = get_sv("!", TRUE);
216217 }
217218
218 Perl_do_close(aTHX_ handle, FALSE);
219 do_close(handle, FALSE);
219220 (void)hv_delete(gv_stashpv("Apache2::RequestIO", TRUE),
220221 GvNAME(handle), GvNAMELEN(handle), G_DISCARD);
221222
246247 }
247248
248249 /* close the overriding filehandle */
249 Perl_do_close(aTHX_ handle_orig, FALSE);
250 do_close(handle_orig, FALSE);
250251
251252 /*
252253 * open STDOUT, ">&STDOUT_SAVED" or die "Can't dup STDOUT_SAVED: $!";
257258
258259 MP_TRACE_o(MP_FUNC, "restoring STDOUT");
259260
260 if (Perl_do_open9(aTHX_ handle_orig, ">&", 2, FALSE,
261 O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
261 if (do_open9(handle_orig, ">&", 2, FALSE,
262 O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) {
262263 err = get_sv("!", TRUE);
263264 }
264265
265 Perl_do_close(aTHX_ handle, FALSE);
266 do_close(handle, FALSE);
266267 (void)hv_delete(gv_stashpv("Apache2::RequestIO", TRUE),
267268 GvNAME(handle), GvNAMELEN(handle), G_DISCARD);
268269
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
7071 action = *(str++);
7172 }
7273
73 if (!(opt = flags_lookup(o, str))) {
74 if ((opt = flags_lookup(o, str)) == -1) {
7475 error = apr_pstrcat(p, "Invalid per-", type_lookup(o),
7576 " PerlOption: ", str, NULL);
7677
7879 modperl_options_t dummy;
7980 MpOptionsTypeSrv_set(&dummy);
8081
81 if (flags_lookup(&dummy, str)) {
82 if (flags_lookup(&dummy, str) == -1) {
8283 error = apr_pstrcat(p, error,
8384 " (only allowed per-server)",
8485 NULL);
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
7172 ids->uid = getuid();
7273 ids->euid = geteuid();
7374 ids->gid = getgid();
74 ids->gid = getegid();
75 ids->egid = getegid();
7576
7677 MP_TRACE_r(MP_FUNC,
7778 "pid=%d, "
7879 #ifdef MP_MAINTAIN_PPID
7980 "ppid=%d, "
8081 #endif
81 "uid=%d, euid=%d, gid=%d, egid=%d\n",
82 "uid=%" Uid_t_f ", euid=%" Uid_t_f ", "
83 "gid=%" Gid_t_f ", egid=%" Gid_t_f "\n",
8284 (int)ids->pid,
8385 #ifdef MP_MAINTAIN_PPID
8486 (int)ids->ppid,
8587 #endif
86 (int)ids->uid, (int)ids->euid,
87 (int)ids->gid, (int)ids->egid);
88 ids->uid, ids->euid,
89 ids->gid, ids->egid);
8890 #endif /* #ifndef WIN32 */
8991 }
9092
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
257258 } modperl_config_req_t;
258259
259260 typedef struct {
260 MpAV *handlers_connection[MP_HANDLER_NUM_CONNECTION];
261 HV *pnotes;
261262 } modperl_config_con_t;
262263
263264 typedef struct {
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
827828 modperl_global_get_server_rec()->process->pool);
828829 return data ? *(int *)data : 0;
829830 }
831
832 #ifdef USE_ITHREADS
833 typedef struct {
834 HV **pnotes;
835 PerlInterpreter *perl;
836 } modperl_cleanup_pnotes_data_t;
837 #endif
838
839 static MP_INLINE
840 apr_status_t modperl_cleanup_pnotes(void *data) {
841 HV **pnotes = data;
842
843 if (*pnotes) {
844 #ifdef USE_ITHREADS
845 modperl_cleanup_pnotes_data_t *cleanup_data = data;
846 dTHXa(cleanup_data->perl);
847 pnotes = cleanup_data->pnotes;
848 #else
849 pnotes = data;
850 #endif
851 SvREFCNT_dec(*pnotes);
852 *pnotes = Nullhv;
853 }
854
855 return APR_SUCCESS;
856 }
857
858 SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val,
859 request_rec *r, conn_rec *c) {
860 SV *retval = Nullsv;
861
862 if (!*pnotes) {
863 *pnotes = newHV();
864
865 /* XXX: It would be nice to be able to do this with r->pnotes, but
866 * it's currently impossible, as modperl_config.c:modperl_config_request_cleanup()
867 * is responsible for running the CleanupHandlers, and it's cleanup callback is
868 * registered very early. If we register our cleanup here, we'll be running
869 * *before* the CleanupHandlers, and they might still want to use pnotes...
870 */
871 if (c && !r) {
872 apr_pool_t *pool = r ? r->pool : c->pool;
873 #ifdef USE_ITHREADS
874 modperl_cleanup_pnotes_data_t *cleanup_data =
875 apr_palloc(pool, sizeof(*cleanup_data));
876 cleanup_data->pnotes = pnotes;
877 cleanup_data->perl = aTHX;
878 #else
879 void *cleanup_data = pnotes;
880 #endif
881 apr_pool_cleanup_register(pool, cleanup_data,
882 modperl_cleanup_pnotes,
883 apr_pool_cleanup_null);
884 }
885 }
886
887 if (key) {
888 STRLEN len;
889 char *k = SvPV(key, len);
890
891 if (val) {
892 retval = *hv_store(*pnotes, k, len, SvREFCNT_inc(val), 0);
893 }
894 else if (hv_exists(*pnotes, k, len)) {
895 retval = *hv_fetch(*pnotes, k, len, FALSE);
896 }
897 }
898 else {
899 retval = newRV_inc((SV *)*pnotes);
900 }
901
902 return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
903 }
904
0 /* Copyright 2000-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
144145 void modperl_restart_count_inc(server_rec *base_server);
145146 int modperl_restart_count(void);
146147
148 SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val,
149 request_rec *r, conn_rec *c);
150
147151 #endif /* MODPERL_UTIL_H */
4444
4545 my $cl = 0;
4646 my $head_cl = undef;
47
47
4848 ok t_cmp $res->code, 200, "$method $uri code";
4949 ok t_cmp ($res->header('Content-Length'),
5050 $method eq 'GET' ? $cl : $head_cl,
6464 my $res = $method->($uri);
6565
6666 my $cl = 0;
67 my $head_cl = undef;
68
67 my $head_cl;
68
69 ## 2.2.1, 2.0.56, 2.0.57 were not released
70 ## but we use the versions the changes went into
71 ## to protect against wierd SVN checkout building.
72 ## XXX: I'm starting to think this test is more
73 ## trouble then its worth.
74 if (have_min_apache_version("2.2.1")) {
75 $head_cl = 25;
76 }
77 elsif (have_min_apache_version("2.2.0")) {
78 # $head_cl = undef; # avoid warnings
79 }
80 elsif (have_min_apache_version("2.0.56")) {
81 $head_cl = 25;
82 }
83 else {
84 # $head_cl = undef; # avoid warnings
85 }
86
6987 ok t_cmp $res->code, 200, "$method $uri code";
7088 ok t_cmp ($res->header('Content-Length'),
7189 $method eq 'GET' ? $cl : $head_cl,
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::TestRequest qw(GET_BODY_ASSERT);
4 use Apache::Test;
5 use Apache::TestUtil;
6
7 my $module = 'TestAPI::add_config';
8 my $url = Apache::TestRequest::module2url($module) . "/";
9
10 t_debug("connecting to $url");
11 print GET_BODY_ASSERT $url;
12
2828 # it also tries to set status (to a different value), but it
2929 # should be ignored by Apache, since status_line is supposed to
3030 # override status. the handler also sets a custom code message
31 # modules/http/http_filters.c r372958
32 # httpd 'zaps' the status_line if it doesn't match the status
33 # as of 2.2.1 (not released) so 2.2.2 (released)
34
3135 my $code = 499; # not in HTTP/1.1
3236 my $message = "FooBared";
3337 my $res = GET "$location?$code=$message";
6262 }
6363 </Perl>
6464
65 <Perl >
66 $TestDirective::perl::base_server = Apache2::PerlSections->server;
67 </Perl>
68
69 <Perl >
70 # make sure that these are set at the earliest possible time
71 die '$ENV{MOD_PERL} not set!' unless $ENV{MOD_PERL};
72 die '$ENV{MOD_PERL_API_VERSION} not set!'
73 unless $ENV{MOD_PERL_API_VERSION} == 2;
74 </Perl>
75
76 <VirtualHost perlsections>
77 <Perl >
78 $TestDirective::perl::vhost_server = Apache2::PerlSections->server;
79 </Perl>
80 </VirtualHost>
81
6582 ### --------------------------------- ###
6683 Perl $TestDirective::perl::worked="yes";
6784
83100 =cut
84101
85102 PerlSetVar TestDirective__pod_cut_worked yes
103
104 #This used to trigger a segfault on startup
105 #See http://thread.gmane.org/gmane.comp.apache.mod-perl/22750
106 <IfDefine PERL_USEITHREADS>
107 <VirtualHost inherit>
108 PerlSwitches +inherit
109 PerlOptions +Parent
110 Perl 1
111 </VirtualHost>
112 </IfDefine>
113
114 #Single-line $PerlConfig
115 <Perl>
116 if (Apache::Test::have_module('mod_alias.c')) {
117 $PerlConfig = "Alias /perl_sections_perlconfig_scalar @DocumentRoot@";
118 }
119 </Perl>
120
121 #Multi-line $PerlConfig
122 <Perl>
123 if (Apache::Test::have_module('mod_alias.c')) {
124 $PerlConfig = "Alias /perl_sections_perlconfig_scalar1 @DocumentRoot@
125 Alias /perl_sections_perlconfig_scalar2 @DocumentRoot@
126 ";
127 }
128 </Perl>
129
130 #@PerlConfig
131 <Perl>
132 if (Apache::Test::have_module('mod_alias.c')) {
133 @PerlConfig = ("Alias /perl_sections_perlconfig_array1 @DocumentRoot@",
134 "Alias /perl_sections_perlconfig_array2 @DocumentRoot@",
135 );
136 }
137 </Perl>
138
44 use Apache::TestRequest;
55 use Apache::TestUtil;
66
7 plan tests => 1, need need_module(qw(proxy proxy_http.c)),
7 plan tests => 1, need need_module(qw(mod_proxy proxy_http.c)),
88 need_access;
99
1010 my $data = join ' ', 'A'..'Z', 0..9;
0 package TestHooks::error;
1
2 use strict;
3 use warnings FATAL => 'all';
4
5 use Apache::Test;
6
7 use Apache2::RequestRec ();
8 use Apache2::RequestIO ();
9
10 use Apache2::Const -compile => 'OK';
11
12 use APR::Table ();
13
14 sub handler {
15 my $r = shift;
16 my $args = $r->args();
17 if (defined($args) && $args ne '') {
18 $r->notes->set('error-notes' => $args);
19 }
20 &bomb();
21 Apache2::Const::OK;
22 }
23
24 sub fail {
25 my $r = shift;
26 $r->print('Error: '.$r->prev->notes->get('error-notes'));
27 Apache2::Const::OK;
28 }
29
30 1;
31 __DATA__
32 <NoAutoConfig>
33 <Location /TestHooks__error>
34 SetHandler modperl
35 PerlResponseHandler TestHooks::error
36 ErrorDocument 500 /TestHooks__error__fail
37 </Location>
38 <Location /TestHooks__error__fail>
39 SetHandler modperl
40 PerlResponseHandler TestHooks::error::fail
41 </Location>
42 </NoAutoConfig>
4343 <VirtualHost TestHooks::push_handlers_anon>
4444 PerlModule TestHooks::push_handlers_anon
4545 <Perl >
46 # want to push a handler for a vhost, via $s, but the only way to
47 # get $s for vhost is to traverse the vhosts list
48 use Apache::Test;
49 use Apache::TestRequest;
50 Apache::TestRequest::module('TestHooks::push_handlers_anon');
51 my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
52 my ($host, $port) = split ':', $hostport;
53 my $s = Apache2::ServerUtil->server;
54 my $vs = $s->next;
55 for (; $vs; $vs = $vs->next) {
56 last if $port == $vs->port
57 }
58 $vs->push_handlers(PerlFixupHandler =>
46 my $s = Apache2::PerlSections->server;
47
48 $s->push_handlers(PerlFixupHandler =>
5949 sub { &TestHooks::push_handlers_anon::add_note });
60 $vs->push_handlers(PerlFixupHandler =>
50 $s->push_handlers(PerlFixupHandler =>
6151 \&TestHooks::push_handlers_anon::add_note );
62 $vs->push_handlers(PerlFixupHandler =>
52 $s->push_handlers(PerlFixupHandler =>
6353 "TestHooks::push_handlers_anon::add_note" );
6454 </Perl>
6555
4242 callback(shift);
4343
4444 return Apache2::Const::SERVER_ERROR;
45 }
46
47 sub push_handlers {
48
49 my $r = shift;
50
51 $r->push_handlers(PerlFixupHandler => \&ok);
52
53 callback($r);
54
55 return Apache2::Const::OK;
4556 }
4657
4758 sub callback {
166177 # 1 run, 1 left behind
167178 PerlTypeHandler TestHooks::stacked_handlers2::ok TestHooks::stacked_handlers3::server_error
168179
169 # all 2 run
180 # all 4 run
170181 PerlFixupHandler TestHooks::stacked_handlers2::ok TestHooks::stacked_handlers2::ok
182 PerlFixupHandler TestHooks::stacked_handlers2::push_handlers
171183
172184 # 2 run, 2 left behind
173185 PerlResponseHandler TestHooks::stacked_handlers2::declined TestHooks::stacked_handlers2
6060 my ($phase, $s) = @_;
6161
6262 my $val = $s->dir_config->{PostConfig} or die "Can't read PostConfig var";
63
64 # make sure that these are set at the earliest possible time
65 die '$ENV{MOD_PERL} not set!' unless $ENV{MOD_PERL};
66 die '$ENV{MOD_PERL_API_VERSION} not set!'
67 unless $ENV{MOD_PERL_API_VERSION} == 2;
6368
6469 my $port = $s->port;
6570 my $file = catfile $dir, "$phase-$port";
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4 use Apache::TestUtil;
5 use Apache::TestRequest;
6
7 plan tests => 2;
8
9 {
10 my $location = "/TestHooks__error";
11 my $expected = qr/^Error: Undefined subroutine/;
12 my $received = GET_BODY $location;
13 ok t_cmp($received, $expected, "error-notes set on ErrorDocument");
14 }
15
16 {
17 my $error_seed_text = 'seed_text';
18 my $location = "/TestHooks__error?$error_seed_text";
19 my $expected = qr/^Error: \Q$error_seed_text\E, Undefined subroutine/;
20 my $received = GET_BODY $location;
21 ok t_cmp($received, $expected, "seeded error-notes set on ErrorDocument");
22 }
2525 ran 2 PerlAuthenHandler handlers
2626 ran 2 PerlAuthzHandler handlers
2727 ran 1 PerlTypeHandler handlers
28 ran 2 PerlFixupHandler handlers
28 ran 4 PerlFixupHandler handlers
2929 ran 2 PerlResponseHandler handlers
3030 ran 2 PerlOutputFilterHandler handlers!;
3131
0 TestAddConfig Htaccess
1717 use constant OSX => Apache::TestConfig::OSX;
1818
1919 use constant APACHE_2_0_49_PLUS => have_min_apache_version('2.0.49');
20 use constant APACHE_2_2_PLUS => have_min_apache_version('2.2.0');
2021
2122 use APR::Const -compile => qw(SUCCESS FINFO_NORM FILETYPE_REG
2223 FPROT_WREAD FPROT_WWRITE
2829
2930 sub test {
3031
31 my $file = __FILE__;
32
33 # On Win32, touch the file to ensure it is in the same Daylight Saving
34 # Time season as the current time to workaround a bug in Win32's stat()
35 # which APR::Finfo allows for, otherwise the two disagree.
36 #
37 # With perl-5.8.0 on Win32, the syntax
38 # utime undef, undef, $file;
39 # causes an uninitialized warning to be emitted,
40 # so use the equivalent
41 # utime $now, $now, $file;
42 # instead.
43 #
44 if (WIN32) {
45 my $now = time;
46 utime $now, $now, $file;
47 }
32 # for the file to be tested, use the httpd.conf generated
33 # by testing, so that it has a ctime that won't (usually)
34 # encounter a bug in Win32's stat() function for files that
35 # span across DST season boundaries.
36 my $file = catfile Apache::Test::vars->{t_dir}, 'conf', 'httpd.conf';
4837
4938 my $pool = APR::Pool->new();
5039 # populate the finfo struct first
144133
145134 # match world bits
146135
147 ok t_cmp($finfo->protection & APR::Const::FPROT_WREAD,
148 $stat->{protection} & S_IROTH,
149 '$finfo->protection() & APR::Const::FPROT_WREAD');
150
151 ok t_cmp($finfo->protection & APR::Const::FPROT_WWRITE,
152 $stat->{protection} & S_IWOTH,
153 '$finfo->protection() & APR::Const::FPROT_WWRITE');
154
136 # on Win32, there's a bug in the apr library supplied
137 # with Apache/2.2 that causes the following two tests
138 # to fail. This is slated to be fixed after apr-1.2.7.
139 if (WIN32 and APACHE_2_2_PLUS) {
140 skip "broken apr stat on Win32", 0;
141 }
142 else {
143 ok t_cmp($finfo->protection & APR::Const::FPROT_WREAD,
144 $stat->{protection} & S_IROTH,
145 '$finfo->protection() & APR::Const::FPROT_WREAD');
146 }
147 if (WIN32 and APACHE_2_2_PLUS) {
148 skip "broken apr stat on Win32", 0;
149 }
150 else {
151 ok t_cmp($finfo->protection & APR::Const::FPROT_WWRITE,
152 $stat->{protection} & S_IWOTH,
153 '$finfo->protection() & APR::Const::FPROT_WWRITE');
154 }
155155 if (WIN32) {
156156 skip "different file semantics", 0;
157157 }
306306 # - copy
307307 # - overlay
308308 {
309 my $table = APR::Table::make(APR::Pool->new, 10);
309 {
310 my $table = APR::Table::make(APR::Pool->new, 10);
311 $table->set($_ => $_) for 1..20;
312 ok t_cmp $table->get(20), 20, "no segfault";
313 }
314
315 my $pool = APR::Pool->new;
316 my $table = APR::Table::make($pool, 10);
310317 $table->set($_ => $_) for 1..20;
311 ok t_cmp $table->get(20), 20, "no segfault";
312
313 my $table_copy = $table->copy(APR::Pool->new);
318 my $table_copy = $table->copy($pool->new);
314319 {
315320 # verify that the temp pool used to create $table_copy was
316321 # not freed, by allocating a new table to fill with a
324329 }
325330 ok t_cmp $table_copy->get(20), 20, "no segfault/valid data";
326331
327 my $table2 = APR::Table::make(APR::Pool->new, 1);
332 my $table2 = APR::Table::make($pool, 1);
328333 $table2->set($_**2 => $_**2) for 1..20;
329 my $overlay = $table_copy->overlay($table2, APR::Pool->new);
334 my $table2_copy = APR::Table::make($pool, 1);
335 $table2_copy->set($_ => $_) for 1..20;
336
337 my $overlay = $table2_copy->overlay($table2, $pool->new);
330338 {
331339 # see the comment for above's:
332340 # $table_copy = $table->copy(APR::Pool->new);
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4 use Apache::TestUtil;
5 use Apache::TestRequest;
6
7 plan tests => 1, skip_reason('local %ENV is still broken');
8
9 my $module = 'TestModperl::local_env';
10 my $url = Apache::TestRequest::module2url($module);
11
12 t_debug "connecting to $url";
13 print GET_BODY_ASSERT $url;
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::Test;
4 use Apache::TestUtil;
5 use Apache::TestRequest;
6
7 my $module = 'TestModperl::perl_options2';
8 my $url = Apache::TestRequest::module2url($module);
9
10 t_debug "connecting to $url";
11 print GET_BODY_ASSERT $url;
0 use strict;
1 use warnings FATAL => 'all';
2
3 use Apache::TestRequest qw(GET_BODY_ASSERT);
4 use Apache::Test;
5 use Apache::TestUtil;
6
7 my $module = 'TestModperl::pnotes';
8 my $url = Apache::TestRequest::module2url($module);
9
10 t_debug("connecting to $url");
11
12 plan tests => (26 * 3), need_lwp;
13
14 # first with keepalives
15 Apache::TestRequest::user_agent(reset => 1, keep_alive => 1);
16 t_debug("issuing first request");
17 print GET_BODY_ASSERT "$url?1";
18
19 # now close the connection
20 t_debug("issuing second request");
21 print GET_BODY_ASSERT "$url?2", Connection => 'close';
22
23 # finally, check for a cleared $c->pnotes
24 t_debug("issuing final request");
25 print GET_BODY_ASSERT "$url?3";
26
1212 'footer',
1313 );
1414
15 plan tests => 2 + @patterns, need need_module('include', 'mod_mime'),
15 plan tests => 2 + @patterns, need need_module('mod_include', 'mod_mime'),
1616 need_min_module_version(CGI => 3.08);
1717
1818 my $location = "/includes/test.shtml";
99
1010 t_debug("connecting to $url");
1111
12 plan tests => 1, need need_module(qw(proxy proxy_http.c)),
12 plan tests => 1, need need_module(qw(mod_proxy proxy_http.c)),
1313 need_access;
1414
1515 my $expected = "ok";
2020 # blocking socket bug fixed in 2.0.52
2121 my $ok = $^O !~ /^(Open|Net)BSD$/i || need_min_apache_version('2.0.52');
2222
23 # but not in 2.1? hmph.
24 $ok = skip_reason('skipping on httpd 2.1') if have_min_apache_version('2.1');
25
2623 plan tests => 13, need need_auth, need_access, $ok;
2724
2825 {
3128 my $socket = Apache::TestRequest::vhost_socket($module);
3229 ok $socket;
3330
34 expect_reply($socket, "HELO", "HELO", "greeting");
35 expect_reply($socket, "Login:", $login, "login");
36 expect_reply($socket, "Password:", $passgood, "good password");
37 expect($socket, "Welcome to TestProtocol::pseudo_http", "banner");
38 expect_reply($socket, "Available commands: date quit", "date", "date");
39 expect_reply($socket, qr/The time is:/, "quit", "quit");
40 expect($socket, "Goodbye", "end of transmission");
31 ####################################################################
32 # ACTION SEND RECEIVE
33 #
34 # greeting HELO
35 # HELO
36 # Login:
37 #
38 # login $login
39 # Password
40 #
41 # good pass $passgood
42 # banner Welcome to TestProtocol::pseudo_http
43 # Available commands: date quit
44 # date date
45 # The time is: Sat Jul 8 23:51:47 2006
46 #
47 # eot quit
48 # Goodbye
49
50 {
51 my $response = "";
52 $response = Send($socket, 'HELO');
53 ok t_cmp($response, 'HELO', 'greeting 1');
54 $response = getline($socket);
55 ok t_cmp($response, 'Login:', 'greeeting 2')
56 }
57
58 {
59 my $response = Send($socket, $login);
60 ok t_cmp($response, 'Password:', 'login');
61 }
62
63 {
64 my $response = "";
65 $response = Send($socket, $passgood);
66 ok t_cmp($response, 'Welcome to TestProtocol::pseudo_http', 'good pass');
67 $response = getline($socket);
68 ok t_cmp($response, 'Available commands: date quit', 'banner');
69 }
70
71 {
72 my $response = Send($socket, 'date');
73 ok t_cmp($response, qr/The time is:/, 'date');
74 }
75
76 {
77 my $response = Send($socket, 'quit');
78 ok t_cmp($response, 'Goodbye', 'eot');
79 }
4180 }
4281
4382 {
44 # this time sending wrong credentials and hoping that the server
45 # won't let us in
83 # supply correct credential when prompted for such and ask the
84 # server get the secret datetime information
4685 my $socket = Apache::TestRequest::vhost_socket($module);
4786 ok $socket;
4887
49 expect_reply($socket, "HELO", "HELO", "greeting");
50 expect_reply($socket, "Login:", $login, "login");
51 t_client_log_error_is_expected();
52 expect_reply($socket, "Password:", $passbad, "wrong password");
53 expect($socket, "Access Denied", "end of transmission");
88 ####################################################################
89 # ACTION SEND RECEIVE
90 #
91 # greeting HELO
92 # HELO
93 # Login:
94 #
95 # login $login
96 # Password
97 #
98 # bad pass $passbad
99 # Access Denied
100 #
101 # eot quit
102 # Goodbye
103
104 {
105 my $response = "";
106 $response = Send($socket, 'HELO');
107 ok t_cmp($response, 'HELO', 'greeting 1');
108 $response = getline($socket);
109 ok t_cmp($response, 'Login:', 'greeeting 2')
110 }
111
112 {
113 my $response = Send($socket, $login);
114 ok t_cmp($response, 'Password:', 'login');
115 }
116
117 {
118 my $response = "";
119 $response = Send($socket, $passbad);
120 ok t_cmp($response, 'Access Denied', 'eot');
121 }
54122 }
55123
56 sub expect {
57 my ($socket, $expect, $action) = @_;
124 ## send() is reserved
125 sub Send {
126 my ($socket, $str) = @_;
127
128 t_debug("send: $str");
129 print $socket $str;
130
58131 chomp(my $recv = <$socket> || '');
59 ok t_cmp($recv, $expect, $action);
132 t_debug("recv: $recv");
133
134 return $recv;
60135 }
61136
62 sub expect_reply {
63 my ($socket, $expect, $reply, $action) = @_;
137 sub getline {
138 my ($socket) = @_;
139
64140 chomp(my $recv = <$socket> || '');
65 ok t_cmp($recv, $expect, $action);
66 t_debug("send: $reply");
67 print $socket $reply;
141 t_debug("getline: $recv");
142
143 return $recv;
68144 }
69
0 package TestAPI::add_config;
1
2 use strict;
3 use warnings FATAL => 'all';
4
5 use Apache2::Access ();
6 use Apache2::CmdParms ();
7 use Apache2::RequestUtil ();
8 use Apache2::Directive ();
9 use Apache2::ServerUtil ();
10 use base qw(Apache2::Module);
11
12 use Apache::Test;
13 use Apache::TestUtil;
14
15 use Apache2::Const -compile => qw(
16 OK
17 DECLINED
18 :options
19 );
20
21 use constant KEY => "TestAddConfig";
22 use constant APACHE22 => have_min_apache_version('2.2.0');
23
24 my @directives = (
25 {
26 name => KEY,
27 cmd_data => 'cmd_data',
28 errmsg => 'errmsg',
29 },
30 );
31
32 Apache2::Module::add(__PACKAGE__, \@directives);
33
34 sub TestAddConfig {
35 my ($self, $parms, $args) = @_;
36 my $srv_cfg = $self->get_config($parms->server);
37 $srv_cfg->{override_opts} = $parms->override_opts();
38 }
39
40 sub map2storage {
41 my $r = shift;
42
43 my $o = APACHE22 ? '=All,SymLinksIfOwnerMatch' : '';
44
45 eval {
46 $r->add_config(['AllowOverride All Options'.$o]);
47 };
48 $r->pnotes(add_config1 => "$@");
49
50 eval {
51 $r->add_config(['Options ExecCGI'], -1, '/', 0);
52 };
53 $r->pnotes(add_config2 => "$@");
54
55 eval {
56 $r->add_config(['AllowOverride Options=FollowSymLinks'], -1);
57 };
58 $r->pnotes(followsymlinks => "$@");
59
60 return Apache2::Const::DECLINED;
61 }
62
63 sub fixup {
64 my ($r) = @_;
65
66 eval {
67 $r->add_config(['Options ExecCGI'], -1, '/',
68 Apache2::Const::OPT_EXECCGI);
69 };
70 $r->pnotes(add_config3 => "$@");
71
72 eval {
73 $r->server->add_config(['ServerAdmin foo@bar.com']);
74 };
75 $r->pnotes(add_config4 => "$@");
76
77 return Apache2::Const::DECLINED;
78 }
79
80 sub handler : method {
81 my ($self, $r) = @_;
82 my $cf = $self->get_config($r->server);
83
84 plan $r, tests => 8;
85
86 ok t_cmp $r->pnotes('add_config1'), qr/.+\n/;
87 ok t_cmp $r->pnotes('add_config2'), (APACHE22 ? qr/.+\n/ : '');
88 ok t_cmp $r->pnotes('add_config3'), '';
89 ok t_cmp $r->pnotes('add_config4'), qr/after server startup/;
90 ok t_cmp $r->pnotes('followsymlinks'), (APACHE22 ? '': qr/.*\n/);
91
92 my $expect = Apache2::Const::OPT_ALL |
93 Apache2::Const::OPT_UNSET |
94 Apache2::Const::OPT_INCNOEXEC |
95 Apache2::Const::OPT_MULTI |
96 Apache2::Const::OPT_SYM_OWNER;
97
98 ok t_cmp $cf->{override_opts}, $expect;
99 ok t_cmp $r->allow_options, Apache2::Const::OPT_EXECCGI;
100
101 my $opts = APACHE22 ? Apache2::Const::OPT_SYM_LINKS : $expect;
102 ok t_cmp $r->allow_override_opts, $opts;
103
104 return Apache2::Const::OK;
105 }
106
107 1;
108 __END__
109
110 # APACHE_TEST_CONFIG_ORDER 950
111 <NoAutoConfig>
112 <VirtualHost TestAPI::add_config>
113 PerlModule TestAPI::add_config
114 AccessFileName htaccess
115 SetHandler modperl
116 <Directory @DocumentRoot@>
117 AllowOverride All
118 </Directory>
119 PerlResponseHandler TestAPI::add_config
120 PerlMapToStorageHandler TestAPI::add_config::map2storage
121 PerlFixupHandler TestAPI::add_config::fixup
122 </VirtualHost>
123 </NoAutoConfig>
1919 my ($code, $string) = split /=/, $r->args || '';
2020
2121 if ($string) {
22 $r->status(200); # status_line should override status
22 # status_line must be valid and match status
23 # or it is 'zapped' by httpd as of 2.2.1
24 $r->status($code);
2325 $r->status_line("$code $string");
2426 }
2527 else {
0 package TestApache::daemon;
1
2 # Apache2::ServerUtil tests
3
4 use strict;
5 use warnings FATAL => 'all';
6
7 use Apache2::ServerUtil ();
8
9 use Apache::TestConfig ();
10 use Apache::TestUtil;
11 use Apache::Test;
12
13 use constant WIN32 => Apache::TestConfig::WIN32;
14
15 use Apache2::Const -compile => 'OK';
16
17 sub handler {
18 my $r = shift;
19
20 plan $r, tests => 2;
21
22 my $user_id = Apache2::ServerUtil->user_id;
23 my $user_id_expected = WIN32 ? 0 : $<;
24
25 ok t_cmp $user_id, $user_id_expected, "user id";
26
27 my $group_id = Apache2::ServerUtil->group_id;
28 my ($group_id_expected) = WIN32 ? 0 : ($( =~ /^(\d+)/);
29
30 ok t_cmp $group_id, $group_id_expected, "group id";
31
32 Apache2::Const::OK;
33 }
34
35 1;
36
37 __END__
38
1111
1212 use ModPerl::Util ();
1313 use Apache2::compat ();
14 use Apache::Constants qw(DIR_MAGIC_TYPE :common :response);
14 use Apache::Constants qw(DIR_MAGIC_TYPE OPT_EXECCGI :common :response);
1515
1616 use File::Spec::Functions qw(catfile canonpath);
17
18 sub fixup {
19 my $r = shift;
20 Apache->httpd_conf('Options +ExecCGI');
21 OK;
22 }
1723
1824 sub handler {
1925 my $r = shift;
7480 ok t_cmp(OK, "0",
7581 'OK');
7682
77 my $admin = $r->server->server_admin;
78 Apache->httpd_conf('ServerAdmin foo@bar.com');
79 ok t_cmp($r->server->server_admin, 'foo@bar.com',
80 'Apache->httpd_conf');
81 Apache->httpd_conf("ServerAdmin $admin");
83 my $exec_cgi = $r->allow_options & Apache2::Const::OPT_EXECCGI;
84 ok t_cmp($exec_cgi, Apache2::Const::OPT_EXECCGI, 'Apache->httpd_conf');
8285
8386 # (Apache||$r)->server_root_relative
8487 {
123126
124127 __END__
125128 # so we can test whether send_httpd_header() works fine
126 PerlOptions +ParseHeaders
129 PerlOptions +ParseHeaders +GlobalRequest
130 AllowOverride Options
131 PerlModule TestCompat::apache
132 PerlFixupHandler TestCompat::apache::fixup
33 use warnings FATAL => 'all';
44
55 use Apache::Test;
6 use Apache::TestRequest;
67 use Apache::TestUtil;
78 use Apache2::Const -compile => 'OK';
89 use Apache2::PerlSections;
1011 sub handler {
1112 my $r = shift;
1213
13 plan $r, tests => 16;
14 plan $r, tests => 22, need_module('mod_alias');
1415
1516 ok t_cmp('yes', $TestDirective::perl::worked);
1617
5152 ok t_cmp($@, "", "PerlSections dump syntax check");
5253
5354 ok t_cmp($TestDirective::perldo::test::Include, qr/perlsection.conf/);
54
55
56 #Check for correct Apache2::ServerUtil->server behavior
57 my $bport = $TestDirective::perl::base_server->port;
58 my $vport = $TestDirective::perl::vhost_server->port;
59 ok defined $bport && defined $vport && $vport != $bport;
60
61 foreach my $url (qw(scalar scalar1 scalar2)) {
62 my $res = GET "/perl_sections_perlconfig_$url/";
63 ok t_cmp($res->is_success, 1, '$PerlConfig');
64 }
65
66 foreach my $url (qw(array1 array2)) {
67 my $res = GET "/perl_sections_perlconfig_$url/";
68 ok t_cmp($res->is_success, 1, '@PerlConfig');
69 }
70
5571 Apache2::Const::OK;
5672 }
5773
5353 }
5454
5555 ok ! $ENV{FOO};
56 skip "r->subprocess_env + local() doesnt fully work yet", 1;
5657 #ok ! $env->get('FOO');
57 #XXX: keys in the original subprocess_env are restored
58 # but new ones added to the local %ENV are not removed
59 # after the local %ENV goes out of scope
60 #skip "r->subprocess_env + local() doesnt fully work yet", 1;
61 ok 1; #the skip() message is just annoying
6258
6359 {
6460 my $key = 'SERVER_SOFTWARE';
0 package TestModperl::local_env;
1
2 use strict;
3 use warnings FATAL => 'all';
4
5 use Apache2::RequestRec ();
6 use Apache2::RequestIO ();
7 use Apache2::RequestUtil ();
8
9 use Apache::Test;
10 use Apache::TestUtil;
11
12 use Apache2::Const -compile => 'OK';
13
14 # local %ENV used to cause segfaults
15 # Report: http://thread.gmane.org/gmane.comp.apache.mod-perl/22236
16 # Fixed in: http://svn.apache.org/viewcvs.cgi?rev=357236&view=rev
17 sub handler {
18 my $r = shift;
19
20 plan $r, tests => 6;
21
22 my %copy_ENV = %ENV; ## this is not a deep copy;
23
24 ok t_cmp($ENV{MOD_PERL_API_VERSION}, 2,
25 "\$ENV{MOD_PERL_API_VERSION} is 2 before local \%ENV");
26
27 {
28 local %ENV;
29
30 ok t_cmp($ENV{MOD_PERL_API_VERSION}, undef,
31 "\$ENV{MOD_PERL_API_VERSION} is undef after local \%ENV");
32
33 ok t_cmp(scalar keys %ENV, 0,
34 "\%ENV has 0 keys after local");
35
36 $ENV{LOCAL} = 1;
37
38 ok t_cmp($ENV{LOCAL}, 1,
39 "can set value after local, but still in block");
40 }
41
42 ok t_cmp($ENV{LOCAL}, undef,
43 "valuee set in local {} block is gone after leaving scope");
44
45 ok t_cmp(\%copy_ENV, \%ENV, "\%ENV was restored correctly");
46
47 Apache2::Const::OK;
48 }
49
50 1;
51 __END__
52 SetHandler perl-script
0 package TestModperl::perl_options2;
1
2 # test whether PerlOptions None works
3
4 use strict;
5 use warnings FATAL => 'all';
6
7 use Apache2::RequestRec ();
8 use Apache2::RequestIO ();
9 use Apache2::RequestUtil ();
10 use Apache2::ServerUtil ();
11
12 use Apache::Test;
13 use Apache::TestUtil;
14
15 use Apache2::Const -compile => qw(OK);
16
17 my @srv = qw(
18 OpenLogs
19 PostConfig
20 ChildInit
21 ChildExit
22
23 PreConnection
24 ProcessConnection
25
26 InputFilter
27 OutputFilter
28
29 PostReadRequest
30 Trans
31 MapToStorage
32 HeaderParser
33 Access
34 Authen
35 Authz
36 Type
37 Fixup
38 Log
39 Cleanup
40 );
41
42 sub handler {
43 my $r = shift;
44
45 plan $r, tests => scalar @srv, skip_reason('PerlOptions None is broken');
46
47 my $s = $r->server;
48
49 ok t_cmp($s->is_perl_option_enabled($_), 0,
50 "$_ is off under PerlOptions None") for @srv;
51
52 ok t_cmp($s->is_perl_option_enabled('Response'), 1,
53 "Response is off under PerlOptions None");
54
55 return Apache2::Const::OK;
56 }
57
58 1;
59 __DATA__
60 <NoAutoConfig>
61 <VirtualHost TestModperl::perl_options2>
62 PerlOptions None +Response
63 <Location /TestModperl__perl_options2>
64 SetHandler modperl
65 PerlResponseHandler TestModperl::perl_options2
66 </Location>
67 </VirtualHost>
68 </NoAutoConfig>
33 use warnings FATAL => 'all';
44
55 use Apache2::RequestUtil ();
6 use Apache2::ConnectionUtil ();
67
78 use Apache::Test;
89 use Apache::TestUtil;
1213 sub handler {
1314 my $r = shift;
1415
15 plan $r, tests => 9;
16 # make it ok to call ok() here while plan()ing elsewhere
17 Apache::Test::init_test_pm($r);
18
19 Test::_reset_globals() if Test->can('_reset_globals');
20 $Test::ntest = 1 + (26 * ($r->args - 1));
21 $Test::planned = 26;
1622
17 ok $r->pnotes;
23 my $c = $r->connection;
1824
19 ok t_cmp($r->pnotes('pnotes_foo', 'pnotes_bar'),
20 'pnotes_bar',
21 q{$r->pnotes(key,val)});
25 # we call this handler 3 times.
26 # $r->pnotes('request') should be unset each time
27 # $c->pnotes('connection') should be unset the first
28 # time but set the second time due to the keepalive
29 # request. the second request then cleans up after
30 # itself, leaving $c->pnotes again unset at the
31 # start of the third request
32 if ($r->args == 2) {
33 ok t_cmp($c->pnotes('connection'),
34 'CSET',
35 '$c->pnotes() persists across keepalive requests');
36 }
37 else {
38 t_debug('testing $c->pnotes is empty');
39 ok (! $c->pnotes('connection'));
40 }
2241
23 ok t_cmp($r->pnotes('pnotes_foo'),
24 'pnotes_bar',
25 q{$r->pnotes(key)});
42 # $r->pnotes should be reset each time
43 t_debug('testing $r->pnotes is empty');
44 ok (! $r->pnotes('request'));
2645
27 ok t_cmp(ref($r->pnotes), 'HASH', q{ref($r->pnotes)});
46 foreach my $map ({type => 'r', object => $r},
47 {type => 'c', object => $c}) {
2848
29 ok t_cmp($r->pnotes()->{'pnotes_foo'}, 'pnotes_bar',
30 q{$r->pnotes()->{}});
49 my $type = $map->{type};
3150
32 # unset the entry (but the entry remains with undef value)
33 $r->pnotes('pnotes_foo', undef);
34 ok t_cmp($r->pnotes('pnotes_foo'), undef,
35 q{unset entry contents});
36 my $exists = exists $r->pnotes->{'pnotes_foo'};
37 $exists = 1 if $] < 5.008001; # changed in perl 5.8.1
38 ok $exists;
51 my $o = $map->{object};
3952
40 # now delete completely (possible only via the hash inteface)
41 delete $r->pnotes()->{'pnotes_foo'};
42 ok t_cmp($r->pnotes('pnotes_foo'), undef,
43 q{deleted entry contents});
44 ok !exists $r->pnotes->{'pnotes_foo'};
53 t_debug("testing $type->pnotes call");
54 ok $o->pnotes;
55
56 ok t_cmp($o->pnotes('pnotes_foo', 'pnotes_bar'),
57 'pnotes_bar',
58 "$type->pnotes(key,val)");
59
60 ok t_cmp($o->pnotes('pnotes_foo'),
61 'pnotes_bar',
62 "$type->pnotes(key)");
63
64 ok t_cmp(ref($o->pnotes), 'HASH', "ref($type->pnotes)");
65
66 ok t_cmp($o->pnotes()->{'pnotes_foo'}, 'pnotes_bar',
67 "$type->pnotes()->{}");
68
69 # unset the entry (but the entry remains with undef value)
70 $o->pnotes('pnotes_foo', undef);
71 ok t_cmp($o->pnotes('pnotes_foo'), undef,
72 "unset $type contents");
73
74 my $exists = exists $o->pnotes->{'pnotes_foo'};
75 $exists = 1 if $] < 5.008001; # changed in perl 5.8.1
76 ok $exists;
77
78 # now delete completely (possible only via the hash inteface)
79 delete $o->pnotes()->{'pnotes_foo'};
80 ok t_cmp($o->pnotes('pnotes_foo'), undef,
81 "deleted $type contents");
82 ok !exists $o->pnotes->{'pnotes_foo'};
83
84 # test blessed references, like DBI
85 # DBD::DBM ships with DBI...
86 if (have_module(qw(DBI DBD::DBM))) {
87 my $dbh = DBI->connect('dbi:DBM:');
88
89 $o->pnotes(DBH => $dbh);
90
91 my $pdbh = $o->pnotes('DBH');
92
93 ok t_cmp(ref($pdbh), 'DBI::db', "ref($type->pnotes('DBH'))");
94
95 my $quote = $pdbh->quote("quoth'me");
96
97 # see the DBI manpage for why quote() returns the string
98 # wrapped in ' marks
99 ok t_cmp($quote, "'quoth\\'me'", '$pdbh->quote() works');
100 }
101 else {
102 skip ('skipping $dbh retrival test - no DBI or DBD::DBM');
103 skip ('skipping $dbh->quote() test - no DBI or DBD::DBM');
104 }
105 }
106
107 # set pnotes so we can test unset on later connections
108 $r->pnotes(request => 'RSET');
109 $c->pnotes(connection => 'CSET');
110
111 ok t_cmp($r->pnotes('request'),
112 'RSET',
113 '$r->pnotes() set');
114
115 ok t_cmp($c->pnotes('connection'),
116 'CSET',
117 '$c->pnotes() set');
45118
46119 Apache2::Const::OK;
47120 }
4646 http://marc.theaimsgroup.com/?l=apache-modperl&m=108334017416318&w=2
4747 Static works OK!
4848
49 * Does not compile with bleedperl (5.9.x) due to modperl_error.c and Perl_croak()
50 on FreeBSD. This is a PERL bug, but p5p and myself, and not sure where the problem is yet.
51
52 * gcc 4.x and higher compiles break under -Werror
53 [pgollucci volunteers]
54
55 * AAA changes in httpd break httpd 2.3.x+ (svn trunk) builds terribly on all platforms.
56
4957 * Need to cleanup functions only needed for certain build flavors
5058 (perlio/threads/etc) out of lib/ModPerl/WrapXS.pm:$ithread_exports
5159 and use the newer, simpler #ifdef technique (see modperl_io_apache_init
00 #################
11 # mod_perl bugs #
22 #################
3
4 * local %ENV doesn't work, see t/modperl/local_ent.
5
6 * PerlOptions None needs to be implemented, see t/modperl/perl_options2.t
7
8 * PerlIOApache_flush()
9 Setting local $| = 0 doesn't work with regular print statements under ModPerl::*
10
11 http://p6m7g8.net/MP2/84625
12 http://www.gossamer-threads.com/lists/modperl/dev/85365
13 [pgollucci volunteers]
14
15 * $r->rflush doesn't work. see:
16 http://marc.theaimsgroup.com/?l=apache-modperl&m=103847990813285&w=2
17 I also see a weird behavior where it does sends FLUSH buckets but
18 they all seem to fall through the data, thus not really flushing
19 anything. this can be easily reproduced with MyApache::FilterSnoop.
20
21 See also
22 http://www.gossamer-threads.com/lists/modperl/dev/84744?search_string=%23%7C%2C%20flushing%2C%20etc;#84743
23 for a related $| but not the same issue.
24 [pgollucci volunteers]
325
426 * early pool destruction issues
527 http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108872944815382&w=2
2850 possible solution: add a new field to the map files, which will be
2951 used as a usage message whenever an argument error occurs.
3052
31
3253 * 'SetHandler modperl' doesn't reset $|, so if anything turns it on
3354 anywhere, it's going to stay that way. Meaning excessive flushing
3455 probably causing a performance hit. I've tried to add the code to
4768 tied objects.
4869
4970
50 * $r->rflush doesn't work. see:
51 http://marc.theaimsgroup.com/?l=apache-modperl&m=103847990813285&w=2
52 I also see a weird behavior where it does sends FLUSH buckets but
53 they all seem to fall through the data, thus not really flushing
54 anything. this can be easily reproduced with MyApache::FilterSnoop.
5571
5672 * Apache::Log compat issues:
5773
7979 * mod_perl::import
8080 - Apache->import:
8181 required for exit/warn overridding
82 - use mod_perl2 qw(2.0 MethodHandlers Authen Authz [...]);
83 used to be able to specify what optionnal feature were required
8284
8385 * Apache::test: tobe a compat stub around new test framework
8486
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
1212 use constant SOLARIS => $^O eq 'solaris';
1313 use constant BUILD_APREXT => Apache2::Build::BUILD_APREXT;
1414
15 my %args = (
16 'NAME' => 'APR',
17 'VERSION_FROM' => 'APR.pm',
18 );
15 my %args;
16
17 %args = map { split /=/, $_ } @ARGV;
18
19 $args{NAME} = 'APR';
20 $args{VERSION_FROM} = 'APR.pm';
1921
2022 my $libs = '';
23 $libs = delete $args{LIBS} if $args{LIBS};
24
2125 my $build = ModPerl::BuildMM::build_config();
2226
2327 my @apru_link_flags = $build->apru_link_flags;
2529
2630 if (WIN32) {
2731 $libs =~ s{/libpath:}{-L}g;
28 $libs =~ s{(\w+)\.lib}{-l$1}g;
32 $libs =~ s{(\S+)\.lib}{-l$1}g;
2933 }
3034
3135 if (BUILD_APREXT) {
5256
5357 # -R makes sure that these paths will be used
5458 $extralddflags =~ s{-L(\S+)}{-L$1 -R$1}g;
55 $args{LDDLFLAGS} = $extralddflags . " " . $build->perl_config('lddlflags');
59 $args{LDDLFLAGS} = "" unless exists $args{LDDLFLAGS};
60 $args{LDDLFLAGS} = join " ", $args{LDDLFLAGS}, $extralddflags,
61 $build->perl_config('lddlflags');
5662
5763 # -R are now copied to LDDFLAGS, but leave -L's in LIBS --
5864 # EU::MM needs it.
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
7980 errmsg =
8081 modperl_config_insert_request(aTHX_ r,
8182 newRV_noinc((SV*)config),
82 OR_AUTHCFG);
83 OR_AUTHCFG, NULL,
84 MP_HTTPD_OVERRIDE_OPTS_UNSET);
8385
8486 if (errmsg) {
8587 Perl_warn(aTHX_ "Can't change %s to '%s'\n", directive, val);
139141 }
140142 });
141143 }
144
145 static MP_INLINE
146 int mpxs_Apache2__RequestRec_allow_override_opts(pTHX_ request_rec *r)
147 {
148 #ifdef MP_HTTPD_HAS_OVERRIDE_OPTS
149 core_dir_config *cfg = ap_get_module_config(r->per_dir_config,
150 &core_module);
151 return cfg->override_opts;
152 #else
153 return MP_HTTPD_OVERRIDE_OPTS_DEFAULT;
154 #endif
155 }
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
3435 Perl_croak(aTHX_ "$parms->add_config() has failed: %s", errmsg);
3536 }
3637 }
38
39 static MP_INLINE
40 int mpxs_Apache2__CmdParms_override_opts(pTHX_ cmd_parms *parms)
41 {
42 #ifdef MP_HTTPD_HAS_OVERRIDE_OPTS
43 return parms->override_opts;
44 #else
45 return MP_HTTPD_OVERRIDE_OPTS_DEFAULT;
46 #endif
47 }
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 static MP_INLINE
17 SV *mpxs_Apache2__Connection_pnotes(pTHX_ conn_rec *c, SV *key, SV *val)
18 {
19 MP_dCCFG;
20
21 modperl_config_con_init(c, ccfg);
22
23 if (!ccfg) {
24 return &PL_sv_undef;
25 }
26
27 return modperl_pnotes(aTHX_ &ccfg->pnotes, key, val, NULL, c);
28 }
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2003-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
211212 SV *mpxs_Apache2__RequestRec_pnotes(pTHX_ request_rec *r, SV *key, SV *val)
212213 {
213214 MP_dRCFG;
214 SV *retval = NULL;
215215
216216 if (!rcfg) {
217217 return &PL_sv_undef;
218218 }
219 if (!rcfg->pnotes) {
220 rcfg->pnotes = newHV();
221 }
222
223 if (key) {
224 STRLEN len;
225 char *k = SvPV(key, len);
226
227 if (val) {
228 retval = *hv_store(rcfg->pnotes, k, len,
229 SvREFCNT_inc(val), 0);
230 }
231 else if (hv_exists(rcfg->pnotes, k, len)) {
232 retval = *hv_fetch(rcfg->pnotes, k, len, FALSE);
233 }
234 }
235 else {
236 retval = newRV_inc((SV *)rcfg->pnotes);
237 }
238
239 return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
219
220 return modperl_pnotes(aTHX_ &rcfg->pnotes, key, val, r, NULL);
240221 }
241222
242223 #define mpxs_Apache2__RequestRec_dir_config(r, key, sv_val) \
301282 }
302283
303284 static MP_INLINE
304 void mpxs_Apache2__RequestRec_add_config(pTHX_ request_rec *r, SV *lines, int override)
285 void mpxs_Apache2__RequestRec_add_config(pTHX_ request_rec *r, SV *lines,
286 int override, char *path,
287 int override_options)
305288 {
306289 const char *errmsg = modperl_config_insert_request(aTHX_ r, lines,
307 override);
290 override, path,
291 override_options);
308292 if (errmsg) {
309293 Perl_croak(aTHX_ "$r->add_config() has failed: %s", errmsg);
310294 }
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
1112 * See the License for the specific language governing permissions and
1213 * limitations under the License.
1314 */
15
16 #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
17 #include "unixd.h"
18 #endif
1419
1520 #define mpxs_Apache2__ServerUtil_restart_count modperl_restart_count
1621
150155
151156 #define mpxs_Apache2__ServerUtil_server(classname) modperl_global_get_server_rec()
152157
158 #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
159 #define mpxs_Apache2__ServerUtil_user_id(classname) unixd_config.user_id
160 #define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id
161 #else
162 #define mpxs_Apache2__ServerUtil_user_id(classname) 0
163 #define mpxs_Apache2__ServerUtil_group_id(classname) 0
164 #endif
165
153166 static MP_INLINE
154167 int mpxs_Apache2__ServerRec_is_perl_option_enabled(pTHX_ server_rec *s,
155168 const char *name)
161174 static MP_INLINE
162175 void mpxs_Apache2__ServerRec_add_config(pTHX_ server_rec *s, SV *lines)
163176 {
164 const char *errmsg = modperl_config_insert_server(aTHX_ s, lines);
177 const char *errmsg;
178
179 MP_CROAK_IF_POST_POST_CONFIG_PHASE("$s->add_config");
180
181 errmsg = modperl_config_insert_server(aTHX_ s, lines);
165182 if (errmsg) {
166183 Perl_croak(aTHX_ "$s->add_config() has failed: %s", errmsg);
167184 }
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2002-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2004 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 # Copyright 2001-2005 The Apache Software Foundation
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
56 #
67 # http://www.apache.org/licenses/LICENSE-2.0
78 #
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
4646 undef &$fullname;
4747 }
4848 if (*{$fullname}{IO}) {
49 if (fileno $fullname) {
50 close $fullname;
51 }
49 local $@;
50 eval {
51 if (fileno $fullname) {
52 close $fullname;
53 }
54 };
5255 }
5356 }
5457
245245 < cmd
246246 < context
247247 ! err_directive
248 - override_opts
248249 </cmd_parms>
249250
250251 !<ap_mgmt_item_t>
2929 mpxs_Apache2__RequestRec_location
3030 mpxs_Apache2__RequestRec_as_string
3131 mpxs_Apache2__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
32 mpxs_Apache2__RequestRec_add_config | | r, lines, override=OR_AUTHCFG
32 mpxs_Apache2__RequestRec_add_config | | r, lines, override=MP_HTTPD_OVERRIDE_HTACCESS, path=NULL, override_options=MP_HTTPD_OVERRIDE_OPTS_UNSET
3333 mpxs_Apache2__RequestRec_document_root | | r, new_root=Nullsv
3434 mpxs_Apache2__RequestRec_child_terminate
3535
8686
8787 MODULE=Apache2::ServerUtil PACKAGE=Apache2::ServerUtil
8888 server_rec *:DEFINE_server | | SV *:classname=Nullsv
89 uid_t:DEFINE_user_id | | SV *:classname=Nullsv
90 gid_t:DEFINE_group_id | | SV *:classname=Nullsv
8991
9092 MODULE=Apache2::Connection
9193 mpxs_Apache2__Connection_client_socket | | c, s=NULL
94
95 MODULE=Apache2::ConnectionUtil PACKAGE=guess
96 mpxs_Apache2__Connection_pnotes | | c, key=Nullsv, val=Nullsv
9297
9398 MODULE=Apache2::Filter
9499 modperl_filter_attributes | MPXS_ | ... | MODIFY_CODE_ATTRIBUTES
149154 ap_method_is_limited
150155 mpxs_Apache2__CmdParms_info
151156 mpxs_Apache2__CmdParms_add_config
157 mpxs_Apache2__CmdParms_override_opts
152158
153159 MODULE=Apache2::MPM PACKAGE=Apache2::MPM BOOT=1
154160 mpxs_Apache2__MPM_query
161
162 MODULE=Apache2::Access PACKAGE=guess
163 mpxs_Apache2__RequestRec_allow_override_opts
0 /* Copyright 2001-2005 The Apache Software Foundation
1 *
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
0 /* Licensed to the Apache Software Foundation (ASF) under one or more
1 * contributor license agreements. See the NOTICE file distributed with
2 * this work for additional information regarding copyright ownership.
3 * The ASF licenses this file to You under the Apache License, Version 2.0
4 * (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
56 *
67 * http://www.apache.org/licenses/LICENSE-2.0
78 *
13701370 'name' => 'path'
13711371 },
13721372 {
1373 'type' => 'int',
1374 'name' => 'override_options'
1375 },
1376 {
13731377 'type' => 'ap_conf_vector_t *',
13741378 'name' => 'conf'
13751379 },
14161420 {
14171421 'type' => 'int',
14181422 'name' => 'override'
1423 },
1424 {
1425 'type' => 'char *',
1426 'name' => 'path'
1427 },
1428 {
1429 'type' => 'int',
1430 'name' => 'override_options'
14191431 }
14201432 ]
14211433 },
14761488 {
14771489 'type' => 'request_rec *',
14781490 'name' => 'r'
1491 }
1492 ]
1493 },
1494 {
1495 'return_type' => 'modperl_config_con_t *',
1496 'name' => 'modperl_config_con_new',
1497 'args' => [
1498 {
1499 'type' => 'conn_rec *',
1500 'name' => 'c'
14791501 }
14801502 ]
14811503 },
44004422 ]
44014423 },
44024424 {
4425 'return_type' => 'SV *',
4426 'name' => 'modperl_pnotes',
4427 'args' => [
4428 {
4429 'type' => 'PerlInterpreter *',
4430 'name' => 'my_perl'
4431 },
4432 {
4433 'type' => 'HV **',
4434 'name' => 'pnotes'
4435 },
4436 {
4437 'type' => 'SV *',
4438 'name' => 'key'
4439 },
4440 {
4441 'type' => 'SV *',
4442 'name' => 'val'
4443 },
4444 {
4445 'type' => 'request_rec *',
4446 'name' => 'r'
4447 }
4448 ]
4449 },
4450 {
44034451 'return_type' => 'int',
44044452 'name' => 'modperl_post_config_handler',
44054453 'args' => [
61046152 ]
61056153 },
61066154 {
6155 'return_type' => 'int',
6156 'name' => 'mpxs_Apache2__CmdParms_override_opts',
6157 'args' => [
6158 {
6159 'type' => 'PerlInterpreter *',
6160 'name' => 'my_perl'
6161 },
6162 {
6163 'type' => 'cmd_parms *',
6164 'name' => 'parms'
6165 }
6166 ]
6167 },
6168 {
61076169 'return_type' => 'void',
61086170 'name' => 'mpxs_Apache2__Connection_add_input_filter',
61096171 'args' => [
61816243 },
61826244 {
61836245 'return_type' => 'SV *',
6246 'name' => 'mpxs_Apache2__Connection_pnotes',
6247 'args' => [
6248 {
6249 'type' => 'PerlInterpreter *',
6250 'name' => 'my_perl'
6251 },
6252 {
6253 'type' => 'conn_rec *',
6254 'name' => 'c'
6255 },
6256 {
6257 'type' => 'SV *',
6258 'name' => 'key'
6259 },
6260 {
6261 'type' => 'SV *',
6262 'name' => 'val'
6263 }
6264 ]
6265 },
6266 {
6267 'return_type' => 'SV *',
61846268 'name' => 'mpxs_Apache2__Directive_as_hash',
61856269 'attr' => [
61866270 'static',
66356719 {
66366720 'type' => 'int',
66376721 'name' => 'override'
6722 },
6723 {
6724 'type' => 'char *',
6725 'name' => 'path'
6726 },
6727 {
6728 'type' => 'int',
6729 'name' => 'override_options'
66386730 }
66396731 ]
66406732 },
66716763 {
66726764 'type' => 'SV *',
66736765 'name' => 'callback'
6766 }
6767 ]
6768 },
6769 {
6770 'return_type' => 'int',
6771 'name' => 'mpxs_Apache2__RequestRec_allow_override_opts',
6772 'args' => [
6773 {
6774 'type' => 'PerlInterpreter *',
6775 'name' => 'my_perl'
6776 },
6777 {
6778 'type' => 'request_rec *',
6779 'name' => 'r'
66746780 }
66756781 ]
66766782 },