stas 2003/06/06 02:24:46 Modified: src/docs/2.0/user/handlers filters.pod http.pod protocols.pod server.pod src/docs/2.0/user/intro start_fast.pod Log: various tidying up fixes Revision Changes Path 1.31 +2 -2 modperl-docs/src/docs/2.0/user/handlers/filters.pod Index: filters.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/filters.pod,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- filters.pod 28 May 2003 04:14:28 -0000 1.30 +++ filters.pod 6 Jun 2003 09:24:46 -0000 1.31 @@ -110,8 +110,8 @@ use warnings; use Apache::Filter (); - use Apache::RequestRec(); - use APR::Table; + use Apache::RequestRec (); + use APR::Table (); use Apache::Const -compile => qw(OK); 1.21 +7 -3 modperl-docs/src/docs/2.0/user/handlers/http.pod Index: http.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/http.pod,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- http.pod 30 May 2003 03:47:07 -0000 1.20 +++ http.pod 6 Jun 2003 09:24:46 -0000 1.21 @@ -1202,8 +1202,10 @@ =head2 PerlCleanupHandler -The cleanup stage is used to execute some code immediately after the -request has been served (the client went away). +There is no I<cleanup> Apache phase, it exists only inside mod_perl. +It is used to execute some code immediately after the request has been +served (the client went away) and before the request object is +destroyed. There are several usages for this use phase. The obvious one is to run a cleanup code, for example removing temporarily created files. The @@ -1300,6 +1302,7 @@ return Apache::OK; } + 1; Next we add the following configuration: @@ -1312,7 +1315,7 @@ current directory will be printed and once the request is over the temporary file is deleted. -This response handler has a problem of running in a multiprocess +This response handler has a problem of running in a multi-process environment, since it uses the same file, and several processes may try to read/write/delete that file at the same time, wrecking havoc. We could have appended the process id C<$$> to the file's name, @@ -1396,6 +1399,7 @@ return Apache::OK; } + 1; Similarly to the first handler, we add the configuration: 1.8 +9 -6 modperl-docs/src/docs/2.0/user/handlers/protocols.pod Index: protocols.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/protocols.pod,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- protocols.pod 29 May 2003 07:17:11 -0000 1.7 +++ protocols.pod 6 Jun 2003 09:24:46 -0000 1.8 @@ -95,18 +95,21 @@ return Apache::OK; } -A good I<pre_connection> phase example is to have a facility to block -remote clients by their IP before too many resources were used. This -is almost as good as a firewall blocking, before Apache has started to -do any work at all. +Here is a useful I<pre_connection> phase example: provide a facility +to block remote clients by their IP, before too many resources were +consumed. This is almost as good as a firewall blocking, as it's +executed before Apache has started to do any work at all. C<MyApache::BlockIP2> retrieves client's remote IP and looks it up in the black list (which should certainly live outside the code, e.g. dbm file, but a hardcoded list is good enough for our example). - #file:/MyApache/BlockIP2.pm - #-------------------------- + #file:MyApache/BlockIP2.pm + #------------------------- package MyApache::BlockIP2; + + use strict; + use warnings; use Apache::Connection (); 1.7 +15 -15 modperl-docs/src/docs/2.0/user/handlers/server.pod Index: server.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/server.pod,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- server.pod 6 Mar 2003 04:32:06 -0000 1.6 +++ server.pod 6 Jun 2003 09:24:46 -0000 1.7 @@ -130,21 +130,21 @@ the following is getting logged to I<logs/startup_log>: - [Thu Aug 22 15:57:08 2002] - open_logs : process 21823 is born to reproduce - [Thu Aug 22 15:57:08 2002] - post_config: configuration is completed - [Thu Aug 22 15:57:09 2002] - END : process 21823 is shutdown + [Thu May 29 13:11:08 2003] - open_logs : process 21823 is born to reproduce + [Thu May 29 13:11:08 2003] - post_config: configuration is completed + [Thu May 29 13:11:09 2003] - END : process 21823 is shutdown - [Thu Aug 22 15:57:10 2002] - open_logs : process 21825 is born to reproduce - [Thu Aug 22 15:57:10 2002] - post_config: configuration is completed - [Thu Aug 22 15:57:11 2002] - child_init : process 21830 is born to serve - [Thu Aug 22 15:57:11 2002] - child_init : process 21831 is born to serve - [Thu Aug 22 15:57:11 2002] - child_init : process 21832 is born to serve - [Thu Aug 22 15:57:11 2002] - child_init : process 21833 is born to serve - [Thu Aug 22 15:57:12 2002] - child_exit : process 21833 now exits - [Thu Aug 22 15:57:12 2002] - child_exit : process 21832 now exits - [Thu Aug 22 15:57:12 2002] - child_exit : process 21831 now exits - [Thu Aug 22 15:57:12 2002] - child_exit : process 21830 now exits - [Thu Aug 22 15:57:12 2002] - END : process 21825 is shutdown + [Thu May 29 13:11:10 2003] - open_logs : process 21825 is born to reproduce + [Thu May 29 13:11:10 2003] - post_config: configuration is completed + [Thu May 29 13:11:11 2003] - child_init : process 21830 is born to serve + [Thu May 29 13:11:11 2003] - child_init : process 21831 is born to serve + [Thu May 29 13:11:11 2003] - child_init : process 21832 is born to serve + [Thu May 29 13:11:11 2003] - child_init : process 21833 is born to serve + [Thu May 29 13:11:12 2003] - child_exit : process 21833 now exits + [Thu May 29 13:11:12 2003] - child_exit : process 21832 now exits + [Thu May 29 13:11:12 2003] - child_exit : process 21831 now exits + [Thu May 29 13:11:12 2003] - child_exit : process 21830 now exits + [Thu May 29 13:11:12 2003] - END : process 21825 is shutdown First of all, we can clearly see that Apache always restart itself after the first I<post_config> phase is over. The logs show that the @@ -188,7 +188,7 @@ As we have seen in the C<L<MyApache::StartupLog::open_logs|/Startup_Phases_Demonstration_Module>> handler, the I<open_logs> phase handlers accept four arguments: the -configuration pool, the logging streams pool, the temporary pool and +configuration pool, the logging stream pool, the temporary pool and the server object: sub open_logs { 1.14 +2 -3 modperl-docs/src/docs/2.0/user/intro/start_fast.pod Index: start_fast.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/intro/start_fast.pod,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- start_fast.pod 11 Apr 2003 02:24:37 -0000 1.13 +++ start_fast.pod 6 Jun 2003 09:24:46 -0000 1.14 @@ -84,10 +84,9 @@ Check I<$HOME/httpd/prefork/logs/error_log> to see that the server has started and it's a right one. It should say something similar to: - [Tue Sep 03 12:34:57 2002] [notice] Apache/2.0.44 (Unix) - mod_perl/1.99_07 Perl/v5.8.0 mod_ssl/2.0.44 OpenSSL/0.9.6g + [Thu May 29 12:22:12 2003] [notice] Apache/2.0.46-dev (Unix) + mod_perl/1.99_10-dev Perl/v5.9.0 mod_ssl/2.0.46-dev OpenSSL/0.9.7 DAV/2 configured -- resuming normal operations - =head1 Registry Scripts
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]