perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/t/filter/TestFilter in_str_consume.pm
Date Thu, 24 Apr 2003 04:32:34 GMT
stas        2003/04/23 21:32:34

  Modified:    t/filter/TestFilter in_str_consume.pm
  Log:
  this is not needed in newer Apache versions, however older versions
  (2.0.40) will repeatedly call this filter, waiting for EOS which will
  never come from this filter so, after several invocations mark the
  seen_eos flag, to break the vicious cirle
  
  Revision  Changes    Path
  1.5       +16 -4     modperl-2.0/t/filter/TestFilter/in_str_consume.pm
  
  Index: in_str_consume.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_str_consume.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- in_str_consume.pm	31 Mar 2003 01:50:51 -0000	1.4
  +++ in_str_consume.pm	24 Apr 2003 04:32:34 -0000	1.5
  @@ -2,8 +2,8 @@
   
   # this test verifies that streaming filters framework handles
   # gracefully the case when a filter doesn't print anything at all to
  -# the caller. I figure it's absolutely doesn't matter if the incoming
  -# bb from the upstream is consumed or not. What matter is that the
  +# the caller. I figure it absolutely doesn't matter if the incoming
  +# bb from the upstream is consumed or not. What matters is that the
   # filter sends something downstream (an empty bb will do).
   #
   # e.g. a filter that cleans up the incoming stream (extra spaces?)
  @@ -25,9 +25,9 @@
   sub handler {
       my $filter = shift;
   
  -    my $ctx = $filter->ctx;
  +    my $count = $filter->ctx || 0;
   
  -    unless ($ctx) {
  +    unless ($count) {
           # read a bit from the first brigade and leave the second
           # brigade completely unconsumed. we assume that there are two
           # brigades because the core input filter will split data in
  @@ -40,9 +40,21 @@
           $filter->ctx(1);
       }
       else {
  +        $count++;
  +        #warn "FILTER CALLED post $count time\n";
           unless ($filter->seen_eos) {
               # XXX: comment out the next line to reproduce the segfault
               $filter->print("");
  +            $filter->ctx($count);
  +        }
  +
  +        # this is not needed in newer Apache versions, however older
  +        # versions (2.0.40) will repeatedly call this filter, waiting
  +        # for EOS which will never come from this filter so, after
  +        # several invocations mark the seen_eos flag, to break the
  +        # vicious cirle
  +        if ($count > 10) {
  +            $filter->seen_eos(1);
           }
       }
   
  
  
  

Mime
View raw message