[svn-upgrade] Integrating new upstream version, libapache2-mod-perl2 (2.0.3)
Damyan Ivanov
16 years ago
5 | 5 | |
6 | 6 | Stas Bekman <stas@stason.org> |
7 | 7 | Geoffrey Young <geoff@modperlcookbook.org> |
8 | Philip M. Gollucci <pgollucci@p6m7g8.com> | |
8 | 9 | |
9 | 10 | with contributions from the following helpful people |
10 | 11 | (in alphabetical order): |
13 | 14 | David Wheeler <david@kineticode.com> |
14 | 15 | Gary Benson <gbenson@redhat.com> |
15 | 16 | Ken Williams <ken@forum.swarthmore.edu> |
16 | Philip M. Gollucci <pgollucci@p6m7g8.com> | |
17 | 17 | Randy Kobes <randy@theoryx5.uwinnipeg.ca> |
18 | 18 | Rick Myers <rik@sumthin.nu> |
19 | 19 | Steve Hay <steve.hay@uk.radan.com> |
5 | 5 | |
6 | 6 | =over 3 |
7 | 7 | |
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 | |
9 | 86 | |
10 | 87 | localize ScriptSock directive to always point to t/logs/cgisock |
11 | 88 | regardless of inherited and custom mod_cgid settings |
123 | 123 | my $fh = Symbol::gensym(); |
124 | 124 | open $fh, 'Changes' or die "Can't open Changes: $!"; |
125 | 125 | while (<$fh>) { |
126 | if(/^=item.*-dev/) { | |
127 | $VERSION .= '-dev'; | |
126 | if(/^=item.*-(dev|rc\d+)/) { | |
127 | $VERSION .= "-$1"; | |
128 | 128 | last; |
129 | 129 | } |
130 | 130 | last if /^=item/; |
138 | 138 | # it then decides that it's a part of the modperl-2.0 build and |
139 | 139 | # will try to use modperl httpd/apxs arguments which could be |
140 | 140 | # unset or wrong |
141 | if (TOP_LEVEL && -e "../lib/mod_perl.pm") { | |
141 | if (TOP_LEVEL && -e "../lib/mod_perl2.pm") { | |
142 | 142 | error "Do not run 'perl Makefile.PL' when Apache-Test is a " . |
143 | 143 | "subdirectory of modperl-2.0. Copy it elsewhere and run " . |
144 | 144 | "from there."; |
30 | 30 | moderated, so unless you are subscribed to it it may take some time |
31 | 31 | for your post to make it to the list. |
32 | 32 | |
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 | |
34 | 34 | |
35 | 35 | List Archives: |
36 | 36 | # www.apachelabs.org |
0 | 0 | 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@. | |
1 | 4 | |
2 | 5 | 1. 'make dist' - to make sure nothing is missing from the manifest, |
3 | 6 | etc. Now test this generated package (not svn) with as many |
4 | 7 | 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) | |
7 | 8 | |
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 | |
9 | 11 | |
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' | |
11 | 13 | |
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: | |
13 | 17 | |
14 | 18 | % APACHE_TEST_PRETEND_NO_LWP=1 make test |
15 | 19 | |
18 | 22 | to the various lists |
19 | 23 | |
20 | 24 | 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 | |
23 | 26 | o modperl/perl.apache.org |
27 | o dev/httpd.apache.org | |
24 | 28 | |
25 | 29 | (or maybe longer to give most people a chance to catch up). no need |
26 | 30 | to tag this package |
31 | ||
32 | Subject: [RELEASE CANDIDATE] Apache-Test-1.29 RC\d+ | |
27 | 33 | |
28 | 34 | a. if problems are detected during stage 2, repeat stages 1 and 2. |
29 | 35 | |
31 | 37 | package to be released |
32 | 38 | |
33 | 39 | a. edit ./Changes: |
34 | - remove '-dev' | |
40 | - remove -rc\d+ | |
35 | 41 | - add release date |
36 | 42 | |
37 | 43 | b. rerun: |
55 | 61 | 5. Announce the package |
56 | 62 | |
57 | 63 | a. post ... to the modperl, announce lists |
58 | Subject: [ANNOUNCE] Apache-Test 1.27 | |
64 | Subject: [ANNOUNCE] Apache-Test 1.29 | |
59 | 65 | include |
60 | 66 | - MD5 sig (as it comes from CPAN upload announce). |
61 | 67 | - the latest Changes |
67 | 73 | b. edit ./Changes: |
68 | 74 | - start a new item with incremented version + '-dev' |
69 | 75 | |
70 | =item 1.28-dev | |
76 | =item 1.30-dev | |
71 | 77 | |
72 | 78 | c. bump up version numbers in this file to make it easier to do the |
73 | 79 | next release. |
74 | 80 | |
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 | |
80 | 82 | |
81 | 83 | 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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
21 | 21 | use Config; |
22 | 22 | use Apache::TestConfig (); |
23 | 23 | |
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 | ||
24 | 36 | use vars qw(@ISA @EXPORT %EXPORT_TAGS $VERSION %SubTests @SkipReasons); |
25 | 37 | |
26 | $VERSION = '1.27'; | |
38 | $VERSION = '1.29'; | |
27 | 39 | |
28 | 40 | my @need = qw(need_lwp need_http11 need_cgi need_access need_auth |
29 | 41 | need_module need_apache need_min_apache_version |
30 | 42 | need_apache_version need_perl need_min_perl_version |
31 | 43 | 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); | |
33 | 45 | |
34 | 46 | my @have = map { (my $need = $_) =~ s/need/have/; $need } @need; |
35 | 47 | |
335 | 347 | } |
336 | 348 | |
337 | 349 | sub need_cgi { |
338 | need_module('cgi') || need_module('cgid'); | |
350 | return _need_multi(qw(cgi cgid)); | |
339 | 351 | } |
340 | 352 | |
341 | 353 | 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)); | |
343 | 355 | } |
344 | 356 | |
345 | 357 | sub need_php4 { |
346 | need_module('php4') || need_module('sapi_apache2.c'); | |
358 | return _need_multi(qw(php4 sapi_apache2.c)); | |
347 | 359 | } |
348 | 360 | |
349 | 361 | sub need_access { |
350 | need_module('access') || need_module('authz_host'); | |
362 | return _need_multi(qw(access authz_host)); | |
351 | 363 | } |
352 | 364 | |
353 | 365 | 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; | |
355 | 393 | } |
356 | 394 | |
357 | 395 | sub need_apache { |
608 | 646 | skipped if need_module() returns false (which happens when at least |
609 | 647 | one C or Perl module from the list cannot be found). |
610 | 648 | |
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 | ||
611 | 655 | =item * a C<CODE> reference |
612 | 656 | |
613 | 657 | the tests will be skipped if the function returns a false value. For |
698 | 742 | plan tests => 5, need_php4; |
699 | 743 | |
700 | 744 | 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 | |
701 | 751 | |
702 | 752 | =item need_apache |
703 | 753 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
29 | 29 | my $CRLF = "\015\012"; |
30 | 30 | |
31 | 31 | 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; | |
33 | 51 | |
34 | 52 | my $config = Apache::Test::config(); |
35 | 53 | |
36 | 54 | $method ||= 'GET'; |
37 | 55 | $url ||= '/'; |
38 | $headers ||= {}; | |
56 | my %headers = (); | |
39 | 57 | |
40 | 58 | my $hostport = Apache::TestRequest::hostport($config); |
41 | $headers->{Host} = (split ':', $hostport)[0]; | |
59 | $headers{Host} = (split ':', $hostport)[0]; | |
42 | 60 | |
43 | 61 | my $s = Apache::TestRequest::vhost_socket(); |
44 | 62 | |
47 | 65 | return undef; |
48 | 66 | } |
49 | 67 | |
50 | my $content = delete $headers->{'content'}; | |
51 | 68 | 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'; | |
54 | 71 | } |
55 | 72 | |
56 | 73 | #for modules/setenvif |
57 | $headers->{'User-Agent'} ||= 'libwww-perl/0.00'; | |
74 | $headers{'User-Agent'} ||= 'libwww-perl/0.00'; | |
58 | 75 | |
59 | 76 | my $request = join $CRLF, |
60 | 77 | "$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; | |
62 | 87 | |
63 | 88 | # using send() avoids the need to use SIGPIPE if the server aborts |
64 | 89 | # the connection |
122 | 147 | no strict 'refs'; |
123 | 148 | *$method = sub { |
124 | 149 | my $url = shift; |
125 | my $headers = { @_ }; | |
126 | request($method, $url, $headers); | |
150 | request($method, $url, @_); | |
127 | 151 | }; |
128 | 152 | } |
129 | 153 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
22 | 22 | use constant CYGWIN => $^O eq 'cygwin'; |
23 | 23 | use constant NETWARE => $^O eq 'NetWare'; |
24 | 24 | use constant SOLARIS => $^O eq 'solaris'; |
25 | use constant WINFU => WIN32 || CYGWIN || NETWARE; | |
25 | use constant WINFU => WIN32 || NETWARE; | |
26 | 26 | use constant COLOR => ($ENV{APACHE_TEST_COLOR} && -t STDOUT) ? 1 : 0; |
27 | 27 | |
28 | 28 | use constant DEFAULT_PORT => 8529; |
74 | 74 | t_dir => 'the t/ test directory (default is $top_dir/t)', |
75 | 75 | t_conf => 'the conf/ test directory (default is $t_dir/conf)', |
76 | 76 | 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)', | |
77 | 78 | t_conf_file => 'test httpd.conf file (default is $t_conf/httpd.conf)', |
78 | 79 | src_dir => 'source directory to look for mod_foos.so', |
79 | 80 | serverroot => 'ServerRoot (default is $t_dir)', |
102 | 103 | ); |
103 | 104 | |
104 | 105 | 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 | |
106 | 107 | documentroot bindir sbindir httpd apxs httpd_conf httpd_conf_extra |
107 | 108 | perlpod sslca libmodperl); |
108 | 109 | |
307 | 308 | $vars->{sslcaorg} ||= 'asf'; |
308 | 309 | $vars->{t_logs} ||= catfile $vars->{serverroot}, 'logs'; |
309 | 310 | $vars->{t_conf_file} ||= catfile $vars->{t_conf}, 'httpd.conf'; |
311 | $vars->{t_pid_file} ||= catfile $vars->{t_logs}, 'httpd.pid'; | |
310 | 312 | |
311 | 313 | if (WINFU) { |
312 | 314 | for (keys %$vars) { |
713 | 715 | for my $bindir (qw(bin sbin)) { |
714 | 716 | my $httpd = catfile $p, $bindir, $vars->{target}; |
715 | 717 | 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 | } | |
716 | 727 | } |
717 | 728 | } |
718 | 729 | } |
885 | 896 | sub genwarning { |
886 | 897 | my($self, $filename, $from_filename) = @_; |
887 | 898 | return unless $filename; |
899 | my $time = scalar localtime; | |
888 | 900 | my $warning = "WARNING: this file is generated"; |
889 | 901 | $warning .= " (from $from_filename)" if defined $from_filename; |
890 | 902 | $warning .= ", do not edit\n"; |
903 | $warning .= "generated on $time\n"; | |
891 | 904 | $warning .= calls_trace(); |
892 | 905 | return $self->warn_style_sub_ref($filename)->($warning); |
893 | 906 | } |
1023 | 1036 | |
1024 | 1037 | my $fh = $self->genfile($file, undef, 1); |
1025 | 1038 | |
1026 | # shebang | |
1027 | print $fh "#!$Config{perlpath}\n"; | |
1039 | my $shebang = make_shebang(); | |
1040 | print $fh $shebang; | |
1028 | 1041 | |
1029 | 1042 | $self->genfile_warning($file, undef, $fh); |
1030 | 1043 | |
1032 | 1045 | |
1033 | 1046 | close $fh; |
1034 | 1047 | 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; | |
1035 | 1065 | } |
1036 | 1066 | |
1037 | 1067 | sub cpfile { |
1110 | 1140 | } |
1111 | 1141 | } |
1112 | 1142 | |
1143 | my %special_tokens = ( | |
1144 | nextavailableport => sub { shift->server->select_next_port } | |
1145 | ); | |
1146 | ||
1113 | 1147 | sub replace { |
1114 | 1148 | my $self = shift; |
1115 | 1149 | my $file = $Apache::TestConfig::File |
1117 | 1151 | |
1118 | 1152 | s[@(\w+)@] |
1119 | 1153 | [ 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 | } | |
1123 | 1163 | ]ge; |
1124 | 1164 | } |
1125 | 1165 | |
1548 | 1588 | |
1549 | 1589 | $self->preamble_run($out); |
1550 | 1590 | |
1551 | for my $name (qw(user group)) { #win32/cygwin do not support | |
1591 | for my $name (qw(user group)) { #win32 | |
1552 | 1592 | if ($vars->{$name}) { |
1553 | 1593 | print $out qq[\u$name "$vars->{$name}"\n]; |
1554 | 1594 | } |
1624 | 1664 | if (my @env_vars = grep { $ENV{$_} } keys %$passenv) { |
1625 | 1665 | push @reasons, "environment variables (@env_vars) are set"; |
1626 | 1666 | } |
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 | } | |
1627 | 1678 | } |
1628 | 1679 | |
1629 | 1680 | return @reasons; |
1712 | 1763 | $self->{_apxs}{$q}; |
1713 | 1764 | } |
1714 | 1765 | |
1715 | # Temporarily untaint PATH | |
1766 | # return an untainted PATH | |
1716 | 1767 | sub untaint_path { |
1717 | 1768 | my $path = shift; |
1718 | 1769 | ($path) = ( $path =~ /(.*)/ ); |
1719 | 1770 | # win32 uses ';' for a path separator, assume others use ':' |
1720 | 1771 | my $sep = WIN32 ? ';' : ':'; |
1721 | 1772 | # -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; | |
1723 | 1775 | } |
1724 | 1776 | |
1725 | 1777 | sub pop_dir { |
1746 | 1798 | my $apache_test_dir = catdir $top_dir, "Apache-Test"; |
1747 | 1799 | unshift @dirs, $apache_test_dir if -d $apache_test_dir; |
1748 | 1800 | |
1801 | lib::->import(@dirs); | |
1802 | ||
1749 | 1803 | 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 | |
1750 | 1806 | 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 | ||
1755 | 1810 | #print join "\n", "add_inc", @INC, ""; |
1756 | 1811 | } |
1757 | 1812 | |
1802 | 1857 | my($self) = @_; |
1803 | 1858 | |
1804 | 1859 | return unless $self->{save}; |
1860 | ||
1861 | # add in the Apache-Test version for later comparisions | |
1862 | $self->{apache_test_version} = Apache::Test->VERSION; | |
1805 | 1863 | |
1806 | 1864 | my $name = 'apache_test_config'; |
1807 | 1865 | my $file = catfile $self->{vars}->{t_conf}, "$name.pm"; |
2533 | 2591 | interactive config won't be skipped (if needed). |
2534 | 2592 | |
2535 | 2593 | |
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. | |
2537 | 2630 | |
2538 | 2631 | =head1 AUTHOR |
2539 | 2632 | |
2550 | 2643 | ServerRoot "@ServerRoot@" |
2551 | 2644 | DocumentRoot "@DocumentRoot@" |
2552 | 2645 | |
2553 | PidFile @t_logs@/httpd.pid | |
2646 | PidFile @t_pid_file@ | |
2554 | 2647 | ErrorLog @t_logs@/error_log |
2555 | 2648 | LogLevel debug |
2556 | 2649 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
346 | 346 | cmodule_define($_); |
347 | 347 | } @cmodule_config_names; |
348 | 348 | |
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 | ||
349 | 354 | my $cmodule_config_hooks = join ",\n ", map { |
350 | 355 | cmodule_define_name($_); |
351 | 356 | } @cmodule_config_names; |
396 | 401 | static void name ## _register_hooks(apr_pool_t *p) |
397 | 402 | { |
398 | 403 | @cmodule_hooks |
404 | APACHE_HTTPD_TEST_EXTRA_HOOKS(p); | |
399 | 405 | } |
400 | 406 | |
401 | 407 | module AP_MODULE_DECLARE_DATA name ## _module = { |
434 | 440 | } |
435 | 441 | |
436 | 442 | print $fh @cmodule_hook_defines, @cmodule_config_defines; |
443 | ||
444 | print $fh $cmodule_config_extra; | |
437 | 445 | |
438 | 446 | print $fh $self->cmodules_module_template; |
439 | 447 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
93 | 93 | |
94 | 94 | my $dir = catfile $self->{vars}->{t_dir}, lc $path; |
95 | 95 | my $t = catfile $dir, $file; |
96 | my $php_t = catfile $dir, $test; | |
96 | 97 | return if -e $t; |
97 | 98 | |
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; | |
103 | 106 | use Apache::TestRequest 'GET_BODY_ASSERT'; |
104 | 107 | print GET_BODY_ASSERT "/$location/$test"; |
105 | 108 | EOF |
106 | 109 | |
107 | close $fh or die "close $t: $!"; | |
108 | } | |
110 | close $fh or die "close $t: $!"; | |
109 | 111 | |
110 | 112 | # write out an all.t file for the directory |
111 | 113 | # that will skip running all PHP test unless have_php |
422 | 424 | * PROJECT INFORMATION * |
423 | 425 | * * |
424 | 426 | * 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 * | |
427 | 429 | * * |
428 | 430 | ********************************************************************* |
429 | 431 | * LICENSE INFORMATION * |
453 | 455 | * Originally inspired by work from Andy Lester. Written and * |
454 | 456 | * maintained by Chris Shiflett. For contact information, see: * |
455 | 457 | * * |
456 | * http://shiflett.org/contact * | |
458 | * http://shiflett.org/ * | |
457 | 459 | * * |
458 | 460 | \*******************************************************************/ |
459 | 461 | |
460 | 462 | header('Content-Type: text/plain'); |
461 | 463 | register_shutdown_function('_test_end'); |
462 | 464 | |
463 | $_no_plan = false; | |
465 | $_no_plan = FALSE; | |
464 | 466 | $_num_failures = 0; |
465 | 467 | $_num_skips = 0; |
466 | 468 | $_test_num = 0; |
467 | 469 | |
468 | 470 | function plan($plan) |
469 | 471 | { |
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 | */ | |
474 | 478 | |
475 | 479 | global $_no_plan; |
476 | 480 | global $_skip_all; |
479 | 483 | switch ($plan) |
480 | 484 | { |
481 | 485 | case 'no_plan': |
482 | $_no_plan = true; | |
486 | $_no_plan = TRUE; | |
483 | 487 | break; |
484 | 488 | |
485 | 489 | case 'skip_all': |
486 | 490 | echo "1..0\n"; |
487 | exit; | |
488 | 491 | break; |
489 | 492 | |
490 | 493 | default: |
510 | 513 | if ($_num_skips) |
511 | 514 | { |
512 | 515 | $_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] != '#') | |
517 | 520 | { |
518 | 521 | $test_name = "- $test_name"; |
519 | 522 | } |
551 | 554 | function is($this, $that, $test_name = '') |
552 | 555 | { |
553 | 556 | $pass = ($this == $that); |
557 | ||
554 | 558 | ok($pass, $test_name); |
555 | 559 | |
556 | 560 | if (!$pass) |
565 | 569 | function isnt($this, $that, $test_name = '') |
566 | 570 | { |
567 | 571 | $pass = ($this != $that); |
572 | ||
568 | 573 | ok($pass, $test_name); |
569 | 574 | |
570 | 575 | if (!$pass) |
571 | 576 | { |
572 | 577 | diag(" '$this'"); |
573 | diag(" !="); | |
578 | diag(' !='); | |
574 | 579 | diag(" '$that'"); |
575 | 580 | } |
576 | 581 | |
577 | 582 | return $pass; |
578 | 583 | } |
579 | 584 | |
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 | ||
583 | 589 | ok($pass, $test_name); |
584 | 590 | |
585 | 591 | if (!$pass) |
586 | 592 | { |
587 | 593 | diag(" '$string'"); |
588 | diag(" doesn't match '$regex'"); | |
594 | diag(" doesn't match '$pattern'"); | |
589 | 595 | } |
590 | 596 | |
591 | 597 | return $pass; |
592 | 598 | } |
593 | 599 | |
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 | ||
597 | 604 | ok($pass, $test_name); |
598 | 605 | |
599 | 606 | if (!$pass) |
600 | 607 | { |
601 | 608 | diag(" '$string'"); |
602 | diag(" matches '$regex'"); | |
609 | diag(" matches '$pattern'"); | |
603 | 610 | } |
604 | 611 | |
605 | 612 | return $pass; |
607 | 614 | |
608 | 615 | function cmp_ok($this, $operator, $that, $test_name = '') |
609 | 616 | { |
610 | eval('$pass = ($this ' . $operator . ' $that);'); | |
617 | eval("\$pass = (\$this $operator \$that);"); | |
618 | ||
611 | 619 | ok($pass, $test_name); |
612 | 620 | |
613 | 621 | if (!$pass) |
621 | 629 | |
622 | 630 | function can_ok($object, $methods) |
623 | 631 | { |
624 | $pass = true; | |
632 | $pass = TRUE; | |
625 | 633 | $errors = array(); |
626 | 634 | |
627 | 635 | foreach ($methods as $method) |
628 | 636 | { |
629 | 637 | if (!method_exists($object, $method)) |
630 | 638 | { |
631 | $pass = false; | |
639 | $pass = FALSE; | |
632 | 640 | $errors[] = " method_exists(\$object, $method) failed"; |
633 | 641 | } |
634 | 642 | } |
635 | 643 | |
636 | 644 | if ($pass) |
637 | 645 | { |
638 | ok(true, "method_exists(\$object, ...)"); | |
646 | ok(TRUE, "method_exists(\$object, ...)"); | |
639 | 647 | } |
640 | 648 | else |
641 | 649 | { |
642 | ok(false, "method_exists(\$object, ...)"); | |
650 | ok(FALSE, "method_exists(\$object, ...)"); | |
643 | 651 | diag($errors); |
644 | 652 | } |
645 | 653 | |
661 | 669 | |
662 | 670 | if ($pass) |
663 | 671 | { |
664 | ok(true, "$object_name isa $expected_class"); | |
672 | ok(TRUE, "$object_name isa $expected_class"); | |
665 | 673 | } |
666 | 674 | else |
667 | 675 | { |
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'"); | |
669 | 677 | } |
670 | 678 | |
671 | 679 | return $pass; |
673 | 681 | |
674 | 682 | function pass($test_name = '') |
675 | 683 | { |
676 | return ok(true, $test_name); | |
684 | return ok(TRUE, $test_name); | |
677 | 685 | } |
678 | 686 | |
679 | 687 | function fail($test_name = '') |
680 | 688 | { |
681 | return ok(false, $test_name); | |
689 | return ok(FALSE, $test_name); | |
682 | 690 | } |
683 | 691 | |
684 | 692 | function diag($message) |
719 | 727 | |
720 | 728 | for ($i = 0; $i < $num; $i++) |
721 | 729 | { |
722 | # FIXME: The pound sign should replace the hyphen | |
723 | 730 | pass("# SKIP $message"); |
724 | 731 | } |
725 | 732 | |
726 | 733 | $_num_skips = $num; |
727 | 734 | } |
728 | 735 | |
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 | */ | |
752 | 765 | |
753 | 766 | function _test_end() |
754 | 767 | { |
766 | 779 | diag("Looks like you failed $_num_failures tests of $_test_num."); |
767 | 780 | } |
768 | 781 | } |
782 | ||
769 | 783 | ?> |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
144 | 144 | close $fh or die "close $t: $!"; |
145 | 145 | } |
146 | 146 | |
147 | # propogate trace overrides to the server | |
148 | sub configure_trace { | |
147 | # propogate PerlPassEnv settings to the server | |
148 | sub configure_env { | |
149 | 149 | 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 | ]); | |
152 | 154 | } |
153 | 155 | |
154 | 156 | sub startup_pl_code { |
155 | 157 | my $self = shift; |
156 | 158 | 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 | |
157 | 175 | |
158 | 176 | return <<"EOF"; |
159 | 177 | BEGIN { |
162 | 180 | eval { require "conf/\$file" } or |
163 | 181 | die if grep { -e "\$_/conf/\$file" } \@INC; |
164 | 182 | } |
183 | ||
184 | $cover | |
165 | 185 | } |
166 | 186 | |
167 | 187 | 1; |
536 | 556 | my @handler_cfg = ($handler => $module); |
537 | 557 | |
538 | 558 | 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); | |
540 | 561 | } else { |
541 | 562 | push @args, @handler_cfg; |
542 | 563 | } |
543 | 564 | } |
544 | 565 | |
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 | } | |
546 | 570 | } |
547 | 571 | |
548 | 572 | $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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
109 | 109 | sub prune { |
110 | 110 | my($self, @tests) = @_; |
111 | 111 | 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)) { | |
119 | 118 | $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; | |
122 | 122 | } |
123 | 123 | } |
124 | 124 | elsif (!$skip_dirs{$dir}) { |
125 | push @new_tests, $_; | |
125 | push @new_tests, $test; | |
126 | 126 | } |
127 | 127 | } |
128 | 128 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | ||
0 | 16 | package Apache::TestMB; |
1 | 17 | |
2 | 18 | use strict; |
3 | 19 | use vars qw(@ISA); |
4 | use Module::Build; | |
20 | use Module::Build 0.18; | |
5 | 21 | use Apache::Test (); |
6 | 22 | use Apache::TestConfig (); |
7 | 23 | @ISA = qw(Module::Build); |
64 | 80 | |
65 | 81 | unless ($self->find_module_by_name('Devel::Cover', \@INC)) { |
66 | 82 | 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"); | |
68 | 86 | return; |
69 | 87 | } |
70 | 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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
52 | 52 | sub test { |
53 | 53 | my $self = shift; |
54 | 54 | 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 | } | |
56 | 61 | |
57 | 62 | my $preamble = Apache::TestConfig::WIN32 ? "" : <<EOF; |
58 | 63 | PASSENV = $env |
63 | 68 | if (eval { require Devel::Cover }) { |
64 | 69 | my $atdir = File::Spec->catfile($ENV{HOME}, '.apache-test'); |
65 | 70 | |
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, ""; | |
74 | 79 | } |
75 | 80 | else { |
76 | 81 | |
78 | 83 | |
79 | 84 | testcover : |
80 | 85 | @echo "Cannot run testcover action unless Devel::Cover is installed" |
86 | @echo "Don't forget to rebuild your Makefile after installing Devel::Cover" | |
81 | 87 | EOF |
82 | 88 | } |
83 | 89 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
330 | 330 | $opts->{'run-tests'} = 1; |
331 | 331 | } |
332 | 332 | else { |
333 | #default is server-server run-tests stop-server | |
333 | #default is start-server run-tests stop-server | |
334 | 334 | $opts->{$_} = 1 for @std_run; |
335 | 335 | } |
336 | 336 | } |
534 | 534 | } |
535 | 535 | else { |
536 | 536 | 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}; | |
540 | 539 | unlink $pid_file if -e $pid_file; |
541 | 540 | } |
542 | 541 | 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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
72 | 72 | Apache::TestRun::exit_perl(0); |
73 | 73 | } |
74 | 74 | |
75 | $test_config->preamble_register(qw(configure_libmodperl)); | |
75 | $test_config->preamble_register(qw(configure_libmodperl | |
76 | configure_env)); | |
76 | 77 | |
77 | 78 | $test_config->postamble_register(qw(configure_inc |
78 | configure_trace | |
79 | 79 | configure_pm_tests_inc |
80 | 80 | configure_startup_pl |
81 | 81 | 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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
117 | 117 | |
118 | 118 | sub pid_file { |
119 | 119 | 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'; | |
121 | 124 | } |
122 | 125 | |
123 | 126 | sub dversion { |
265 | 268 | $command = qq{ddd --gdb --debugger "gdb -command $file" $httpd}; |
266 | 269 | } |
267 | 270 | 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"; | |
269 | 273 | } |
270 | 274 | |
271 | 275 | $self->note_debugging; |
296 | 300 | |
297 | 301 | $opts->{debugger} ||= $ENV{MP_DEBUGGER} || 'gdb'; |
298 | 302 | |
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) { | |
300 | 312 | error "$opts->{debugger} is not a supported debugger", |
301 | 313 | "These are the supported debuggers: ". |
302 | 314 | join ", ", sort keys %debuggers; |
303 | 315 | die("\n"); |
304 | 316 | } |
305 | 317 | |
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. | |
307 | 325 | $self->$method($opts); |
308 | 326 | } |
309 | 327 |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
25 | 25 | use File::Basename qw(dirname); |
26 | 26 | use File::Spec::Functions qw(catfile file_name_is_absolute); |
27 | 27 | use Symbol (); |
28 | use Fcntl qw(SEEK_END); | |
28 | 29 | |
29 | 30 | use Apache::Test (); |
30 | 31 | use Apache::TestConfig (); |
31 | 32 | |
32 | 33 | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %CLEAN); |
33 | 34 | |
34 | $VERSION = '0.01'; | |
35 | $VERSION = '0.02'; | |
35 | 36 | @ISA = qw(Exporter); |
36 | 37 | |
37 | 38 | @EXPORT = qw(t_cmp t_debug t_append_file t_write_file t_open_file |
41 | 42 | ); |
42 | 43 | |
43 | 44 | @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); | |
45 | 47 | |
46 | 48 | %CLEAN = (); |
47 | 49 | |
50 | 52 | # 5.005's Data::Dumper has problems to dump certain datastructures |
51 | 53 | use constant HAS_DUMPER => eval { $] >= 5.6 && require Data::Dumper; }; |
52 | 54 | 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 | } | |
53 | 76 | |
54 | 77 | # because of the prototype and recursive call to itself a forward |
55 | 78 | # declaration is needed |
772 | 795 | which uses a Unix-style specification with forward slashes for |
773 | 796 | directory separators. The function is not exported by default. |
774 | 797 | |
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 | ||
775 | 810 | =back |
776 | 811 | |
777 | 812 | =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 | |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | # |
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 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; |
35 | 35 | AllowOverride None |
36 | 36 | Options +ExecCGI |
37 | 37 | </Directory> |
38 | ||
39 | # t/next_available_port.t | |
40 | <IfModule mod_env.c> | |
41 | SetEnv NextAvailablePort @NextAvailablePort@ | |
42 | </IfModule> | |
43 | ||
38 | 44 | </IfModule> |
39 | 45 |
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"; |
8 | 8 | Also refer to the Apache::Test changes log file, at Apache-Test/Changes |
9 | 9 | |
10 | 10 | =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>] | |
11 | 108 | |
12 | 109 | =item 2.0.2 - October 20, 2005 |
13 | 110 |
41 | 41 | Apache-Test/lib/Apache/TestUtil.pm |
42 | 42 | Apache-Test/lib/Bundle/ApacheTest.pm |
43 | 43 | 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 | |
44 | 48 | Apache-Test/t/bad_coding.t |
45 | 49 | Apache-Test/t/cgi-bin/cookies.pl.PL |
50 | Apache-Test/t/cgi-bin/next_available_port.pl.PL | |
46 | 51 | Apache-Test/t/conf/extra.conf.in |
47 | 52 | Apache-Test/t/conf/modperl_extra.pl.in |
48 | 53 | Apache-Test/t/cookies.t |
51 | 56 | Apache-Test/t/more/03testpm.t |
52 | 57 | Apache-Test/t/more/04testmore.t |
53 | 58 | Apache-Test/t/more/all.t |
59 | Apache-Test/t/next_available_port.t | |
54 | 60 | Apache-Test/t/ping.t |
55 | 61 | Apache-Test/t/redirect.t |
56 | 62 | Apache-Test/t/request.t |
119 | 125 | ModPerl-Registry/t/conf/extra.conf.in |
120 | 126 | ModPerl-Registry/t/conf/modperl_extra_startup.pl |
121 | 127 | ModPerl-Registry/t/dirindex.t |
128 | ModPerl-Registry/t/fatalstobrowser.t | |
122 | 129 | ModPerl-Registry/t/flush.t |
123 | 130 | ModPerl-Registry/t/ithreads.t |
124 | 131 | ModPerl-Registry/t/nph.t |
168 | 175 | docs/api/Apache2/CmdParms.pod |
169 | 176 | docs/api/Apache2/Command.pod |
170 | 177 | docs/api/Apache2/Connection.pod |
178 | docs/api/Apache2/ConnectionUtil.pod | |
171 | 179 | docs/api/Apache2/Const.pod |
172 | 180 | docs/api/Apache2/Directive.pod |
173 | 181 | docs/api/Apache2/Filter.pod |
219 | 227 | docs/devel/core/mod_perl_specific.pod |
220 | 228 | docs/devel/core/mpms.pod |
221 | 229 | 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 | |
222 | 234 | docs/devel/debug/perl.pod |
223 | 235 | docs/devel/help/help.pod |
224 | 236 | docs/devel/performance/size_matters.pod |
466 | 478 | t/apache/scanhdrs2.t |
467 | 479 | t/apache/send_cgi_header.t |
468 | 480 | t/api/access2.t |
481 | t/api/add_config.t | |
469 | 482 | t/api/content_encoding.t |
470 | 483 | t/api/custom_response.t |
471 | 484 | t/api/err_headers_out.t |
590 | 603 | t/hooks/TestHooks/authz.pm |
591 | 604 | t/hooks/TestHooks/cleanup.pm |
592 | 605 | t/hooks/TestHooks/cleanup2.pm |
606 | t/hooks/TestHooks/error.pm | |
593 | 607 | t/hooks/TestHooks/fixup.pm |
594 | 608 | t/hooks/TestHooks/headerparser.pm |
595 | 609 | t/hooks/TestHooks/hookrun.pm |
610 | 624 | t/hooks/authz.t |
611 | 625 | t/hooks/cleanup.t |
612 | 626 | t/hooks/cleanup2.t |
627 | t/hooks/error.t | |
613 | 628 | t/hooks/hookrun.t |
614 | 629 | t/hooks/init.t |
615 | 630 | t/hooks/inlined_handlers.t |
619 | 634 | t/hooks/stacked_handlers2.t |
620 | 635 | t/hooks/startup.t |
621 | 636 | t/hooks/trans.t |
637 | t/htdocs/TestAPI__add_config/htaccess | |
622 | 638 | t/htdocs/api/auth-groups |
623 | 639 | t/htdocs/api/auth-users |
624 | 640 | t/htdocs/api/custom_response.txt |
669 | 685 | t/modperl/cookie2.t |
670 | 686 | t/modperl/exit.t |
671 | 687 | t/modperl/getc.t |
688 | t/modperl/local_env.t | |
672 | 689 | t/modperl/merge.t |
673 | 690 | t/modperl/merge2.t |
674 | 691 | t/modperl/merge3.t |
675 | 692 | t/modperl/perl_options.t |
693 | t/modperl/perl_options2.t | |
694 | t/modperl/pnotes.t | |
676 | 695 | t/modperl/post_utf8.t |
677 | 696 | t/modperl/print_utf8.t |
678 | 697 | t/modperl/print_utf8_2.t |
714 | 733 | t/protocol/pseudo_http.t |
715 | 734 | t/response/TestAPI/access.pm |
716 | 735 | t/response/TestAPI/access2.pm |
736 | t/response/TestAPI/add_config.pm | |
717 | 737 | t/response/TestAPI/aplog.pm |
718 | 738 | t/response/TestAPI/command.pm |
719 | 739 | t/response/TestAPI/conn_rec.pm |
767 | 787 | t/response/TestApache/cgihandler.pm |
768 | 788 | t/response/TestApache/conftree.pm |
769 | 789 | t/response/TestApache/content_length_header.pm |
790 | t/response/TestApache/daemon.pm | |
770 | 791 | t/response/TestApache/discard_rbody.pm |
771 | 792 | t/response/TestApache/post.pm |
772 | 793 | t/response/TestApache/read.pm |
815 | 836 | t/response/TestModperl/getc.pm |
816 | 837 | t/response/TestModperl/io_nested_with_closed_stds.pm |
817 | 838 | t/response/TestModperl/io_with_closed_stds.pm |
839 | t/response/TestModperl/local_env.pm | |
818 | 840 | t/response/TestModperl/merge.pm |
819 | 841 | t/response/TestModperl/method.pm |
820 | 842 | t/response/TestModperl/methodname.pm |
821 | 843 | t/response/TestModperl/methodobj.pm |
822 | 844 | t/response/TestModperl/perl.pm |
823 | 845 | t/response/TestModperl/perl_options.pm |
846 | t/response/TestModperl/perl_options2.pm | |
824 | 847 | t/response/TestModperl/pnotes.pm |
825 | 848 | t/response/TestModperl/post_utf8.pm |
826 | 849 | t/response/TestModperl/print.pm |
922 | 945 | xs/Apache2/CmdParms/Apache2__CmdParms.h |
923 | 946 | xs/Apache2/Command/Apache2__Command.h |
924 | 947 | xs/Apache2/Connection/Apache2__Connection.h |
948 | xs/Apache2/ConnectionUtil/Apache2__ConnectionUtil.h | |
925 | 949 | xs/Apache2/Const/Const.pm |
926 | 950 | xs/Apache2/Const/Const.xs |
927 | 951 | xs/Apache2/Const/Makefile.PL |
289 | 289 | exit(1); |
290 | 290 | } |
291 | 291 | |
292 | printf "Configuring Apache/%s mod_perl2/%s Perl/v%vd\n", | |
292 | printf "Configuring Apache/%s mod_perl/%s Perl/v%vd\n", | |
293 | 293 | $httpd_version, $VERSION, $^V; |
294 | 294 | |
295 | 295 | my $apr_config = $build->get_apr_config; #cache it |
479 | 479 | |
480 | 480 | open my $fh, 'Changes'; |
481 | 481 | while (<$fh>) { |
482 | if (/^=item.*-dev/) { | |
483 | $VERSION .= '-dev'; | |
482 | if (/^=item.*-(dev|rc\d+)/) { | |
483 | $VERSION .= "-$1"; | |
484 | 484 | last; |
485 | 485 | } |
486 | 486 | last if /^=item/; |
815 | 815 | |
816 | 816 | tag : |
817 | 817 | 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) | |
818 | 819 | @$(ECHO) update mod_perl2.pm VERSION now |
819 | 820 | EOF |
820 | 821 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
1 | 1 | |
2 | 2 | *** Prerequisites *** |
3 | 3 | |
4 | 4 | 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. | |
7 | 7 | |
8 | 8 | Newer Apache versions may work with this version of mod_perl. If |
9 | 9 | not, the svn version likely will, which can be obtained from: |
41 | 41 | |
42 | 42 | *** Todo *** |
43 | 43 | |
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. | |
45 | 45 | See the files in the todo/ directory for what remains to be done. Some |
46 | 46 | of those features will be implemented after 2.0 is released. The goal |
47 | 47 | is to empty the file todo/release and document/test/verify the API |
66 | 66 | *** Authors *** |
67 | 67 | |
68 | 68 | 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). |
30 | 30 | assuming you have already been granted commit access to the repository, |
31 | 31 | you should follow the following steps to checkout mod_perl |
32 | 32 | |
33 | $ ssh svn.apache.org svnpasswd | |
33 | Change your password via: | |
34 | https://svn.apache.org/change-password | |
35 | ||
34 | 36 | $ svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0 |
35 | 37 | |
36 | 38 | if you want to test that your commit access is working, this file is |
12 | 12 | |
13 | 13 | http://people.apache.org/~geoff/gpghowto.html |
14 | 14 | |
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 | ||
15 | 31 | 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 | |
17 | 33 | the current build) with as many |
18 | 34 | configurations as possible on as many platforms as possible, |
19 | 35 | 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: | |
28 | 45 | |
29 | 46 | % APACHE_TEST_PRETEND_NO_LWP=1 make test |
30 | 47 | |
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 | |
32 | 49 | fresh source, without having any stale dirs from the previous |
33 | 50 | build laying around. |
34 | 51 | |
37 | 54 | to the modperl/dev list (may be longer to give most people a chance |
38 | 55 | to catch up). no need to tag this package |
39 | 56 | |
57 | Subject: [RELEASE CANDIDATE]: mod_perl-2.0.3 RC\d+ | |
58 | ||
40 | 59 | 2a. if problems are detected during stage 2, repeat stages 1 and 2. |
41 | 60 | |
42 | 61 | 3. when the package has been reported to be good, prepare a new |
43 | 62 | package to be released |
44 | 63 | |
45 | 64 | a. edit ./Changes: |
46 | - remove '-dev' | |
65 | - remove -rc\d+ | |
47 | 66 | - add release date |
48 | 67 | |
49 | 68 | b. check ./README and ./Makefile.PL |
60 | 79 | e. tag |
61 | 80 | % make tag |
62 | 81 | |
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 | |
64 | 91 | % make dist |
65 | 92 | |
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) | |
69 | 96 | |
70 | 97 | a. upload to www.apache.org:/www/perl.apache.org/dist/ |
71 | 98 | |
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/ | |
73 | 100 | |
74 | 101 | b. ssh to perl.apache.org, unpack the package, update symlinks to the |
75 | 102 | tar ball and unpacked distro: |
76 | 103 | |
77 | 104 | % ssh perl.apache.org |
78 | 105 | % 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 | |
81 | 108 | % 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 | |
83 | 110 | |
84 | 111 | c. archive older releases (keep current + one prior release) |
85 | 112 | |
96 | 123 | |
97 | 124 | % /home/perlwww/apache.org/modperl-docs/bin/site_build |
98 | 125 | |
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 | ||
99 | 131 | 5. Upload the package to CPAN |
100 | 132 | |
101 | 133 | 6. Tarball signing |
105 | 137 | |
106 | 138 | a. sign your local copy of the tarball: |
107 | 139 | |
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 | |
111 | 143 | |
112 | 144 | b. upload the generated sig file to www.apache.org: |
113 | 145 | |
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/ | |
115 | 147 | % ssh www.apache.org |
116 | 148 | % 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 | |
119 | 151 | |
120 | 152 | c. ask one of the other developers to double check the signature file |
121 | 153 | and tarball: download both files and verify the signature: |
122 | 154 | |
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 | |
129 | 161 | |
130 | 162 | d. make sure that the files you just created are group rw so |
131 | 163 | all the dist admins can make changes: |
139 | 171 | a. unpack the package, update symlinks to the tarball and unpacked distro: |
140 | 172 | |
141 | 173 | % 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 | |
144 | 176 | % mv mod_perl-2.0.0.tar.gz* /www/archive.apache.org/dist/perl/ |
145 | 177 | % rm -rf mod_perl-2.0.0 |
146 | 178 | |
154 | 186 | 8. Announce the package |
155 | 187 | |
156 | 188 | 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 | |
158 | 191 | include |
159 | 192 | - 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) | |
162 | 195 | - MD5 sig (as it comes from CPAN upload announce). |
163 | 196 | - the latest Changes |
164 | 197 | |
176 | 209 | d. update this file versions to make it easy to copy-n-paste things |
177 | 210 | on the next release: |
178 | 211 | |
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 | |
188 | 213 | |
189 | 214 | e. commit the changed files |
190 | 215 |
0 | 0 | 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) $] | |
2 | 2 | |
3 | 3 | Release: |
4 | 4 | -------- |
5 | 2.000.02 : Released Oct 20, 2005 | |
5 | 6 | 2.000.01 : Released Jun 17, 2005 |
6 | 7 | 2.000.00 : Released May 20, 2005 |
7 | 8 | 1.999.23 : Released May 03, 2005 |
0 | 0 | #!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 | |
6 | 7 | # |
7 | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
8 | 9 | # |
5 | 5 | my $dev_build = is_dev_build(); |
6 | 6 | my $release = $dev_build ? svn_release() : 1; |
7 | 7 | 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"; | |
9 | 9 | my $tarname = "$path.tar.gz"; |
10 | 10 | |
11 | 11 | my $httpd_ver = min_httpd_ver(); |
134 | 134 | my $dev; |
135 | 135 | open my $fh, 'Changes'; |
136 | 136 | while (<$fh>) { |
137 | if (/^=item.*-dev/) { | |
138 | $dev = 1; | |
137 | if (/^=item.*-(dev|rc\d+)/) { | |
138 | $dev = $1; | |
139 | 139 | last; |
140 | 140 | } |
141 | 141 | last if /^=item/; |
0 | 0 | #!/bin/bash |
1 | 1 | # 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 | |
2 | 6 | |
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'` | |
4 | 8 | trunk=${root}/trunk |
5 | 9 | |
6 | 10 | # svn 1.2.x supports "svn info URL". Without that, a stupid |
7 | 11 | # ls command is needed to find the current revision of the trunk |
8 | 12 | #next=`svn info $trunk | sed -n '/^Revision: /{s/.*: //g;p}'` |
9 | 13 | |
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'` | |
11 | 15 | last=`svn propget merge-point .` |
12 | 16 | |
13 | 17 | echo "$0: merging from trunk from r$last to r$next" |
58 | 58 | my $ans = prompt('Install apxs now?', 'yes'); |
59 | 59 | exit 0 unless $ans =~ /^y/i; |
60 | 60 | |
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 | ||
61 | 69 | require LWP::Simple; |
62 | 70 | LWP::Simple->import(qw(is_success getstore)); |
63 | 71 | |
80 | 88 | print "chdir $dir\n"; |
81 | 89 | chdir $dir or die "chdir to $dir failed: $!"; |
82 | 90 | |
83 | my @args = ($^X, 'Configure.pl', "--with-apache2=$prefix"); | |
91 | my @args = ($^X, 'Configure.pl', | |
92 | "--with-apache2=$prefix", | |
93 | "--with-apache-prog=$prog"); | |
84 | 94 | print "@args\n"; |
85 | 95 | system(@args) == 0 or die "system @args failed: $?"; |
86 | 96 |
3 | 3 | mp2 Utilities need to be documented (a separate document?): |
4 | 4 | |
5 | 5 | mp2bug - (should also be mentioned in user/help/help.pod) |
6 | ||
7 | mp2doc - replacement for perldoc for modules that get installed into Apache2/ | |
8 | 6 | |
9 | 7 | *** General items *** |
10 | 8 |
34 | 34 | use it with mod_perl 2.0. For example to get a random unique string |
35 | 35 | you could call: |
36 | 36 | |
37 | % perl -MApache2 -MAPR::UUID -le 'print APR::UUID->new->format' | |
37 | % perl -MAPR::UUID -le 'print APR::UUID->new->format' | |
38 | 38 | |
39 | 39 | |
40 | 40 |
18 | 18 | |
19 | 19 | # Apache AllowOverride value |
20 | 20 | $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(); | |
21 | 24 | |
22 | 25 | # auth name ("foo bar") |
23 | 26 | $auth_name = $r->auth_name(); |
192 | 195 | use Apache2::Const -compile => qw(:override); |
193 | 196 | $r->allow_overrides & Apache2::Const::OR_AUTHCFG; # TRUE |
194 | 197 | $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 | |
195 | 246 | |
196 | 247 | |
197 | 248 |
46 | 46 | |
47 | 47 | # which allow-override bits are set |
48 | 48 | $override = $parms->override; |
49 | ||
50 | # which Options are allowed by AllowOverride (since Apache 2.2) | |
51 | $override = $parms->override_opts; | |
49 | 52 | |
50 | 53 | # the path this command is being invoked in |
51 | 54 | $path = $parms->path; |
312 | 315 | |
313 | 316 | |
314 | 317 | |
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 | ||
315 | 349 | =head2 C<path> |
316 | 350 | |
317 | 351 | The current pathname/location/match of the block this command is in |
7 | 7 | =head1 Synopsis |
8 | 8 | |
9 | 9 | use Apache2::Connection (); |
10 | ||
10 | use Apache2::RequestRec (); | |
11 | ||
12 | my $c = $r->connection; | |
13 | ||
14 | my $c = $r->connection; | |
11 | 15 | # is connection still open? |
12 | 16 | $status = $c->aborted; |
13 | 17 |
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 |
2582 | 2582 | |
2583 | 2583 | L<mod_perl 2.0 documentation|docs::2.0::index>. |
2584 | 2584 | |
2585 | ||
2585 | L<HTTP Status Codes|docs::2.0::user::handlers::http/HTTP_Status_Codes>. | |
2586 | 2586 | |
2587 | 2587 | |
2588 | 2588 | =head1 Copyright |
356 | 356 | |
357 | 357 | is the same as: |
358 | 358 | |
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) | |
361 | 361 | |
362 | 362 | =over 4 |
363 | 363 | |
526 | 526 | |
527 | 527 | is the same as: |
528 | 528 | |
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) | |
531 | 531 | |
532 | 532 | =over 4 |
533 | 533 | |
745 | 745 | object. |
746 | 746 | |
747 | 747 | 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 | |
750 | 750 | +GlobalRequest|docs::2.0::user::config::config/C_GlobalRequest_>> |
751 | 751 | setting or can be also done at runtime if C<$r> is available: |
752 | 752 |
107 | 107 | } |
108 | 108 | </Perl> |
109 | 109 | |
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 | |
110 | 137 | |
111 | 138 | |
112 | 139 |
162 | 162 | |
163 | 163 | =head1 Performance Issues |
164 | 164 | |
165 | This modules is perfectly suited for a development environment. Though | |
165 | This module is perfectly suited for a development environment. Though | |
166 | 166 | it's possible that you would like to use it in a production |
167 | 167 | environment, since with C<Apache2::Reload> you don't have to restart |
168 | 168 | the server in order to reload changed modules during software |
107 | 107 | |
108 | 108 | $r->add_config($lines); |
109 | 109 | $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. | |
110 | 115 | |
111 | 116 | =over 4 |
112 | 117 | |
118 | 123 | An ARRAY reference containing configuration lines per element, without |
119 | 124 | the new line terminators. |
120 | 125 | |
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>> ) | |
123 | 128 | |
124 | 129 | Which allow-override bits are set |
125 | 130 | |
126 | 131 | Default value is: |
127 | 132 | C<L<Apache2::Const::OR_AUTHCFG|docs::2.0::api::Apache2::Const/C_Apache2__Const__OR_AUTHCFG_>> |
128 | 133 | |
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 | ||
129 | 190 | =item ret: no return value |
130 | 191 | |
131 | =item since: 2.0.00 | |
192 | =item since: 2.0.00, C<$path> and C<$override_opts> since 2.0.3 | |
132 | 193 | |
133 | 194 | =back |
134 | 195 | |
137 | 198 | |
138 | 199 | For example: |
139 | 200 | |
140 | use Apache2::ServerUtil (); | |
201 | use Apache2::RequestUtil (); | |
202 | use Apache2::Access (); | |
203 | ||
141 | 204 | $r->add_config(['require valid-user']); |
142 | 205 | |
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); | |
144 | 211 | |
145 | 212 | |
146 | 213 | |
580 | 647 | |
581 | 648 | =head2 C<location_merge> |
582 | 649 | |
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 | |
584 | 651 | object: |
585 | 652 | |
586 | 653 | $ret = $r->location_merge($location); |
592 | 659 | |
593 | 660 | =item arg1: C<$location> ( string ) |
594 | 661 | |
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 | |
596 | 663 | a container: |
597 | 664 | |
598 | 665 | <Location /foo> |
712 | 779 | $old_val = $r->pnotes($key => $val); |
713 | 780 | $val = $r->pnotes($key); |
714 | 781 | $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. | |
715 | 795 | |
716 | 796 | =over 4 |
717 | 797 |
51 | 51 | # do something only when the server restarts |
52 | 52 | my $cnt = Apache2::ServerUtil::restart_count(); |
53 | 53 | 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; | |
57 | 58 | |
58 | 59 | |
59 | 60 | =head1 Description |
186 | 187 | |
187 | 188 | |
188 | 189 | |
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 | ||
227 | 190 | |
228 | 191 | =head2 C<dir_config> |
229 | 192 | |
411 | 374 | =item since: 2.0.00 |
412 | 375 | |
413 | 376 | =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 | ||
414 | 408 | |
415 | 409 | |
416 | 410 | |
647 | 641 | |
648 | 642 | =over 4 |
649 | 643 | |
650 | =item obj: C<Apache2> (class name) | |
644 | =item obj: C<Apache2::ServerUtil> (class name) | |
651 | 645 | |
652 | 646 | =item ret: C<$main_s> |
653 | 647 | ( C<L<Apache2::ServerRec object|docs::2.0::api::Apache2::ServerRec>> ) |
770 | 764 | |
771 | 765 | |
772 | 766 | |
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 | ||
773 | 803 | |
774 | 804 | =head2 C<set_handlers> |
775 | 805 | |
833 | 863 | or |
834 | 864 | |
835 | 865 | $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 | ||
836 | 893 | |
837 | 894 | |
838 | 895 |
20 | 20 | Apache2/CmdParms.pod |
21 | 21 | Apache2/Command.pod |
22 | 22 | Apache2/Connection.pod |
23 | Apache2/ConnectionUtil.pod | |
23 | 24 | Apache2/Const.pod |
24 | 25 | Apache2/Directive.pod |
25 | 26 | Apache2/Filter.pod |
4 | 4 | <body bgcolor="white"> |
5 | 5 | <p>See |
6 | 6 | <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 | |
8 | 8 | documentation of the 3rd party <code>Apache::</code> modules.</p> |
9 | 9 | </body> |
10 | 10 | </html> |
116 | 116 | project build process, since the source scanning is not stable yet, |
117 | 117 | therefore everytime the map files change, C<make source_scan> should |
118 | 118 | 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 | |
120 | 120 | repository. |
121 | 121 | |
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> | |
125 | 124 | |
126 | 125 | There are three different types of map files in the I<xs/maps/> |
127 | 126 | directory: |
13 | 13 | Make sure to read also: L<Debugging mod_perl C |
14 | 14 | Internals|docs::2.0::devel::debug::c>. |
15 | 15 | |
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 | |
17 | 17 | be updated once the innovation dust settles down. |
18 | 18 | |
19 | 19 | =head1 Perl Interpreters |
5 | 5 | |
6 | 6 | Discover what are the available MPMs and how they work with mod_perl. |
7 | 7 | |
8 | META: This doc is under construction. Owners are wanted. | |
8 | META: This doc is under construction. Owners are wanted. -- pgollucci volunteering | |
9 | 9 | |
10 | 10 | =head1 MPMs Overview |
11 | 11 | |
38 | 38 | |
39 | 39 | META: incomplete |
40 | 40 | |
41 | =head1 The Event MPM | |
42 | ||
41 | 43 | =head1 Maintainers |
42 | 44 | |
43 | 45 | Maintainer is the person(s) you should contact with updates, |
47 | 49 | |
48 | 50 | =item * |
49 | 51 | |
50 | Stas Bekman E<lt>stas (at) stason.orgE<gt> | |
52 | Philip M. Gollucci E<lt>pgollucci (at) p6m7g8.comE<gt> | |
51 | 53 | |
52 | 54 | =back |
53 | 55 | |
59 | 61 | =item * |
60 | 62 | |
61 | 63 | Stas Bekman E<lt>stas (at) stason.orgE<gt> |
64 | Philip M. Gollucci E<lt>pgollucci (at) p6m7g8.comE<gt> | |
62 | 65 | |
63 | 66 | =back |
64 | 67 |
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 |
4 | 4 | =head1 Description |
5 | 5 | |
6 | 6 | 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 | ||
7 | 43 | |
8 | 44 | =head1 Maintainers |
9 | 45 |
63 | 63 | backtrace|user::help::help/Resolving_Segmentation_Faults> to the |
64 | 64 | modperl developers list. |
65 | 65 | |
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 | |
69 | 69 | place to be if you want to see mod_perl 2.0 evolve before your eyes. |
70 | 70 | |
71 | 71 | =over |
84 | 84 | |
85 | 85 | The C<Apache-Test> project, originally developed as a part of mod_perl |
86 | 86 | 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 | |
88 | 88 | repository. |
89 | 89 | |
90 | 90 | To retrieve the whole httpd-test project, run: |
91 | 91 | |
92 | cvs co httpd-test | |
92 | svn co http://svn.pache.org/repos/asf/httpd/httpd-test | |
93 | 93 | |
94 | 94 | =over |
95 | 95 | |
99 | 99 | |
100 | 100 | archive: META: ??? |
101 | 101 | |
102 | =item cvs commits | |
102 | =item svn commits | |
103 | 103 | |
104 | 104 | mailing list subscription: mailto:test-cvs-subscribe@httpd.apache.org |
105 | 105 | |
120 | 120 | |
121 | 121 | archive: http://marc.theaimsgroup.com/?l=apache-new-httpd&r=1&w= |
122 | 122 | |
123 | =item cvs commits | |
123 | =item svn commits | |
124 | 124 | |
125 | 125 | mailing list subscription: mailto:httpd-2.0-cvs-subscribe@perl.apache.org |
126 | 126 | |
160 | 160 | |
161 | 161 | archive: http://marc.theaimsgroup.com/?l=apr-dev&r=1&w=2 |
162 | 162 | |
163 | =item cvs commits | |
163 | =item svn commits | |
164 | 164 | |
165 | 165 | mailing list subscription: mailto:apr-cvs-subscribe@perl.apache.org |
166 | 166 |
13 | 13 | request at a time. This effectively prevents concurrent processing, |
14 | 14 | which can have serious implications for busy sites. This problem is |
15 | 15 | 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 | |
17 | 17 | enabled. |
18 | 18 | |
19 | 19 | There are some threading issues in perl-5.6 |
21 | 21 | problems with mod_perl 2.0 on Win32. Consequently, the minimum |
22 | 22 | required perl version is 5.8 (upon which ActivePerl builds 8xx are based) |
23 | 23 | 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>. | |
27 | 24 | |
28 | 25 | =head1 Installing |
29 | 26 | |
108 | 105 | your F</Path/to/Apache2/modules/> directory. |
109 | 106 | |
110 | 107 | 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 | |
112 | 109 | discussion on the L<2.0 Development Source |
113 | 110 | Distribution|download::source/Development_mod_perl_2_0_Source_Distribution> |
114 | 111 | 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, | |
116 | 113 | so at any given time there are no guarantees that these packages will |
117 | 114 | build and test successfully. |
118 | 115 | |
119 | 116 | =head2 PPM Packages |
120 | 117 | |
121 | 118 | 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 | |
123 | 120 | L<http://httpd.apache.org/>. In installing this, you might avoid |
124 | 121 | some future problems by choosing installation directories that do |
125 | 122 | not have spaces in their names (eg, F<C:/Apache2>). At this time |
126 | 123 | you must have version 2.0.47 or greater of Apache2 in order to |
127 | 124 | install the mod_perl 2 ppm package. |
128 | 125 | |
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 | |
130 | 127 | via the C<PPM> utility. ActiveState does not maintain mod_perl in |
131 | 128 | their ppm repository, so you must get it from a different location |
132 | 129 | other than ActiveState's site. A quick way to do this is to download |
142 | 139 | C:\> ppm install |
143 | 140 | http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd |
144 | 141 | |
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 | |
147 | 149 | within the C<ppm> shell utility to |
148 | 150 | |
149 | 151 | http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58 |
151 | 153 | using the C<repository add alias location> for I<ppm3> (the |
152 | 154 | default with ActivePerl 8xx), and using C<set repository alias location> |
153 | 155 | 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> | |
157 | 165 | subdirectory in your Perl tree, so as not to disturb a possible existing |
158 | 166 | F<Apache> directory from mod_perl 1.0. See the section below on |
159 | 167 | configuring mod_perl to add this directory to the C<@INC> path for |
169 | 177 | Note that, because of binary incompatibilities, one should |
170 | 178 | I<not> install packages for ActivePerl 8xx from a repository |
171 | 179 | 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. | |
173 | 184 | |
174 | 185 | The mod_perl package available from this site will always |
175 | 186 | use the latest mod_perl sources available from CPAN |
221 | 232 | |
222 | 233 | DeveloperSide.NET for Windows at |
223 | 234 | L<http://www.devside.net/web/server/free/software> |
235 | ||
236 | =item * | |
237 | ||
238 | zangweb from | |
239 | L<http://www.arbingersys.com/hostsites/zangweb/> | |
224 | 240 | |
225 | 241 | =back |
226 | 242 |
19 | 19 | die "This only works for Win32" unless $^O =~ /Win32/i; |
20 | 20 | die "No mod_perl ppm package available for this Perl" if ($] < 5.006001); |
21 | 21 | |
22 | my ($apache2, $apache); | |
22 | my ($apache2, $apache, $apache22); | |
23 | 23 | my @drives = drives(); |
24 | 24 | |
25 | 25 | # find a possible Apache2 directory |
71 | 71 | unless $vers =~ m!Apache/1.3!; |
72 | 72 | } |
73 | 73 | 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!; | |
77 | 85 | } |
78 | 86 | } |
79 | 87 | # prompt to get an Apache installation directory |
142 | 150 | if ($apache2) { |
143 | 151 | my $ans = prompt('Do you want the latest mod_perl 2 development version?', 'no'); |
144 | 152 | 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 | } | |
149 | 164 | else { |
150 | 165 | $ppdfile = 'mod_perl-dev.ppd'; |
151 | 166 | $tgzfile = 'mod_perl-dev.tar.gz'; |
152 | $so_fake = 'mod_perl-dev.so'; | |
167 | $so_fake = 'mod_perl-dev.so'; | |
153 | 168 | } |
154 | 169 | $ppd = $ppms . $ppdfile; |
155 | 170 | $tgz = $ppmsx86 . $tgzfile; |
201 | 216 | unless (verifyMD5($cksum, $tgzfile)); |
202 | 217 | die qq{CHECKSUM check for "$so_fake" failed.\n} |
203 | 218 | 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 | } | |
205 | 222 | |
206 | 223 | # edit the ppd file to reflect a local installation |
207 | 224 | my $old = $ppdfile . '.old'; |
274 | 291 | LoadModule perl_module modules/$so |
275 | 292 | |
276 | 293 | 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} | |
280 | 295 | to your PATH environment variable. |
281 | 296 | |
282 | 297 | For more information, visit http://perl.apache.org/. |
9 | 9 | The most recent changes are listed first. |
10 | 10 | |
11 | 11 | =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>. | |
12 | 16 | |
13 | 17 | A new troubleshooting section on how to resolve can't locate file foo, |
14 | 18 | when there is a system limit on the maximum open files. By Ken Simpson |
22 | 22 | =head1 Techniques |
23 | 23 | |
24 | 24 | |
25 | ||
26 | 25 | =head2 Method Handlers |
27 | 26 | |
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); | |
33 | 39 | |
34 | 40 | sub handler : method { |
35 | my ($class, $r) = @_; | |
41 | my ($class_or_object, $r) = @_; | |
36 | 42 | ...; |
37 | 43 | } |
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 | ||
49 | 77 | |
50 | 78 | |
51 | 79 | =head2 Cleaning up |
130 | 158 | C<$ENV{MOD_PERL}> - is set to the mod_perl version the server is |
131 | 159 | running under. e.g.: |
132 | 160 | |
133 | mod_perl/1.99_03-dev | |
161 | mod_perl/2.000002 | |
134 | 162 | |
135 | 163 | If C<$ENV{MOD_PERL}> doesn't exist, most likely you are not running |
136 | 164 | under mod_perl. |
141 | 169 | following technique: |
142 | 170 | |
143 | 171 | 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 | ||
145 | 175 | # die "I want mod_perl 2.0!" unless MP2; |
146 | 176 | |
147 | 177 | =back |
374 | 404 | If you use C<$r> to set headers as explained at the beginning of this |
375 | 405 | section, you won't encounter any of these problems. |
376 | 406 | |
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 | |
378 | 408 | to send your own set of headers (non-parsed headers handlers) use the |
379 | 409 | C<L<$r-E<gt>assbackwards|docs::2.0::api::Apache2::RequestRec/C_assbackwards_>> |
380 | 410 | method. Notice that registry handlers will do that for you if the |
814 | 844 | this problem. |
815 | 845 | |
816 | 846 | 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. | |
818 | 848 | |
819 | 849 | |
820 | 850 |
125 | 125 | |
126 | 126 | =head2 C<PerlAddVar> |
127 | 127 | |
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 | ); | |
130 | 159 | |
131 | 160 | See also: L<this directive argument types and allowed |
132 | 161 | location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>. |
171 | 200 | C<L<PerlModule|/C_PerlModule_>>, in a sense that it loads a |
172 | 201 | module. The difference is that it's used to triggers L<an early Perl |
173 | 202 | 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 | |
175 | 204 | for modules that implement L<new Apache |
176 | 205 | directives|docs::2.0::user::config::custom>, which are needed during |
177 | 206 | the configuration phase. |
260 | 289 | host to have its own pool, that host will continue to reuse the Perl |
261 | 290 | allocations in their specific modules. |
262 | 291 | |
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: | |
265 | 299 | |
266 | 300 | <VirtualHost ...> |
301 | PerlOptions +Clone +InheritSwitches | |
267 | 302 | ... |
268 | PerlSwitches +inherit | |
269 | 303 | </VirtualHost> |
270 | ||
271 | 304 | |
272 | 305 | =head3 C<Parent> |
273 | 306 | |
366 | 399 | PerlModule Apache::Magick |
367 | 400 | |
368 | 401 | 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 | ||
369 | 410 | |
370 | 411 | =head3 C<GlobalRequest> |
371 | 412 | |
555 | 596 | |
556 | 597 | =head2 C<PerlPassEnv> |
557 | 598 | |
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'}; | |
559 | 614 | |
560 | 615 | See also: L<this directive argument types and allowed |
561 | 616 | location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>. |
638 | 693 | |
639 | 694 | =head2 C<PerlSetEnv> |
640 | 695 | |
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 | ||
642 | 706 | |
643 | 707 | See also: L<this directive argument types and allowed |
644 | 708 | location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>. |
651 | 715 | |
652 | 716 | =head2 C<PerlSetVar> |
653 | 717 | |
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> | |
655 | 732 | |
656 | 733 | See also: L<this directive argument types and allowed |
657 | 734 | location|/mod_perl_Directives_Argument_Types_and_Allowed_Location>. |
724 | 801 | |
725 | 802 | =item * |
726 | 803 | |
727 | C<MOD_PERL> (always) | |
804 | C<MOD_PERL> and C<MOD_PERL_API_VERSION> (always) | |
728 | 805 | |
729 | 806 | =item * |
730 | 807 | |
1403 | 1480 | |
1404 | 1481 | If you need to access any of the startup defines in the Perl code you |
1405 | 1482 | 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 | |
1407 | 1484 | example in a startup file you can say: |
1408 | 1485 | |
1409 | 1486 | use Apache2::ServerUtil (); |
821 | 821 | use Apache2::Module (); |
822 | 822 | use Apache2::CmdParms (); |
823 | 823 | my @directives = (...); |
824 | Apache2::Module::add(__PACKLAGE__, \@directives); | |
824 | Apache2::Module::add(__PACKAGE__, \@directives); | |
825 | 825 | ... |
826 | 826 | sub SERVER_CREATE { |
827 | 827 | my ($class, $parms) = @_; |
1509 | 1509 | >>> connection output filter |
1510 | 1510 | o bucket 1: HEAP |
1511 | 1511 | [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 | |
1515 | 1515 | Connection: close |
1516 | 1516 | Transfer-Encoding: chunked |
1517 | 1517 | Content-Type: text/plain; charset=ISO-8859-1 |
12 | 12 | All HTTP Request handlers have the following structure: |
13 | 13 | |
14 | 14 | package MyApache2::MyHandlerName; |
15 | ||
15 | ||
16 | 16 | # load modules that are going to be used |
17 | 17 | use ...; |
18 | ||
18 | ||
19 | 19 | # compile (or import) constants |
20 | 20 | use Apache2::Const -compile => qw(OK); |
21 | ||
21 | ||
22 | 22 | sub handler { |
23 | 23 | my $r = shift; |
24 | 24 | |
184 | 184 | $r->content_type('text/plain'); |
185 | 185 | |
186 | 186 | my $conf_file = catfile Apache2::ServerUtil::server_root, |
187 | "conf", "httpd.conf"; | |
187 | "conf", "httpd.conf"; | |
188 | 188 | |
189 | 189 | printf "$conf_file is %0.2f minutes old\n", 60*24*(-M $conf_file); |
190 | 190 | |
505 | 505 | sub send_email_handler { |
506 | 506 | my $r = shift; |
507 | 507 | |
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); | |
510 | 512 | |
511 | 513 | my $status = send_email(\%headers, \$content); |
512 | 514 | |
542 | 544 | my $data = ''; |
543 | 545 | my $seen_eos = 0; |
544 | 546 | 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); | |
547 | 550 | |
548 | 551 | for (my $b = $bb->first; $b; $b = $bb->next($b)) { |
549 | 552 | if ($b->is_eos) { |
602 | 605 | response handler consists of three parts. Retrieve the email headers |
603 | 606 | C<To>, C<From> and C<Subject>, and the body of the message: |
604 | 607 | |
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); | |
606 | 610 | my $content = $r->content; |
607 | 611 | |
608 | 612 | Then send the email: |
737 | 741 | |
738 | 742 | The following example handler denies requests made from IPs on the |
739 | 743 | blacklist. |
744 | ||
740 | 745 | |
741 | 746 | #file:MyApache2/BlockByIP.pm |
742 | 747 | #-------------------------- |
1194 | 1199 | and the callback if needed: |
1195 | 1200 | |
1196 | 1201 | if (defined $exts{$ext}->[CALLBACK]) { |
1197 | $r->set_handlers(PerlResponseHandler => $exts{$ext}->[CALLBACK]); | |
1202 | $r->set_handlers( | |
1203 | PerlResponseHandler => $exts{$ext}->[CALLBACK]); | |
1198 | 1204 | } |
1199 | 1205 | |
1200 | 1206 | In this simple example the callback functions don't do much but |
1572 | 1578 | solution. Therefore we need to use a random string. We can either |
1573 | 1579 | either Perl's C<rand>, some CPAN module or the APR's C<APR::UUID>: |
1574 | 1580 | |
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 | } | |
1579 | 1585 | |
1580 | 1586 | Now the problem is how do we tell the cleanup handler what file should |
1581 | 1587 | be cleaned up? We could have stored it in the C<$r-E<gt>notes> table |
1587 | 1593 | better version of the response and cleanup handlers, that uses this |
1588 | 1594 | technique: |
1589 | 1595 | |
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; | |
1636 | 1642 | |
1637 | 1643 | Similarly to the first handler, we add the configuration: |
1638 | 1644 | |
1639 | <Location /cleanup2> | |
1640 | SetHandler modperl | |
1641 | PerlResponseHandler MyApache2::Cleanup2 | |
1642 | </Location> | |
1645 | <Location /cleanup2> | |
1646 | SetHandler modperl | |
1647 | PerlResponseHandler MyApache2::Cleanup2 | |
1648 | </Location> | |
1643 | 1649 | |
1644 | 1650 | And now when requesting I</cleanup2> we still get the same output -- |
1645 | 1651 | the listing of the current directory -- but this time this code will |
1672 | 1678 | early|docs::1.0::guide::porting/Generating_correct_HTTP_Headers> from |
1673 | 1679 | the handler: |
1674 | 1680 | |
1675 | return Apache2::Const::OK if $r->header_only; | |
1681 | return Apache2::Const::OK if $r->header_only; | |
1676 | 1682 | |
1677 | 1683 | This logic should not be used in mod_perl 2.0, because Apache 2.0 |
1678 | 1684 | automatically discards the response body for HEAD requests. It expects |
1710 | 1716 | For more discussion on why it is important to get HEAD requests right, |
1711 | 1717 | see these threads from the mod_perl list: |
1712 | 1718 | |
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 | |
1715 | 1721 | |
1716 | 1722 | as well as this bug report from mozilla, which shows how C<HEAD> |
1717 | 1723 | requests are used in the wild: |
1718 | 1724 | |
1719 | http://bugzilla.mozilla.org/show_bug.cgi?id=245447 | |
1725 | http://bugzilla.mozilla.org/show_bug.cgi?id=245447 | |
1720 | 1726 | |
1721 | 1727 | =item * Not getting C<Content-Length> header with C<HEAD> requests |
1722 | 1728 | |
1737 | 1743 | C<EOS> was sent (which happens when the response handler returns). The |
1738 | 1744 | simplest solution is to use rflush(): |
1739 | 1745 | |
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 | } | |
1748 | 1754 | |
1749 | 1755 | now if the handler sets the C-L header it'll be delivered to the |
1750 | 1756 | client unmodified. |
1776 | 1782 | backend: mod_rpaf: http://stderr.net/apache/rpaf/ |
1777 | 1783 | |
1778 | 1784 | =back |
1779 | ||
1780 | 1785 | |
1781 | 1786 | |
1782 | 1787 | |
1787 | 1792 | details. |
1788 | 1793 | |
1789 | 1794 | |
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> | |
1793 | 1960 | |
1794 | 1961 | =head1 Maintainers |
1795 | 1962 | |
1800 | 1967 | |
1801 | 1968 | =item * |
1802 | 1969 | |
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 | ||
1803 | 1983 | Stas Bekman E<lt>stas (at) stason.orgE<gt> |
1804 | ||
1805 | =back | |
1806 | ||
1807 | ||
1808 | =head1 Authors | |
1809 | ||
1810 | =over | |
1811 | ||
1812 | =item * | |
1813 | 1984 | |
1814 | 1985 | =back |
1815 | 1986 |
645 | 645 | use warnings FATAL => 'all'; |
646 | 646 | |
647 | 647 | use Apache2::Connection (); |
648 | use Apache2::RequestRec (); | |
648 | 649 | use Apache2::RequestUtil (); |
649 | 650 | use Apache2::HookRun (); |
650 | 651 | use Apache2::Access (); |
191 | 191 | |
192 | 192 | Do the following: |
193 | 193 | |
194 | % cd modperl-1.99_xx | |
194 | % cd modperl-2.0.xx | |
195 | 195 | % make test TEST_VERBOSE=1 \ |
196 | 196 | TEST_FILES="compat/apache_util.t modperl/pnotes.t" |
197 | 197 | |
198 | 198 | or use an alternative way: |
199 | 199 | |
200 | % cd modperl-1.99_xx | |
200 | % cd modperl-2.0.xx | |
201 | 201 | % t/TEST -clean |
202 | 202 | % t/TEST -verbose compat/apache_util.t modperl/pnotes.t |
203 | 203 | |
217 | 217 | I<t/logs/error_log> file and re-run tests in the verbose mode. For |
218 | 218 | example: |
219 | 219 | |
220 | % cd modperl-1.99_xx/ModPerl-Registry | |
220 | % cd modperl-2.0.xx/ModPerl-Registry | |
221 | 221 | % t/TEST -clean |
222 | 222 | % t/TEST -verbose closure.t |
223 | 223 |
158 | 158 | |
159 | 159 | # (--delete to ensure a clean state) |
160 | 160 | % rsync -acvz --delete --force \ |
161 | rsync://ftp.linux.activestate.com/perl-current/ perl-current | |
161 | rsync://public.activestate.com/perl-current/ perl-current | |
162 | 162 | |
163 | 163 | If you are re-building Perl after rsync-ing, make sure to cleanup first: |
164 | 164 | |
276 | 276 | I<http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz>. |
277 | 277 | |
278 | 278 | 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 | |
280 | 280 | the real version number. |
281 | 281 | |
282 | 282 | Open the package with: |
283 | 283 | |
284 | % tar -xvzf mod_perl-2.x.xx.tar.gz | |
284 | % tar -xvzf mod_perl-2.x.x.tar.gz | |
285 | 285 | |
286 | 286 | or an equivalent command. |
287 | 287 | |
303 | 303 | Like any other Perl module, mod_perl is configured via the |
304 | 304 | I<Makefile.PL> file, but requires one or more configuration options: |
305 | 305 | |
306 | % cd modperl-1.99_xx | |
306 | % cd modperl-2.x.x | |
307 | 307 | % perl Makefile.PL <options> |
308 | 308 | |
309 | 309 | where I<options> is an optional list of key/value pairs. These |
375 | 375 | This will configure Apache by passing C<L<MP_AP_CONFIGURE|/MP_AP_CONFIGURE>> |
376 | 376 | to Apache's F<./configure> script. |
377 | 377 | |
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 | ||
378 | 398 | =head2 mod_perl Build Options |
379 | 399 | |
380 | 400 | =head3 Boolean Build Options |
469 | 489 | |
470 | 490 | -DAP_DEBUG -Wall -Wmissing-prototypes -Wstrict-prototypes \ |
471 | 491 | -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 | |
475 | 495 | not already part of the C<gcc> flags add it. |
476 | 496 | |
477 | 497 | To use this mode Apache must be build with |
614 | 634 | same options. Simply C<chdir(1)> to the mod_perl source directory and |
615 | 635 | run: |
616 | 636 | |
617 | % cd modperl-2.x.xx | |
637 | % cd modperl-2.x. | |
618 | 638 | % perl -MApache2::Build -e rebuild |
619 | 639 | |
620 | 640 |
6 | 6 | This chapter should give you a general idea about what mod_perl 2.0 is |
7 | 7 | and how it differs from mod_perl 1.0. This chapter presents the new |
8 | 8 | 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. | |
10 | 10 | |
11 | 11 | |
12 | 12 | |
62 | 62 | stronger and faster implementation based on lessons learned over the |
63 | 63 | 4.5 years since mod_perl was introduced. |
64 | 64 | |
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 | |
66 | 66 | 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 | |
68 | 68 | period. Another important feature is the |
69 | 69 | C<L<Apache::Test|docs::general::testing::testing>> framework, which |
70 | 70 | was originally developed for mod_perl 2.0, but then was adopted by |
182 | 182 | L<threaded |
183 | 183 | environment|docs::2.0::user::coding::coding/Threads_Coding_Issues_Under_mod_perl>. |
184 | 184 | |
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 | ||
240 | 185 | =item * Protocol Modules |
241 | 186 | |
242 | 187 | Apache 1.3 is hardwired to speak only one protocol, HTTP. Apache 2.0 |
306 | 251 | These are the important changes in the recent Perl versions that had |
307 | 252 | an impact on mod_perl. For a complete list of changes see the |
308 | 253 | 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>). | |
312 | 257 | |
313 | 258 | The 5.6 Perl generation has introduced the following features: |
314 | 259 | |
322 | 267 | state of any given interpreter, it is possible to compile a piece of |
323 | 268 | code once in an interpreter, clone that interpreter one or more times, |
324 | 269 | 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 | |
326 | 271 | I<perl561delta> |
327 | (I<http://perldoc.com/perl5.6.1/pod/perl561delta.html>) manpages. | |
272 | (I<http://perldoc.perl.org/perl561delta.html>) manpages. | |
328 | 273 | |
329 | 274 | =item * |
330 | 275 | |
340 | 285 | |
341 | 286 | which will abort any code that generates warnings. This pragma also |
342 | 287 | 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>) | |
344 | 289 | manpage. |
345 | 290 | |
346 | 291 | =item * |
348 | 293 | Certain C<CORE::> functions now can be overridden via |
349 | 294 | C<CORE::GLOBAL::> namespace. For example mod_perl now can override |
350 | 295 | 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. | |
352 | 297 | |
353 | 298 | =item * |
354 | 299 | |
360 | 305 | The large file support. If you have filesystems that support "large |
361 | 306 | files" (files larger than 2 gigabytes), you may now also be able to |
362 | 307 | 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. | |
364 | 309 | |
365 | 310 | =item * |
366 | 311 | |
367 | 312 | 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. | |
369 | 314 | |
370 | 315 | =item * |
371 | 316 | |
372 | 317 | 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. | |
374 | 319 | |
375 | 320 | =item * |
376 | 321 | |
377 | 322 | Improved security features: more potentially unsafe operations taint |
378 | 323 | 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. | |
381 | 326 | |
382 | 327 | =item * |
383 | 328 | |
399 | 344 | The introduced in 5.6.0 experimental PerlIO layer has been stabilized |
400 | 345 | and become the default IO layer in 5.8.0. Now the IO stream can be |
401 | 346 | 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. | |
404 | 349 | |
405 | 350 | For example this allows mod_perl to inter-operate with the APR IO |
406 | 351 | layer and even use the APR IO layer in Perl code. See the |
413 | 358 | |
414 | 359 | That is a literal C<undef()>, not an undefined value. See the |
415 | 360 | 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>). | |
417 | 362 | |
418 | 363 | =item * |
419 | 364 | |
420 | 365 | 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. | |
422 | 367 | |
423 | 368 | =item * |
424 | 369 | |
440 | 385 | warnings are given. This is only meant as a temporary debugging aid |
441 | 386 | while securing the code of old legacy applications. B<This is not a |
442 | 387 | 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. | |
444 | 389 | |
445 | 390 | A new special variable C<${^TAINT}> was introduced. It indicates |
446 | 391 | 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. | |
448 | 393 | |
449 | 394 | =item * |
450 | 395 | |
498 | 443 | interpreter created at startup time compiles any pre-loaded Perl code. |
499 | 444 | A I<clone> is created from the parent using the Perl API |
500 | 445 | 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>) | |
502 | 447 | function. At request time, I<parent> interpreters are only used for |
503 | 448 | making more I<clones>, as the I<clones> are the interpreters which |
504 | 449 | actually handle requests. Care is taken by Perl to copy only mutable |
577 | 522 | the XS code was written for them here and there. |
578 | 523 | |
579 | 524 | 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 | |
581 | 526 | goal, nearly the entire APR and Apache API, along with their public |
582 | 527 | data structures are covered from the get-go. Certain functions and |
583 | 528 | structures which are considered "private" to Apache or otherwise |
13 | 13 | |
14 | 14 | First, L<download|download::index> the mod_perl 2.0 source. |
15 | 15 | |
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 | |
17 | 17 | L<mod_perl 2.0 |
18 | 18 | prerequisites|docs::2.0::user::install::install/Prerequisites> B<installed>. |
19 | 19 | Apache and the right Perl version have to be built and installed |
92 | 92 | |
93 | 93 | =head1 Registry Scripts |
94 | 94 | |
95 | To enable registry scripts add to I<httpd.conf>: | |
95 | To enable registry scripts add the following to I<httpd.conf>: | |
96 | 96 | |
97 | 97 | Alias /perl/ /home/httpd/httpd-2.0/perl/ |
98 | 98 | <Location /perl/> |
100 | 100 | PerlResponseHandler ModPerl::Registry |
101 | 101 | PerlOptions +ParseHeaders |
102 | 102 | Options +ExecCGI |
103 | Order allow,deny | |
104 | Allow from all | |
103 | 105 | </Location> |
104 | 106 | |
105 | 107 | and now assuming that we have the following script: |
126 | 128 | |
127 | 129 | For more information on the registry scripts refer to the |
128 | 130 | 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 | |
130 | 132 | it from 1.0's docs). |
131 | 133 | |
132 | 134 |
351 | 351 | use warnings; |
352 | 352 | |
353 | 353 | 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 | ||
355 | 357 | |
356 | 358 | BEGIN { |
357 | 359 | if (MP2) { |
486 | 488 | Instead use C<$ENV{MOD_PERL}> (available in both mod_perl |
487 | 489 | generations), which is set to the mod_perl version, like so: |
488 | 490 | |
489 | mod_perl/1.99_03-dev | |
491 | mod_perl/2.000002 | |
490 | 492 | |
491 | 493 | Therefore in order to check whether you are running under mod_perl, |
492 | 494 | you'd say: |
494 | 496 | if ($ENV{MOD_PERL}) { ... } |
495 | 497 | |
496 | 498 | To check for a specific version it's better to use |
497 | C<$mod_perl::VERSION>: | |
499 | C<$ENV{MOD_PERL_API_VERSION}> | |
498 | 500 | |
499 | 501 | 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 ); | |
503 | 504 | |
504 | 505 | |
505 | 506 | |
933 | 934 | C<$s-E<gt>register_cleanup> has been replaced with |
934 | 935 | C<L<APR::Pool::cleanup_register()|docs::2.0::api::APR::Pool/C_cleanup_register_>> |
935 | 936 | 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. | |
937 | 941 | |
938 | 942 | use Apache2::ServerUtil (); |
939 | 943 | sub cleanup_callback { |
940 | my ($pool, $s) = @_; | |
944 | my $data = shift; | |
941 | 945 | # your code comes here |
942 | Apache2::Const::OK; | |
946 | return Apache2::Const::OK; | |
943 | 947 | } |
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); | |
947 | 949 | |
948 | 950 | See also |
949 | 951 | C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>>. |
993 | 995 | |
994 | 996 | |
995 | 997 | |
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 | ||
996 | 1013 | =head2 C<$r-E<gt>cgi_env> |
997 | 1014 | |
998 | 1015 | See the next item |
1104 | 1121 | C<L<Apache2::compat|docs::2.0::api::Apache2::compat>> (it's slower). |
1105 | 1122 | |
1106 | 1123 | 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 | |
1108 | 1125 | of these functions. For documentation on its uses, please see: |
1109 | 1126 | |
1110 | 1127 | http://httpd.apache.org/apreq |
1262 | 1279 | |
1263 | 1280 | =head2 C<$r-E<gt>register_cleanup> |
1264 | 1281 | |
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 | |
1266 | 1284 | C<L<APR::Pool::cleanup_register()|docs::2.0::api::APR::Pool/C_cleanup_register_>> |
1267 | 1285 | which accepts the pool object as the first argument instead of the |
1268 | 1286 | request object. e.g.: |
1814 | 1832 | Here is how to write a simple I<Makefile.PL> for modules wanting to |
1815 | 1833 | build XS code against mod_perl 2.0: |
1816 | 1834 | |
1817 | use mod_perl 1.99; | |
1835 | use mod_perl 2.0; | |
1818 | 1836 | use ModPerl::MM (); |
1819 | 1837 | |
1820 | 1838 | ModPerl::MM::WriteMakefile( |
1208 | 1208 | |
1209 | 1209 | To continue our example above, let's say we want to support opening a |
1210 | 1210 | 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}> | |
1212 | 1212 | |
1213 | 1213 | 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 ); | |
1215 | 1216 | # ... |
1216 | 1217 | require Symbol if MP2; |
1217 | 1218 | # ... |
1218 | 1219 | |
1219 | 1220 | my $fh = MP2 ? Symbol::gensym : Apache->gensym; |
1220 | 1221 | 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 | |
1233 | 1222 | |
1234 | 1223 | Some modules, like C<CGI.pm> may work under mod_perl and without it, |
1235 | 1224 | and will want to use the mod_perl 1.0 API if that's available, or |
1237 | 1226 | this purpose. |
1238 | 1227 | |
1239 | 1228 | 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 } | |
1241 | 1231 | : 0; |
1242 | 1232 | |
1243 | 1233 | It sets the constant C<MP_GEN> to 0 if mod_perl is not available, to 1 |
1321 | 1311 | use warnings; |
1322 | 1312 | |
1323 | 1313 | 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 ); | |
1325 | 1316 | |
1326 | 1317 | BEGIN { |
1327 | 1318 | if (MP2) { |
1376 | 1367 | use warnings; |
1377 | 1368 | |
1378 | 1369 | 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 ); | |
1380 | 1372 | |
1381 | 1373 | BEGIN { |
1382 | warn "running $mod_perl::VERSION!\n"; | |
1374 | warn "running $ENV{MOD_PERL_API_VERSION}\n"; | |
1383 | 1375 | if (MP2) { |
1384 | 1376 | require Apache2::RequestRec; |
1385 | 1377 | require Apache2::RequestIO; |
479 | 479 | |
480 | 480 | =head2 Error about not finding I<Apache.pm> with I<CGI.pm> |
481 | 481 | |
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 | |
483 | 483 | under mod_perl 2.0, as earlier CGI.pm versions aren't |
484 | 484 | mod_perl 2.0 aware. |
485 | 485 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
226 | 227 | |
227 | 228 | sub apxs_extra_cppflags { |
228 | 229 | 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'); | |
230 | 232 | $flags =~ s/\"/\\\"/g; |
231 | 233 | $flags; |
232 | 234 | } |
523 | 525 | $self->{MP_DEBUG} = 1; |
524 | 526 | if ($self->perl_config('gccversion')) { |
525 | 527 | #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') && | |
531 | 533 | $ccopts !~ /declaration-after-statement/) { |
532 | 534 | debug "Adding -Wdeclaration-after-statement to ccopts"; |
533 | 535 | $ccopts .= " -Wdeclaration-after-statement"; |
1115 | 1117 | # first use apu_config_path and then apr_config_path in order to |
1116 | 1118 | # resolve the symbols right during linking |
1117 | 1119 | 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}) { | |
1119 | 1123 | chomp $link; |
1120 | 1124 | |
1121 | 1125 | # Change '/path/to/libanything.la' to '-L/path/to -lanything' |
1375 | 1379 | my $major = $1; |
1376 | 1380 | my $minor = (split /\s+/, scalar(<$fh>))[-1]; |
1377 | 1381 | 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"; | |
1380 | 1393 | $version =~ s/\"//g; |
1381 | 1394 | last; |
1382 | 1395 | } |
1643 | 1656 | sub apache_libs_MSWin32 { |
1644 | 1657 | my $self = shift; |
1645 | 1658 | 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; | |
1647 | 1664 | "@libs"; |
1648 | 1665 | } |
1649 | 1666 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
39 | 40 | |
40 | 41 | my @saved; |
41 | 42 | sub save { return $Apache2::PerlSections::Save } |
43 | sub server { return $Apache2::PerlSections::Server } | |
42 | 44 | sub saved { return @saved } |
43 | 45 | |
44 | 46 | sub handler : method { |
63 | 65 | { |
64 | 66 | no strict 'refs'; |
65 | 67 | 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); | |
68 | 73 | } |
69 | 74 | } |
70 | 75 | |
128 | 133 | sub dump_hash { |
129 | 134 | my ($self, $name, $hash) = @_; |
130 | 135 | |
131 | for my $entry (sort keys %{ $hash || {} }) { | |
136 | for my $entry (keys %{ $hash || {} }) { | |
132 | 137 | my $item = $hash->{$entry}; |
133 | 138 | my $type = ref($item); |
134 | 139 | |
148 | 153 | |
149 | 154 | $self->add_config("<$name $loc>\n"); |
150 | 155 | |
151 | for my $entry (sort keys %{ $hash || {} }) { | |
156 | for my $entry (keys %{ $hash || {} }) { | |
152 | 157 | $self->dump_entry($entry, $hash->{$entry}); |
153 | 158 | } |
154 | 159 | |
191 | 196 | } |
192 | 197 | |
193 | 198 | 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 | } | |
198 | 205 | } |
199 | 206 | |
200 | 207 | 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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
130 | 131 | |
131 | 132 | my $ReloadDirs = ref($o) && $o->dir_config("ReloadDirectories"); |
132 | 133 | my @watch_dirs = split(/\s+/, $ReloadDirs||''); |
134 | ||
135 | my @changed; | |
133 | 136 | foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) { |
134 | 137 | my $file = $Apache2::Reload::INCS{$key}; |
135 | 138 | |
154 | 157 | } |
155 | 158 | |
156 | 159 | 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; | |
162 | 161 | } |
163 | 162 | $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; | |
164 | 178 | } |
165 | 179 | |
166 | 180 | 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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
129 | 130 | |
130 | 131 | if ($ENV{MOD_PERL}) { |
131 | 132 | if ($ENV{PERL_RLIMIT_DEFAULTS}) { |
132 | Apache2->server->push_handlers( | |
133 | require Apache2::ServerUtil; | |
134 | Apache2::ServerUtil->server->push_handlers( | |
133 | 135 | PerlChildInitHandler => \&default_handler); |
134 | 136 | } |
135 | 137 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
29 | 30 | use constant WIN32 => $^O eq 'MSWin32'; |
30 | 31 | use constant SOLARIS => $^O eq 'solaris'; |
31 | 32 | 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; | |
33 | 34 | |
34 | 35 | use Apache2::Const -compile => qw(OK DECLINED); |
35 | 36 | |
109 | 110 | sub linux_smaps_size_check { |
110 | 111 | |
111 | 112 | 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); | |
113 | 114 | } |
114 | 115 | |
115 | 116 | # return process size (in KB) |
137 | 138 | return ($size, 0); |
138 | 139 | } |
139 | 140 | |
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 ); | |
142 | 151 | } |
143 | 152 | |
144 | 153 | sub win32_size_check { |
188 | 197 | $START_TIME ||= time; |
189 | 198 | |
190 | 199 | 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) { | |
196 | 207 | # wake up! time to die. |
197 | 208 | if (WIN32 || ( getppid > 1 )) { |
198 | 209 | # this is a child httpd |
199 | 210 | 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; | |
202 | 214 | $msg .= " REQUESTS=$REQUEST_COUNT LIFETIME=$e seconds"; |
203 | 215 | error_log($msg); |
204 | 216 | |
205 | 217 | $r->child_terminate(); |
206 | 218 | } |
207 | 219 | 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; | |
210 | 223 | error_log($msg); |
211 | 224 | } |
212 | 225 | } |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
58 | 59 | lexinfo => ["StatusLexInfo", "B::LexInfo", 0, ], |
59 | 60 | xref => ["StatusXref", "B::Xref", 1.01, ], |
60 | 61 | 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, ], | |
63 | 64 | peek => ["StatusPeek", "Apache::Peek", 1.03, ], |
64 | 65 | ); |
65 | 66 | |
215 | 216 | $module =~ s,\.pm$,,; |
216 | 217 | next if $module eq 'mod_perl'; |
217 | 218 | my $v = ${"$module\:\:VERSION"} || '0.00'; |
219 | my $mtime = -e $INC{$file} ? scalar localtime((stat $INC{$file})[9]) : | |
220 | 'N/A'; | |
221 | ||
218 | 222 | push @retval, ( |
219 | 223 | "<tr>", |
220 | 224 | (map "<td>$_</td>", |
221 | 225 | qq(<a href="$uri?$module">$module</a>), |
222 | $v, scalar localtime((stat $INC{$file})[9]), $INC{$file}), | |
226 | $v, $mtime, $INC{$file}), | |
223 | 227 | "</tr>\n" |
224 | 228 | ); |
225 | 229 | } |
547 | 551 | $_; |
548 | 552 | } (sort { $subs->{$b}->{size} <=> $subs->{$a}->{size} } keys %$subs); |
549 | 553 | |
550 | my $clen = length $subs->{$keys[0]}->{count}; | |
554 | my $clen = $subs->{$keys[0]}->{count} ? | |
555 | length $subs->{$keys[0]}->{count} : 0; | |
551 | 556 | my $slen = length $subs->{$keys[0]}->{size}; |
552 | 557 | |
553 | 558 | 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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
74 | 75 | $build ||= build_config(); |
75 | 76 | ModPerl::MM::my_import(__PACKAGE__); |
76 | 77 | |
77 | my $inc = $build->inc; | |
78 | my $inc; | |
79 | $inc = $args{INC} if $args{INC}; | |
80 | $inc = " " . $build->inc; | |
78 | 81 | if (my $glue_inc = $build->{MP_XS_GLUE_DIR}) { |
79 | 82 | for (split /\s+/, $glue_inc) { |
80 | 83 | $inc .= " -I$_"; |
83 | 86 | |
84 | 87 | my $libs; |
85 | 88 | my @libs = (); |
89 | push @libs, $args{LIBS} if $args{LIBS}; | |
86 | 90 | if (Apache2::Build::BUILD_APREXT) { |
87 | 91 | # in order to decouple APR/APR::* from mod_perl.so, |
88 | 92 | # link these modules against the static MP_APR_LIB lib, |
104 | 108 | } |
105 | 109 | $libs = join ' ', @libs; |
106 | 110 | |
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; | |
108 | 126 | |
109 | 127 | 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, | |
116 | 134 | ); |
117 | 135 | |
118 | 136 | my @typemaps; |
137 | push @typemaps, $args{TYPEMAPS} if $args{TYPEMAPS}; | |
119 | 138 | my $pwd = Cwd::fastcwd(); |
120 | 139 | for ('xs', $pwd, "$pwd/..") { |
121 | 140 | my $typemap = $build->file_path("$_/typemap"); |
192 | 211 | # allow 'make -j' |
193 | 212 | require ExtUtils::MakeMaker; |
194 | 213 | my $mm_ver = $ExtUtils::MakeMaker::VERSION; |
214 | $mm_ver =~ s/_.*//; # handle dev versions like 6.30_01 | |
195 | 215 | my $pm_to_blib = ($mm_ver >= 6.22 && $mm_ver <= 6.25) |
196 | 216 | ? "pm_to_blib.ts" |
197 | 217 | : "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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
119 | 120 | # MP_AP_PREFIX may not contain spaces |
120 | 121 | require Win32; |
121 | 122 | $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"; | |
122 | 128 | } |
123 | 129 | } |
124 | 130 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
136 | 137 | my @ithread_opts = qw(CLONE PARENT); |
137 | 138 | my %flags = ( |
138 | 139 | Srv => ['NONE', @ithread_opts, qw(ENABLE AUTOLOAD MERGE_HANDLERS), |
139 | @hook_flags, 'UNSET'], | |
140 | @hook_flags, 'UNSET','INHERIT_SWITCHES'], | |
140 | 141 | Dir => [qw(NONE PARSE_HEADERS SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)], |
141 | 142 | Req => [qw(NONE SET_GLOBAL_REQUEST PARSE_HEADERS SETUP_ENV |
142 | 143 | CLEANUP_REGISTERED PERL_SET_ENV_DIR PERL_SET_ENV_SRV)], |
459 | 460 | push @lookup, $indent1 . " case '$_':"; |
460 | 461 | push @lookup, map { $indent2 . $_ } @{ $switch{$_} }; |
461 | 462 | } |
462 | push @lookup, map { $indent1 . $_ } ("}\n", "return 0;\n}\n\n"); | |
463 | push @lookup, map { $indent1 . $_ } ("}\n", "return -1;\n}\n\n"); | |
463 | 464 | |
464 | 465 | print $c_fh join "\n", @lookup; |
465 | 466 | print $h_fh "$lookup_proto;\n"; |
777 | 778 | my $xsinit = "$self->{path}/modperl_xsinit.c"; |
778 | 779 | debug "generating...$xsinit"; |
779 | 780 | |
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 | ||
780 | 791 | #create bootstrap method for static xs modules |
781 | 792 | my $static_xs = [keys %{ $build->{XS} }]; |
782 | 793 | 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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
3 | 3 | # * This file generated by ModPerl::WrapXS/0.01 |
4 | 4 | # * Any changes made here will be lost |
5 | 5 | # * *********************************** |
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 | |
9 | 9 | # * 04: Makefile.PL:423 |
10 | 10 | # * 05: Makefile.PL:325 |
11 | 11 | # * 06: Makefile.PL:56 |
13 | 13 | # |
14 | 14 | |
15 | 15 | package APR::Util; |
16 | $APR::Util::VERSION = 0.009000; | |
16 | $APR::Util::VERSION = 0.009000; | |
17 | 17 | |
18 | 18 | package APR::Base64; |
19 | $APR::Base64::VERSION = 0.009000; | |
19 | $APR::Base64::VERSION = 0.009000; | |
20 | 20 | |
21 | 21 | package Apache2::Process; |
22 | $Apache2::Process::VERSION = 2.000002; | |
22 | $Apache2::Process::VERSION = 2.000003; | |
23 | 23 | |
24 | 24 | package Apache2::HookRun; |
25 | $Apache2::HookRun::VERSION = 2.000002; | |
25 | $Apache2::HookRun::VERSION = 2.000003; | |
26 | 26 | |
27 | 27 | package APR::Bucket; |
28 | $APR::Bucket::VERSION = 0.009000; | |
28 | $APR::Bucket::VERSION = 0.009000; | |
29 | 29 | |
30 | 30 | 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; | |
32 | 35 | |
33 | 36 | package APR::Finfo; |
34 | $APR::Finfo::VERSION = 0.009000; | |
37 | $APR::Finfo::VERSION = 0.009000; | |
35 | 38 | |
36 | 39 | package APR::SockAddr; |
37 | $APR::SockAddr::VERSION = 0.009000; | |
40 | $APR::SockAddr::VERSION = 0.009000; | |
38 | 41 | |
39 | 42 | package ModPerl::Global; |
40 | $ModPerl::Global::VERSION = 2.000002; | |
43 | $ModPerl::Global::VERSION = 2.000003; | |
41 | 44 | |
42 | 45 | package Apache2::FilterRec; |
43 | $Apache2::FilterRec::VERSION = 2.000002; | |
46 | $Apache2::FilterRec::VERSION = 2.000003; | |
44 | 47 | |
45 | 48 | package APR::BucketType; |
46 | $APR::BucketType::VERSION = 0.009000; | |
49 | $APR::BucketType::VERSION = 0.009000; | |
47 | 50 | |
48 | 51 | package Apache2::MPM; |
49 | $Apache2::MPM::VERSION = 2.000002; | |
52 | $Apache2::MPM::VERSION = 2.000003; | |
50 | 53 | |
51 | 54 | package Apache2::Directive; |
52 | $Apache2::Directive::VERSION = 2.000002; | |
55 | $Apache2::Directive::VERSION = 2.000003; | |
53 | 56 | |
54 | 57 | package APR::Error; |
55 | $APR::Error::VERSION = 0.009000; | |
58 | $APR::Error::VERSION = 0.009000; | |
56 | 59 | |
57 | 60 | package Apache2::Filter; |
58 | $Apache2::Filter::VERSION = 2.000002; | |
61 | $Apache2::Filter::VERSION = 2.000003; | |
59 | 62 | |
60 | 63 | package Apache2::Util; |
61 | $Apache2::Util::VERSION = 2.000002; | |
64 | $Apache2::Util::VERSION = 2.000003; | |
62 | 65 | |
63 | 66 | package APR::Date; |
64 | $APR::Date::VERSION = 0.009000; | |
67 | $APR::Date::VERSION = 0.009000; | |
65 | 68 | |
66 | 69 | package Apache2::CmdParms; |
67 | $Apache2::CmdParms::VERSION = 2.000002; | |
70 | $Apache2::CmdParms::VERSION = 2.000003; | |
68 | 71 | |
69 | 72 | package Apache2::Log; |
70 | $Apache2::Log::VERSION = 2.000002; | |
73 | $Apache2::Log::VERSION = 2.000003; | |
71 | 74 | |
72 | 75 | package Apache2::ServerUtil; |
73 | $Apache2::ServerUtil::VERSION = 2.000002; | |
76 | $Apache2::ServerUtil::VERSION = 2.000003; | |
74 | 77 | |
75 | 78 | package Apache2::RequestUtil; |
76 | $Apache2::RequestUtil::VERSION = 2.000002; | |
79 | $Apache2::RequestUtil::VERSION = 2.000003; | |
77 | 80 | |
78 | 81 | package Apache2::URI; |
79 | $Apache2::URI::VERSION = 2.000002; | |
82 | $Apache2::URI::VERSION = 2.000003; | |
80 | 83 | |
81 | 84 | package APR::UUID; |
82 | $APR::UUID::VERSION = 0.009000; | |
85 | $APR::UUID::VERSION = 0.009000; | |
83 | 86 | |
84 | 87 | package APR::Table; |
85 | $APR::Table::VERSION = 0.009000; | |
88 | $APR::Table::VERSION = 0.009000; | |
86 | 89 | |
87 | 90 | package APR::Status; |
88 | $APR::Status::VERSION = 0.009000; | |
91 | $APR::Status::VERSION = 0.009000; | |
89 | 92 | |
90 | 93 | package Apache2::Connection; |
91 | $Apache2::Connection::VERSION = 2.000002; | |
94 | $Apache2::Connection::VERSION = 2.000003; | |
92 | 95 | |
93 | 96 | package Apache2::ServerRec; |
94 | $Apache2::ServerRec::VERSION = 2.000002; | |
97 | $Apache2::ServerRec::VERSION = 2.000003; | |
95 | 98 | |
96 | 99 | package ModPerl::Util; |
97 | $ModPerl::Util::VERSION = 2.000002; | |
100 | $ModPerl::Util::VERSION = 2.000003; | |
98 | 101 | |
99 | 102 | package Apache2::SubRequest; |
100 | $Apache2::SubRequest::VERSION = 2.000002; | |
103 | $Apache2::SubRequest::VERSION = 2.000003; | |
101 | 104 | |
102 | 105 | package APR::URI; |
103 | $APR::URI::VERSION = 0.009000; | |
106 | $APR::URI::VERSION = 0.009000; | |
104 | 107 | |
105 | 108 | package Apache2::RequestIO; |
106 | $Apache2::RequestIO::VERSION = 2.000002; | |
109 | $Apache2::RequestIO::VERSION = 2.000003; | |
107 | 110 | |
108 | 111 | package APR::Brigade; |
109 | $APR::Brigade::VERSION = 0.009000; | |
112 | $APR::Brigade::VERSION = 0.009000; | |
110 | 113 | |
111 | 114 | package APR::ThreadMutex; |
112 | $APR::ThreadMutex::VERSION = 0.009000; | |
115 | $APR::ThreadMutex::VERSION = 0.009000; | |
113 | 116 | |
114 | 117 | package APR::BucketAlloc; |
115 | $APR::BucketAlloc::VERSION = 0.009000; | |
118 | $APR::BucketAlloc::VERSION = 0.009000; | |
116 | 119 | |
117 | 120 | package Apache2::SubProcess; |
118 | $Apache2::SubProcess::VERSION = 2.000002; | |
121 | $Apache2::SubProcess::VERSION = 2.000003; | |
119 | 122 | |
120 | 123 | package Apache2::Response; |
121 | $Apache2::Response::VERSION = 2.000002; | |
124 | $Apache2::Response::VERSION = 2.000003; | |
122 | 125 | |
123 | 126 | package APR::IpSubnet; |
124 | $APR::IpSubnet::VERSION = 0.009000; | |
127 | $APR::IpSubnet::VERSION = 0.009000; | |
125 | 128 | |
126 | 129 | package Apache2::RequestRec; |
127 | $Apache2::RequestRec::VERSION = 2.000002; | |
130 | $Apache2::RequestRec::VERSION = 2.000003; | |
128 | 131 | |
129 | 132 | package Apache2::Module; |
130 | $Apache2::Module::VERSION = 2.000002; | |
133 | $Apache2::Module::VERSION = 2.000003; | |
131 | 134 | |
132 | 135 | package APR::OS; |
133 | $APR::OS::VERSION = 0.009000; | |
136 | $APR::OS::VERSION = 0.009000; | |
134 | 137 | |
135 | 138 | package APR::Socket; |
136 | $APR::Socket::VERSION = 0.009000; | |
139 | $APR::Socket::VERSION = 0.009000; | |
137 | 140 | |
138 | 141 | package Apache2::Access; |
139 | $Apache2::Access::VERSION = 2.000002; | |
142 | $Apache2::Access::VERSION = 2.000003; | |
140 | 143 | |
141 | 144 | package APR::String; |
142 | $APR::String::VERSION = 0.009000; | |
145 | $APR::String::VERSION = 0.009000; | |
143 | 146 | |
144 | 147 | package APR::Pool; |
145 | $APR::Pool::VERSION = 0.009000; | |
148 | $APR::Pool::VERSION = 0.009000; | |
146 | 149 | |
147 | 150 | package ModPerl::MethodLookup; |
148 | $ModPerl::MethodLookup::VERSION = 2.000002; | |
151 | $ModPerl::MethodLookup::VERSION = 2.000003; | |
149 | 152 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
38 | 39 | my @files; |
39 | 40 | |
40 | 41 | 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 | } | |
57 | 50 | } |
58 | close $fh; | |
59 | ||
60 | }}, $cwd); | |
51 | } | |
61 | 52 | |
62 | 53 | # files to add which aren't under svn |
63 | 54 | 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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
15 | 16 | |
16 | 17 | use 5.006; |
17 | 18 | use strict; |
18 | use File::Spec::Functions; | |
19 | 19 | |
20 | 20 | BEGIN { |
21 | our $VERSION = "2.000002"; | |
21 | our $VERSION = "2.000003"; | |
22 | 22 | our $VERSION_TRIPLET; |
23 | 23 | |
24 | 24 | if ($VERSION =~ /(\d+)\.(\d\d\d)(\d+)/) { |
48 | 48 | # startup you are protected against loading mod_perl.pm |
49 | 49 | # (either 1.0 or 1.99) at a later time by accident. |
50 | 50 | $mod_perl::VERSION = $mod_perl2::VERSION; |
51 | $INC{"mod_perl.pm"} = File::Spec::Functions::devnull(); | |
51 | $INC{"mod_perl.pm"} = __FILE__; | |
52 | 52 | |
53 | 53 | 1; |
54 | 54 | __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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
484 | 485 | #ifdef USE_ITHREADS |
485 | 486 | static void modperl_init_clones(server_rec *s, apr_pool_t *p) |
486 | 487 | { |
488 | #ifdef MP_TRACE | |
487 | 489 | modperl_config_srv_t *base_scfg = modperl_config_srv_get(s); |
488 | #ifdef MP_TRACE | |
489 | 490 | char *base_name = modperl_server_desc(s, p); |
490 | 491 | #endif /* MP_TRACE */ |
491 | 492 |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
39 | 40 | #define ap_http_scheme(r) ap_http_method(r) |
40 | 41 | #endif |
41 | 42 | |
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 | ||
42 | 56 | #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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
129 | 130 | |
130 | 131 | if (status == HTTP_INTERNAL_SERVER_ERROR) { |
131 | 132 | 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)); | |
133 | 134 | } |
134 | 135 | } |
135 | 136 |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
155 | 156 | return modperl_cmd_too_late(parms); |
156 | 157 | } |
157 | 158 | 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 | } | |
159 | 166 | return NULL; |
160 | 167 | } |
161 | 168 | |
484 | 491 | #define MP_DEFAULT_PERLSECTION_PACKAGE "Apache2::ReadConfig" |
485 | 492 | #define MP_PERLSECTIONS_SAVECONFIG_SV \ |
486 | 493 | get_sv("Apache2::PerlSections::Save", FALSE) |
494 | #define MP_PERLSECTIONS_SERVER_SV \ | |
495 | get_sv("Apache2::PerlSections::Server", TRUE) | |
487 | 496 | |
488 | 497 | MP_CMD_SRV_DECLARE(perldo) |
489 | 498 | { |
549 | 558 | } |
550 | 559 | |
551 | 560 | { |
561 | SV *server = MP_PERLSECTIONS_SERVER_SV; | |
552 | 562 | SV *code = newSVpv(arg, 0); |
553 | 563 | GV *gv = gv_fetchpv("0", TRUE, SVt_PV); |
554 | 564 | ENTER;SAVETMPS; |
556 | 566 | #if PERL_REVISION == 5 && PERL_VERSION >= 9 |
557 | 567 | TAINT_NOT; /* XXX: temp workaround, see my p5p post */ |
558 | 568 | #endif |
569 | sv_setref_pv(server, "Apache2::ServerRec", (void*)s); | |
559 | 570 | sv_setpv_mg(GvSV(gv), directive->filename); |
560 | 571 | eval_sv(code, G_SCALAR|G_KEEPERR); |
561 | 572 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
0 | 0 | |
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 | |
6 | 7 | * |
7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
8 | 9 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
0 | 0 | |
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 | |
6 | 7 | * |
7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
8 | 9 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
146 | 147 | return rcfg; |
147 | 148 | } |
148 | 149 | |
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 | ||
149 | 160 | modperl_config_srv_t *modperl_config_srv_new(apr_pool_t *p, server_rec *s) |
150 | 161 | { |
151 | 162 | modperl_config_srv_t *scfg = (modperl_config_srv_t *) |
301 | 312 | merge_item(perl); |
302 | 313 | #endif |
303 | 314 | |
304 | if (add->argv->nelts == 2 && | |
305 | strEQ(((char **)add->argv->elts)[1], "+inherit")) | |
306 | { | |
315 | if (MpSrvINHERIT_SWITCHES(add)) { | |
307 | 316 | /* only inherit base PerlSwitches if explicitly told to */ |
308 | 317 | mrg->argv = base->argv; |
309 | 318 | } |
499 | 508 | apr_pool_t *ptmp, |
500 | 509 | int override, |
501 | 510 | char *path, |
511 | int override_options, | |
502 | 512 | ap_conf_vector_t *conf, |
503 | 513 | SV *lines) |
504 | 514 | { |
514 | 524 | parms.override = override; |
515 | 525 | parms.path = path; |
516 | 526 | 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 | |
517 | 535 | |
518 | 536 | if (ptmp) { |
519 | 537 | parms.temp_pool = ptmp; |
560 | 578 | parms->temp_pool, |
561 | 579 | parms->override, |
562 | 580 | parms->path, |
581 | #ifdef MP_HTTPD_HAS_OVERRIDE_OPTS | |
582 | parms->override_opts, | |
583 | #else | |
584 | MP_HTTPD_OVERRIDE_OPTS_UNSET, | |
585 | #endif | |
563 | 586 | parms->context, |
564 | 587 | lines); |
565 | 588 | } |
571 | 594 | apr_pool_t *p = s->process->pconf; |
572 | 595 | |
573 | 596 | return modperl_config_insert(aTHX_ s, p, NULL, override, NULL, |
597 | MP_HTTPD_OVERRIDE_OPTS_UNSET, | |
574 | 598 | s->lookup_defaults, lines); |
575 | 599 | } |
576 | 600 | |
577 | 601 | const char *modperl_config_insert_request(pTHX_ |
578 | 602 | request_rec *r, |
579 | 603 | SV *lines, |
580 | int override) | |
604 | int override, | |
605 | char *path, | |
606 | int override_options) | |
581 | 607 | { |
582 | 608 | const char *errmsg; |
583 | 609 | ap_conf_vector_t *dconf = ap_create_per_dir_config(r->pool); |
584 | 610 | |
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 | ||
587 | 616 | errmsg = modperl_config_insert(aTHX_ |
588 | 617 | r->server, r->pool, r->pool, |
589 | override, "/", | |
618 | override, path, override_options, | |
590 | 619 | dconf, lines); |
591 | 620 | |
592 | 621 | if (errmsg) { |
609 | 638 | server_rec *s, const char *name) |
610 | 639 | { |
611 | 640 | U32 flag; |
612 | MP_dSCFG(s); | |
613 | 641 | |
614 | 642 | /* XXX: should we test whether perl is disabled for this server? */ |
615 | 643 | /* if (!MpSrvENABLE(scfg)) { */ |
617 | 645 | /* } */ |
618 | 646 | |
619 | 647 | if (r) { |
620 | if ((flag = modperl_flags_lookup_dir(name))) { | |
648 | if ((flag = modperl_flags_lookup_dir(name)) != -1) { | |
621 | 649 | MP_dDCFG; |
622 | 650 | return MpDirFLAGS(dcfg) & flag ? 1 : 0; |
623 | 651 | } |
626 | 654 | } |
627 | 655 | } |
628 | 656 | else { |
629 | if ((flag = modperl_flags_lookup_srv(name))) { | |
657 | if ((flag = modperl_flags_lookup_srv(name)) != -1) { | |
658 | MP_dSCFG(s); | |
630 | 659 | return MpSrvFLAGS(scfg) & flag ? 1 : 0; |
631 | 660 | } |
632 | 661 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
24 | 25 | modperl_config_dir_t *modperl_config_dir_new(apr_pool_t *p); |
25 | 26 | |
26 | 27 | modperl_config_req_t *modperl_config_req_new(request_rec *r); |
28 | ||
29 | modperl_config_con_t *modperl_config_con_new(conn_rec *c); | |
27 | 30 | |
28 | 31 | void *modperl_config_srv_create(apr_pool_t *p, server_rec *s); |
29 | 32 | |
77 | 80 | #define MP_dRCFG \ |
78 | 81 | modperl_config_req_t *rcfg = modperl_config_req_get(r) |
79 | 82 | |
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 | ||
80 | 96 | #define modperl_config_dir_get(r) \ |
81 | 97 | (r ? (modperl_config_dir_t *) \ |
82 | 98 | modperl_get_module_config(r->per_dir_config) : NULL) |
130 | 146 | apr_pool_t *ptmp, |
131 | 147 | int override, |
132 | 148 | char *path, |
149 | int override_options, | |
133 | 150 | ap_conf_vector_t *conf, |
134 | 151 | SV *lines); |
135 | 152 | |
141 | 158 | const char *modperl_config_insert_request(pTHX_ |
142 | 159 | request_rec *r, |
143 | 160 | SV *lines, |
144 | int override); | |
161 | int override, | |
162 | char *path, | |
163 | int override_options); | |
145 | 164 | |
146 | 165 | int modperl_config_is_perl_option_enabled(pTHX_ request_rec *r, |
147 | 166 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
14 | 15 | |
15 | 16 | #include "mod_perl.h" |
16 | 17 | |
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;} | |
19 | 25 | |
20 | 26 | /* XXX: move to utils? */ |
21 | 27 | static unsigned long modperl_interp_address(pTHX) |
400 | 406 | |
401 | 407 | void modperl_env_request_tie(pTHX_ request_rec *r) |
402 | 408 | { |
403 | EnvMgObj = (char *)r; | |
404 | EnvMgLen = -1; | |
409 | EnvMgObjSet(r); | |
410 | EnvMgLenSet(-1); | |
405 | 411 | |
406 | 412 | #ifdef MP_PERL_HV_GMAGICAL_AWARE |
407 | 413 | MP_TRACE_e(MP_FUNC, "[%s/0x%lx] tie %%ENV, $r\n\t (%s%s)", |
413 | 419 | |
414 | 420 | void modperl_env_request_untie(pTHX_ request_rec *r) |
415 | 421 | { |
416 | EnvMgObj = NULL; | |
422 | EnvMgObjSet(NULL); | |
417 | 423 | |
418 | 424 | #ifdef MP_PERL_HV_GMAGICAL_AWARE |
419 | 425 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
87 | 88 | modperl_modglobal_key_t *gkey = |
88 | 89 | modperl_modglobal_lookup(aTHX_ "ANONSUB"); |
89 | 90 | MP_TRACE_h(MP_FUNC, "init $PL_modglobal{ANONSUB} = []"); |
90 | MP_MODGLOBAL_STORE_HV(gkey); | |
91 | (void)MP_MODGLOBAL_STORE_HV(gkey); | |
91 | 92 | } |
92 | 93 | |
93 | 94 | /* 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
120 | 121 | TRUE, SVt_PVIO); |
121 | 122 | |
122 | 123 | /* 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); | |
125 | 126 | if (status == 0) { |
126 | 127 | Perl_croak(aTHX_ "Failed to dup STDIN: %" SVf, get_sv("!", TRUE)); |
127 | 128 | } |
129 | 130 | /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't |
130 | 131 | * have file descriptors, so STDIN must be closed before it can |
131 | 132 | * be reopened */ |
132 | Perl_do_close(aTHX_ handle, TRUE); | |
133 | do_close(handle, TRUE); | |
133 | 134 | } |
134 | 135 | |
135 | 136 | 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); | |
138 | 139 | if (status == 0) { |
139 | 140 | Perl_croak(aTHX_ "Failed to open STDIN: %" SVf, get_sv("!", TRUE)); |
140 | 141 | } |
163 | 164 | TRUE, SVt_PVIO); |
164 | 165 | |
165 | 166 | /* 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); | |
168 | 169 | if (status == 0) { |
169 | 170 | Perl_croak(aTHX_ "Failed to dup STDOUT: %" SVf, get_sv("!", TRUE)); |
170 | 171 | } |
172 | 173 | /* similar to PerlIO::scalar, the PerlIO::Apache layer doesn't |
173 | 174 | * have file descriptors, so STDOUT must be closed before it can |
174 | 175 | * be reopened */ |
175 | Perl_do_close(aTHX_ handle, TRUE); | |
176 | do_close(handle, TRUE); | |
176 | 177 | } |
177 | 178 | |
178 | 179 | 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); | |
181 | 182 | if (status == 0) { |
182 | 183 | Perl_croak(aTHX_ "Failed to open STDOUT: %" SVf, get_sv("!", TRUE)); |
183 | 184 | } |
199 | 200 | MP_TRACE_o(MP_FUNC, "start"); |
200 | 201 | |
201 | 202 | /* close the overriding filehandle */ |
202 | Perl_do_close(aTHX_ handle_orig, FALSE); | |
203 | do_close(handle_orig, FALSE); | |
203 | 204 | |
204 | 205 | /* |
205 | 206 | * open STDIN, "<&STDIN_SAVED" or die "Can't dup STDIN_SAVED: $!"; |
210 | 211 | |
211 | 212 | MP_TRACE_o(MP_FUNC, "restoring STDIN"); |
212 | 213 | |
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) { | |
215 | 216 | err = get_sv("!", TRUE); |
216 | 217 | } |
217 | 218 | |
218 | Perl_do_close(aTHX_ handle, FALSE); | |
219 | do_close(handle, FALSE); | |
219 | 220 | (void)hv_delete(gv_stashpv("Apache2::RequestIO", TRUE), |
220 | 221 | GvNAME(handle), GvNAMELEN(handle), G_DISCARD); |
221 | 222 | |
246 | 247 | } |
247 | 248 | |
248 | 249 | /* close the overriding filehandle */ |
249 | Perl_do_close(aTHX_ handle_orig, FALSE); | |
250 | do_close(handle_orig, FALSE); | |
250 | 251 | |
251 | 252 | /* |
252 | 253 | * open STDOUT, ">&STDOUT_SAVED" or die "Can't dup STDOUT_SAVED: $!"; |
257 | 258 | |
258 | 259 | MP_TRACE_o(MP_FUNC, "restoring STDOUT"); |
259 | 260 | |
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) { | |
262 | 263 | err = get_sv("!", TRUE); |
263 | 264 | } |
264 | 265 | |
265 | Perl_do_close(aTHX_ handle, FALSE); | |
266 | do_close(handle, FALSE); | |
266 | 267 | (void)hv_delete(gv_stashpv("Apache2::RequestIO", TRUE), |
267 | 268 | GvNAME(handle), GvNAMELEN(handle), G_DISCARD); |
268 | 269 |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
70 | 71 | action = *(str++); |
71 | 72 | } |
72 | 73 | |
73 | if (!(opt = flags_lookup(o, str))) { | |
74 | if ((opt = flags_lookup(o, str)) == -1) { | |
74 | 75 | error = apr_pstrcat(p, "Invalid per-", type_lookup(o), |
75 | 76 | " PerlOption: ", str, NULL); |
76 | 77 | |
78 | 79 | modperl_options_t dummy; |
79 | 80 | MpOptionsTypeSrv_set(&dummy); |
80 | 81 | |
81 | if (flags_lookup(&dummy, str)) { | |
82 | if (flags_lookup(&dummy, str) == -1) { | |
82 | 83 | error = apr_pstrcat(p, error, |
83 | 84 | " (only allowed per-server)", |
84 | 85 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
71 | 72 | ids->uid = getuid(); |
72 | 73 | ids->euid = geteuid(); |
73 | 74 | ids->gid = getgid(); |
74 | ids->gid = getegid(); | |
75 | ids->egid = getegid(); | |
75 | 76 | |
76 | 77 | MP_TRACE_r(MP_FUNC, |
77 | 78 | "pid=%d, " |
78 | 79 | #ifdef MP_MAINTAIN_PPID |
79 | 80 | "ppid=%d, " |
80 | 81 | #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", | |
82 | 84 | (int)ids->pid, |
83 | 85 | #ifdef MP_MAINTAIN_PPID |
84 | 86 | (int)ids->ppid, |
85 | 87 | #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); | |
88 | 90 | #endif /* #ifndef WIN32 */ |
89 | 91 | } |
90 | 92 |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
257 | 258 | } modperl_config_req_t; |
258 | 259 | |
259 | 260 | typedef struct { |
260 | MpAV *handlers_connection[MP_HANDLER_NUM_CONNECTION]; | |
261 | HV *pnotes; | |
261 | 262 | } modperl_config_con_t; |
262 | 263 | |
263 | 264 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
827 | 828 | modperl_global_get_server_rec()->process->pool); |
828 | 829 | return data ? *(int *)data : 0; |
829 | 830 | } |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
144 | 145 | void modperl_restart_count_inc(server_rec *base_server); |
145 | 146 | int modperl_restart_count(void); |
146 | 147 | |
148 | SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val, | |
149 | request_rec *r, conn_rec *c); | |
150 | ||
147 | 151 | #endif /* MODPERL_UTIL_H */ |
44 | 44 | |
45 | 45 | my $cl = 0; |
46 | 46 | my $head_cl = undef; |
47 | ||
47 | ||
48 | 48 | ok t_cmp $res->code, 200, "$method $uri code"; |
49 | 49 | ok t_cmp ($res->header('Content-Length'), |
50 | 50 | $method eq 'GET' ? $cl : $head_cl, |
64 | 64 | my $res = $method->($uri); |
65 | 65 | |
66 | 66 | 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 | ||
69 | 87 | ok t_cmp $res->code, 200, "$method $uri code"; |
70 | 88 | ok t_cmp ($res->header('Content-Length'), |
71 | 89 | $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 |
28 | 28 | # it also tries to set status (to a different value), but it |
29 | 29 | # should be ignored by Apache, since status_line is supposed to |
30 | 30 | # 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 | ||
31 | 35 | my $code = 499; # not in HTTP/1.1 |
32 | 36 | my $message = "FooBared"; |
33 | 37 | my $res = GET "$location?$code=$message"; |
62 | 62 | } |
63 | 63 | </Perl> |
64 | 64 | |
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 | ||
65 | 82 | ### --------------------------------- ### |
66 | 83 | Perl $TestDirective::perl::worked="yes"; |
67 | 84 | |
83 | 100 | =cut |
84 | 101 | |
85 | 102 | 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 |
4 | 4 | use Apache::TestRequest; |
5 | 5 | use Apache::TestUtil; |
6 | 6 | |
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)), | |
8 | 8 | need_access; |
9 | 9 | |
10 | 10 | 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> |
43 | 43 | <VirtualHost TestHooks::push_handlers_anon> |
44 | 44 | PerlModule TestHooks::push_handlers_anon |
45 | 45 | <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 => | |
59 | 49 | sub { &TestHooks::push_handlers_anon::add_note }); |
60 | $vs->push_handlers(PerlFixupHandler => | |
50 | $s->push_handlers(PerlFixupHandler => | |
61 | 51 | \&TestHooks::push_handlers_anon::add_note ); |
62 | $vs->push_handlers(PerlFixupHandler => | |
52 | $s->push_handlers(PerlFixupHandler => | |
63 | 53 | "TestHooks::push_handlers_anon::add_note" ); |
64 | 54 | </Perl> |
65 | 55 |
42 | 42 | callback(shift); |
43 | 43 | |
44 | 44 | 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; | |
45 | 56 | } |
46 | 57 | |
47 | 58 | sub callback { |
166 | 177 | # 1 run, 1 left behind |
167 | 178 | PerlTypeHandler TestHooks::stacked_handlers2::ok TestHooks::stacked_handlers3::server_error |
168 | 179 | |
169 | # all 2 run | |
180 | # all 4 run | |
170 | 181 | PerlFixupHandler TestHooks::stacked_handlers2::ok TestHooks::stacked_handlers2::ok |
182 | PerlFixupHandler TestHooks::stacked_handlers2::push_handlers | |
171 | 183 | |
172 | 184 | # 2 run, 2 left behind |
173 | 185 | PerlResponseHandler TestHooks::stacked_handlers2::declined TestHooks::stacked_handlers2 |
60 | 60 | my ($phase, $s) = @_; |
61 | 61 | |
62 | 62 | 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; | |
63 | 68 | |
64 | 69 | my $port = $s->port; |
65 | 70 | 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 | } |
25 | 25 | ran 2 PerlAuthenHandler handlers |
26 | 26 | ran 2 PerlAuthzHandler handlers |
27 | 27 | ran 1 PerlTypeHandler handlers |
28 | ran 2 PerlFixupHandler handlers | |
28 | ran 4 PerlFixupHandler handlers | |
29 | 29 | ran 2 PerlResponseHandler handlers |
30 | 30 | ran 2 PerlOutputFilterHandler handlers!; |
31 | 31 |
0 | TestAddConfig Htaccess |
17 | 17 | use constant OSX => Apache::TestConfig::OSX; |
18 | 18 | |
19 | 19 | 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'); | |
20 | 21 | |
21 | 22 | use APR::Const -compile => qw(SUCCESS FINFO_NORM FILETYPE_REG |
22 | 23 | FPROT_WREAD FPROT_WWRITE |
28 | 29 | |
29 | 30 | sub test { |
30 | 31 | |
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'; | |
48 | 37 | |
49 | 38 | my $pool = APR::Pool->new(); |
50 | 39 | # populate the finfo struct first |
144 | 133 | |
145 | 134 | # match world bits |
146 | 135 | |
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 | } | |
155 | 155 | if (WIN32) { |
156 | 156 | skip "different file semantics", 0; |
157 | 157 | } |
306 | 306 | # - copy |
307 | 307 | # - overlay |
308 | 308 | { |
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); | |
310 | 317 | $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); | |
314 | 319 | { |
315 | 320 | # verify that the temp pool used to create $table_copy was |
316 | 321 | # not freed, by allocating a new table to fill with a |
324 | 329 | } |
325 | 330 | ok t_cmp $table_copy->get(20), 20, "no segfault/valid data"; |
326 | 331 | |
327 | my $table2 = APR::Table::make(APR::Pool->new, 1); | |
332 | my $table2 = APR::Table::make($pool, 1); | |
328 | 333 | $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); | |
330 | 338 | { |
331 | 339 | # see the comment for above's: |
332 | 340 | # $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 |
12 | 12 | 'footer', |
13 | 13 | ); |
14 | 14 | |
15 | plan tests => 2 + @patterns, need need_module('include', 'mod_mime'), | |
15 | plan tests => 2 + @patterns, need need_module('mod_include', 'mod_mime'), | |
16 | 16 | need_min_module_version(CGI => 3.08); |
17 | 17 | |
18 | 18 | my $location = "/includes/test.shtml"; |
9 | 9 | |
10 | 10 | t_debug("connecting to $url"); |
11 | 11 | |
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)), | |
13 | 13 | need_access; |
14 | 14 | |
15 | 15 | my $expected = "ok"; |
20 | 20 | # blocking socket bug fixed in 2.0.52 |
21 | 21 | my $ok = $^O !~ /^(Open|Net)BSD$/i || need_min_apache_version('2.0.52'); |
22 | 22 | |
23 | # but not in 2.1? hmph. | |
24 | $ok = skip_reason('skipping on httpd 2.1') if have_min_apache_version('2.1'); | |
25 | ||
26 | 23 | plan tests => 13, need need_auth, need_access, $ok; |
27 | 24 | |
28 | 25 | { |
31 | 28 | my $socket = Apache::TestRequest::vhost_socket($module); |
32 | 29 | ok $socket; |
33 | 30 | |
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 | } | |
41 | 80 | } |
42 | 81 | |
43 | 82 | { |
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 | |
46 | 85 | my $socket = Apache::TestRequest::vhost_socket($module); |
47 | 86 | ok $socket; |
48 | 87 | |
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 | } | |
54 | 122 | } |
55 | 123 | |
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 | ||
58 | 131 | chomp(my $recv = <$socket> || ''); |
59 | ok t_cmp($recv, $expect, $action); | |
132 | t_debug("recv: $recv"); | |
133 | ||
134 | return $recv; | |
60 | 135 | } |
61 | 136 | |
62 | sub expect_reply { | |
63 | my ($socket, $expect, $reply, $action) = @_; | |
137 | sub getline { | |
138 | my ($socket) = @_; | |
139 | ||
64 | 140 | 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; | |
68 | 144 | } |
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> |
19 | 19 | my ($code, $string) = split /=/, $r->args || ''; |
20 | 20 | |
21 | 21 | 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); | |
23 | 25 | $r->status_line("$code $string"); |
24 | 26 | } |
25 | 27 | 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 |
11 | 11 | |
12 | 12 | use ModPerl::Util (); |
13 | 13 | 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); | |
15 | 15 | |
16 | 16 | use File::Spec::Functions qw(catfile canonpath); |
17 | ||
18 | sub fixup { | |
19 | my $r = shift; | |
20 | Apache->httpd_conf('Options +ExecCGI'); | |
21 | OK; | |
22 | } | |
17 | 23 | |
18 | 24 | sub handler { |
19 | 25 | my $r = shift; |
74 | 80 | ok t_cmp(OK, "0", |
75 | 81 | 'OK'); |
76 | 82 | |
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'); | |
82 | 85 | |
83 | 86 | # (Apache||$r)->server_root_relative |
84 | 87 | { |
123 | 126 | |
124 | 127 | __END__ |
125 | 128 | # 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 |
3 | 3 | use warnings FATAL => 'all'; |
4 | 4 | |
5 | 5 | use Apache::Test; |
6 | use Apache::TestRequest; | |
6 | 7 | use Apache::TestUtil; |
7 | 8 | use Apache2::Const -compile => 'OK'; |
8 | 9 | use Apache2::PerlSections; |
10 | 11 | sub handler { |
11 | 12 | my $r = shift; |
12 | 13 | |
13 | plan $r, tests => 16; | |
14 | plan $r, tests => 22, need_module('mod_alias'); | |
14 | 15 | |
15 | 16 | ok t_cmp('yes', $TestDirective::perl::worked); |
16 | 17 | |
51 | 52 | ok t_cmp($@, "", "PerlSections dump syntax check"); |
52 | 53 | |
53 | 54 | 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 | ||
55 | 71 | Apache2::Const::OK; |
56 | 72 | } |
57 | 73 |
53 | 53 | } |
54 | 54 | |
55 | 55 | ok ! $ENV{FOO}; |
56 | skip "r->subprocess_env + local() doesnt fully work yet", 1; | |
56 | 57 | #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 | |
62 | 58 | |
63 | 59 | { |
64 | 60 | 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> |
3 | 3 | use warnings FATAL => 'all'; |
4 | 4 | |
5 | 5 | use Apache2::RequestUtil (); |
6 | use Apache2::ConnectionUtil (); | |
6 | 7 | |
7 | 8 | use Apache::Test; |
8 | 9 | use Apache::TestUtil; |
12 | 13 | sub handler { |
13 | 14 | my $r = shift; |
14 | 15 | |
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; | |
16 | 22 | |
17 | ok $r->pnotes; | |
23 | my $c = $r->connection; | |
18 | 24 | |
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 | } | |
22 | 41 | |
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')); | |
26 | 45 | |
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}) { | |
28 | 48 | |
29 | ok t_cmp($r->pnotes()->{'pnotes_foo'}, 'pnotes_bar', | |
30 | q{$r->pnotes()->{}}); | |
49 | my $type = $map->{type}; | |
31 | 50 | |
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}; | |
39 | 52 | |
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'); | |
45 | 118 | |
46 | 119 | Apache2::Const::OK; |
47 | 120 | } |
46 | 46 | http://marc.theaimsgroup.com/?l=apache-modperl&m=108334017416318&w=2 |
47 | 47 | Static works OK! |
48 | 48 | |
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 | ||
49 | 57 | * Need to cleanup functions only needed for certain build flavors |
50 | 58 | (perlio/threads/etc) out of lib/ModPerl/WrapXS.pm:$ithread_exports |
51 | 59 | and use the newer, simpler #ifdef technique (see modperl_io_apache_init |
0 | 0 | ################# |
1 | 1 | # mod_perl bugs # |
2 | 2 | ################# |
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] | |
3 | 25 | |
4 | 26 | * early pool destruction issues |
5 | 27 | http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108872944815382&w=2 |
28 | 50 | possible solution: add a new field to the map files, which will be |
29 | 51 | used as a usage message whenever an argument error occurs. |
30 | 52 | |
31 | ||
32 | 53 | * 'SetHandler modperl' doesn't reset $|, so if anything turns it on |
33 | 54 | anywhere, it's going to stay that way. Meaning excessive flushing |
34 | 55 | probably causing a performance hit. I've tried to add the code to |
47 | 68 | tied objects. |
48 | 69 | |
49 | 70 | |
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. | |
55 | 71 | |
56 | 72 | * Apache::Log compat issues: |
57 | 73 |
79 | 79 | * mod_perl::import |
80 | 80 | - Apache->import: |
81 | 81 | 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 | |
82 | 84 | |
83 | 85 | * Apache::test: tobe a compat stub around new test framework |
84 | 86 |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
12 | 12 | use constant SOLARIS => $^O eq 'solaris'; |
13 | 13 | use constant BUILD_APREXT => Apache2::Build::BUILD_APREXT; |
14 | 14 | |
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'; | |
19 | 21 | |
20 | 22 | my $libs = ''; |
23 | $libs = delete $args{LIBS} if $args{LIBS}; | |
24 | ||
21 | 25 | my $build = ModPerl::BuildMM::build_config(); |
22 | 26 | |
23 | 27 | my @apru_link_flags = $build->apru_link_flags; |
25 | 29 | |
26 | 30 | if (WIN32) { |
27 | 31 | $libs =~ s{/libpath:}{-L}g; |
28 | $libs =~ s{(\w+)\.lib}{-l$1}g; | |
32 | $libs =~ s{(\S+)\.lib}{-l$1}g; | |
29 | 33 | } |
30 | 34 | |
31 | 35 | if (BUILD_APREXT) { |
52 | 56 | |
53 | 57 | # -R makes sure that these paths will be used |
54 | 58 | $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'); | |
56 | 62 | |
57 | 63 | # -R are now copied to LDDFLAGS, but leave -L's in LIBS -- |
58 | 64 | # 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
79 | 80 | errmsg = |
80 | 81 | modperl_config_insert_request(aTHX_ r, |
81 | 82 | newRV_noinc((SV*)config), |
82 | OR_AUTHCFG); | |
83 | OR_AUTHCFG, NULL, | |
84 | MP_HTTPD_OVERRIDE_OPTS_UNSET); | |
83 | 85 | |
84 | 86 | if (errmsg) { |
85 | 87 | Perl_warn(aTHX_ "Can't change %s to '%s'\n", directive, val); |
139 | 141 | } |
140 | 142 | }); |
141 | 143 | } |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
34 | 35 | Perl_croak(aTHX_ "$parms->add_config() has failed: %s", errmsg); |
35 | 36 | } |
36 | 37 | } |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
211 | 212 | SV *mpxs_Apache2__RequestRec_pnotes(pTHX_ request_rec *r, SV *key, SV *val) |
212 | 213 | { |
213 | 214 | MP_dRCFG; |
214 | SV *retval = NULL; | |
215 | 215 | |
216 | 216 | if (!rcfg) { |
217 | 217 | return &PL_sv_undef; |
218 | 218 | } |
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); | |
240 | 221 | } |
241 | 222 | |
242 | 223 | #define mpxs_Apache2__RequestRec_dir_config(r, key, sv_val) \ |
301 | 282 | } |
302 | 283 | |
303 | 284 | 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) | |
305 | 288 | { |
306 | 289 | const char *errmsg = modperl_config_insert_request(aTHX_ r, lines, |
307 | override); | |
290 | override, path, | |
291 | override_options); | |
308 | 292 | if (errmsg) { |
309 | 293 | Perl_croak(aTHX_ "$r->add_config() has failed: %s", errmsg); |
310 | 294 | } |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
11 | 12 | * See the License for the specific language governing permissions and |
12 | 13 | * limitations under the License. |
13 | 14 | */ |
15 | ||
16 | #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) | |
17 | #include "unixd.h" | |
18 | #endif | |
14 | 19 | |
15 | 20 | #define mpxs_Apache2__ServerUtil_restart_count modperl_restart_count |
16 | 21 | |
150 | 155 | |
151 | 156 | #define mpxs_Apache2__ServerUtil_server(classname) modperl_global_get_server_rec() |
152 | 157 | |
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 | ||
153 | 166 | static MP_INLINE |
154 | 167 | int mpxs_Apache2__ServerRec_is_perl_option_enabled(pTHX_ server_rec *s, |
155 | 168 | const char *name) |
161 | 174 | static MP_INLINE |
162 | 175 | void mpxs_Apache2__ServerRec_add_config(pTHX_ server_rec *s, SV *lines) |
163 | 176 | { |
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); | |
165 | 182 | if (errmsg) { |
166 | 183 | Perl_croak(aTHX_ "$s->add_config() has failed: %s", errmsg); |
167 | 184 | } |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | # |
6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | # |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
46 | 46 | undef &$fullname; |
47 | 47 | } |
48 | 48 | if (*{$fullname}{IO}) { |
49 | if (fileno $fullname) { | |
50 | close $fullname; | |
51 | } | |
49 | local $@; | |
50 | eval { | |
51 | if (fileno $fullname) { | |
52 | close $fullname; | |
53 | } | |
54 | }; | |
52 | 55 | } |
53 | 56 | } |
54 | 57 |
245 | 245 | < cmd |
246 | 246 | < context |
247 | 247 | ! err_directive |
248 | - override_opts | |
248 | 249 | </cmd_parms> |
249 | 250 | |
250 | 251 | !<ap_mgmt_item_t> |
29 | 29 | mpxs_Apache2__RequestRec_location |
30 | 30 | mpxs_Apache2__RequestRec_as_string |
31 | 31 | 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 | |
33 | 33 | mpxs_Apache2__RequestRec_document_root | | r, new_root=Nullsv |
34 | 34 | mpxs_Apache2__RequestRec_child_terminate |
35 | 35 | |
86 | 86 | |
87 | 87 | MODULE=Apache2::ServerUtil PACKAGE=Apache2::ServerUtil |
88 | 88 | 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 | |
89 | 91 | |
90 | 92 | MODULE=Apache2::Connection |
91 | 93 | 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 | |
92 | 97 | |
93 | 98 | MODULE=Apache2::Filter |
94 | 99 | modperl_filter_attributes | MPXS_ | ... | MODIFY_CODE_ATTRIBUTES |
149 | 154 | ap_method_is_limited |
150 | 155 | mpxs_Apache2__CmdParms_info |
151 | 156 | mpxs_Apache2__CmdParms_add_config |
157 | mpxs_Apache2__CmdParms_override_opts | |
152 | 158 | |
153 | 159 | MODULE=Apache2::MPM PACKAGE=Apache2::MPM BOOT=1 |
154 | 160 | 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 | |
5 | 6 | * |
6 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
7 | 8 | * |
1370 | 1370 | 'name' => 'path' |
1371 | 1371 | }, |
1372 | 1372 | { |
1373 | 'type' => 'int', | |
1374 | 'name' => 'override_options' | |
1375 | }, | |
1376 | { | |
1373 | 1377 | 'type' => 'ap_conf_vector_t *', |
1374 | 1378 | 'name' => 'conf' |
1375 | 1379 | }, |
1416 | 1420 | { |
1417 | 1421 | 'type' => 'int', |
1418 | 1422 | 'name' => 'override' |
1423 | }, | |
1424 | { | |
1425 | 'type' => 'char *', | |
1426 | 'name' => 'path' | |
1427 | }, | |
1428 | { | |
1429 | 'type' => 'int', | |
1430 | 'name' => 'override_options' | |
1419 | 1431 | } |
1420 | 1432 | ] |
1421 | 1433 | }, |
1476 | 1488 | { |
1477 | 1489 | 'type' => 'request_rec *', |
1478 | 1490 | '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' | |
1479 | 1501 | } |
1480 | 1502 | ] |
1481 | 1503 | }, |
4400 | 4422 | ] |
4401 | 4423 | }, |
4402 | 4424 | { |
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 | { | |
4403 | 4451 | 'return_type' => 'int', |
4404 | 4452 | 'name' => 'modperl_post_config_handler', |
4405 | 4453 | 'args' => [ |
6104 | 6152 | ] |
6105 | 6153 | }, |
6106 | 6154 | { |
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 | { | |
6107 | 6169 | 'return_type' => 'void', |
6108 | 6170 | 'name' => 'mpxs_Apache2__Connection_add_input_filter', |
6109 | 6171 | 'args' => [ |
6181 | 6243 | }, |
6182 | 6244 | { |
6183 | 6245 | '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 *', | |
6184 | 6268 | 'name' => 'mpxs_Apache2__Directive_as_hash', |
6185 | 6269 | 'attr' => [ |
6186 | 6270 | 'static', |
6635 | 6719 | { |
6636 | 6720 | 'type' => 'int', |
6637 | 6721 | 'name' => 'override' |
6722 | }, | |
6723 | { | |
6724 | 'type' => 'char *', | |
6725 | 'name' => 'path' | |
6726 | }, | |
6727 | { | |
6728 | 'type' => 'int', | |
6729 | 'name' => 'override_options' | |
6638 | 6730 | } |
6639 | 6731 | ] |
6640 | 6732 | }, |
6671 | 6763 | { |
6672 | 6764 | 'type' => 'SV *', |
6673 | 6765 | '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' | |
6674 | 6780 | } |
6675 | 6781 | ] |
6676 | 6782 | }, |