stas        2004/02/09 10:18:16

  Modified:    lib/ModPerl Code.pm
               src/modules/perl modperl_cmd.c modperl_cmd.h
               t/filter/TestFilter in_bbs_inject_header.pm in_bbs_msg.pm
                        in_str_msg.pm
               todo     release
               .        Changes
  Log:
  Perl(Input|Output)FilterHandler handlers are now always AutoLoaded, as
  if '+' prefix was used. This must be performed to get the access to
  filter attributes long before the filter itself is executed.
  + tests
  
  Revision  Changes    Path
  1.115     +11 -1     modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -u -r1.114 -r1.115
  --- Code.pm   28 Oct 2003 20:23:45 -0000      1.114
  +++ Code.pm   9 Feb 2004 18:18:15 -0000       1.115
  @@ -66,6 +66,15 @@
       },
   );
   
  +my %cmd_push = (
  +    InputFilter  => 'modperl_cmd_push_filter_handlers',
  +    OutputFilter => 'modperl_cmd_push_filter_handlers',
  +);
  +my $cmd_push_default = 'modperl_cmd_push_handlers';
  +sub cmd_push {
  +    $cmd_push{+shift} || $cmd_push_default;
  +}
  +
   $hook_proto{PerDir} = $hook_proto{PerSrv};
   
   my $scfg_get = 'MP_dSCFG(parms->server)';
  @@ -320,6 +329,7 @@
               my $flag = 'MpSrv' . canon_uc($h);
               my $ix = $self->{handler_index}->{$class}->[$i++];
               my $av = "$prototype->{handlers} [$ix]";
  +            my $cmd_push = cmd_push($h);
   
               print $h_fh "$protostr;\n";
   
  @@ -347,7 +357,7 @@
                              parms->server->server_hostname, NULL);
       }
       MP_TRACE_d(MP_FUNC, "push [EMAIL PROTECTED], %s\\n", parms->cmd->name, arg);
  -    return modperl_cmd_push_handlers(&($av), arg, parms->pool);
  +    return $cmd_push(&($av), arg, parms->pool);
   }
   EOF
           }
  
  
  
  1.54      +35 -0     modperl-2.0/src/modules/perl/modperl_cmd.c
  
  Index: modperl_cmd.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -u -r1.53 -r1.54
  --- modperl_cmd.c     22 Jan 2004 21:55:49 -0000      1.53
  +++ modperl_cmd.c     9 Feb 2004 18:18:16 -0000       1.54
  @@ -66,6 +66,41 @@
       return NULL;
   }
   
  +char *modperl_cmd_push_filter_handlers(MpAV **handlers,
  +                                       const char *name,
  +                                       apr_pool_t *p)
  +{
  +    modperl_handler_t *h = modperl_handler_new(p, name);
  +
  +    /* filter modules need to be autoloaded, because their attributes
  +     * need to be known long before the callback is issued
  +     */
  +    if (*name == '-') {
  +        MP_TRACE_h(MP_FUNC,
  +                   "[%s] warning: filter handler %s will be not autoloaded. "
  +                   "Unless the module defining this handler is explicitly "
  +                   "preloaded, filter attributes will be ignored.\n",
  +                   modperl_pid_tid(p), h->name);
  +    }
  +    else {
  +        MpHandlerAUTOLOAD_On(h);
  +        MP_TRACE_h(MP_FUNC,
  +                   "[%s] filter handler %s will be autoloaded (to make "
  +                   "the filter attributes available)\n",
  +                   modperl_pid_tid(p), h->name);
  +    }
  +    
  +    if (!*handlers) {
  +        *handlers = modperl_handler_array_new(p);
  +        MP_TRACE_d(MP_FUNC, "created handler stack\n");
  +    }
  +
  +    modperl_handler_array_push(*handlers, h);
  +    MP_TRACE_d(MP_FUNC, "pushed httpd filter handler: %s\n", h->name);
  +
  +    return NULL;
  +}
  +
   char *modperl_cmd_push_httpd_filter_handlers(MpAV **handlers,
                                                const char *name,
                                                apr_pool_t *p)
  
  
  
  1.22      +4 -0      modperl-2.0/src/modules/perl/modperl_cmd.h
  
  Index: modperl_cmd.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -u -r1.21 -r1.22
  --- modperl_cmd.h     3 Apr 2003 06:23:53 -0000       1.21
  +++ modperl_cmd.h     9 Feb 2004 18:18:16 -0000       1.22
  @@ -4,6 +4,10 @@
   char *modperl_cmd_push_handlers(MpAV **handlers, const char *name,
                                   apr_pool_t *p);
   
  +char *modperl_cmd_push_filter_handlers(MpAV **handlers,
  +                                       const char *name,
  +                                       apr_pool_t *p);
  +
   char *modperl_cmd_push_httpd_filter_handlers(MpAV **handlers,
                                                const char *name,
                                                apr_pool_t *p);
  
  
  
  1.3       +0 -2      modperl-2.0/t/filter/TestFilter/in_bbs_inject_header.pm
  
  Index: in_bbs_inject_header.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_inject_header.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- in_bbs_inject_header.pm   7 Oct 2003 01:04:13 -0000       1.2
  +++ in_bbs_inject_header.pm   9 Feb 2004 18:18:16 -0000       1.3
  @@ -208,8 +208,6 @@
   __END__
   <NoAutoConfig>
   <VirtualHost TestFilter::in_bbs_inject_header>
  -  # must be preloaded so the FilterConnectionHandler attributes will
  -  # be set by the time the filter is inserted into the filter chain
     PerlModule TestFilter::in_bbs_inject_header
     PerlInputFilterHandler TestFilter::in_bbs_inject_header
     <Location /TestFilter__in_bbs_inject_header>
  
  
  
  1.6       +0 -2      modperl-2.0/t/filter/TestFilter/in_bbs_msg.pm
  
  Index: in_bbs_msg.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_msg.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- in_bbs_msg.pm     8 Jan 2004 23:36:56 -0000       1.5
  +++ in_bbs_msg.pm     9 Feb 2004 18:18:16 -0000       1.6
  @@ -80,8 +80,6 @@
   __END__
   <NoAutoConfig>
   <VirtualHost TestFilter::in_bbs_msg>
  -  # must be preloaded so the FilterConnectionHandler attributes will
  -  # be set by the time the filter is inserted into the filter chain
     PerlModule TestFilter::in_bbs_msg
     PerlInputFilterHandler TestFilter::in_bbs_msg
   
  
  
  
  1.5       +0 -2      modperl-2.0/t/filter/TestFilter/in_str_msg.pm
  
  Index: in_str_msg.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_str_msg.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- in_str_msg.pm     18 Apr 2003 06:18:57 -0000      1.4
  +++ in_str_msg.pm     9 Feb 2004 18:18:16 -0000       1.5
  @@ -48,8 +48,6 @@
   1;
   __END__
   <VirtualHost TestFilter::in_str_msg>
  -  # must be preloaded so the FilterConnectionHandler attributes will
  -  # be set by the time the filter is inserted into the filter chain
     PerlModule TestFilter::in_str_msg
     PerlInputFilterHandler TestFilter::in_str_msg
   
  
  
  
  1.9       +0 -21     modperl-2.0/todo/release
  
  Index: release
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/release,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- release   14 Jan 2004 21:27:41 -0000      1.8
  +++ release   9 Feb 2004 18:18:16 -0000       1.9
  @@ -42,27 +42,6 @@
       Apache->server->process->pconf->cleanup_register(sub { ...  });
     Report: geoff
   
  -
  -* Looks like there is an issue with filter configuration, I've noticed that:
  -
  -   PerlInputFilterHandler MyApache::InputFilterGET2HEAD
  -
  -  silently ignores the filter, whereas:
  -  ^^^^^^^^^^^^^^^^
  -   PerlInputFilterHandler +MyApache::InputFilterGET2HEAD
  -
  -  calls the filter. figure out:
  -
  -  - why the loading doesn't happen
  -  - why the error doesn't happen (probably both connected)
  -
  -* Currently modperl_filter_add_{connection|request} check the filter
  -  handler function attrs before accepting the filter. If the module
  -  wasn't preloaded the check fails and filter handler is skipped. We
  -  could have this issue documented (which is OK, but might raise too
  -  many questions), but we could also always preload the filter
  -  handlers. To test see TestFilter::input_msg
  -
   * child processes never run END blocks. a good example is
     Apache::TestUtil, which doesn't cleanup files and dirs it has
     created, because the END block is not run.
  
  
  
  1.318     +4 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.317
  retrieving revision 1.318
  diff -u -u -r1.317 -r1.318
  --- Changes   31 Jan 2004 10:06:59 -0000      1.317
  +++ Changes   9 Feb 2004 18:18:16 -0000       1.318
  @@ -12,6 +12,10 @@
   
   =item 1.99_13-dev
   
  +Perl(Input|Output)FilterHandler handlers are now always AutoLoaded, as
  +if '+' prefix was used. This must be performed to get the access to
  +filter attributes long before the filter itself is executed. [Stas]
  +
   APR.xs has been reimplemented.  The problem with the previous
   implementation is that a dead perl pool object could hijack a newly
   created pool, which didn't belong to that object, but which happened
  
  
  

Reply via email to