Return-Path: Delivered-To: apmail-perl-modperl-cvs-archive@perl.apache.org Received: (qmail 53379 invoked by uid 500); 24 Apr 2003 04:32:36 -0000 Mailing-List: contact modperl-cvs-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@perl.apache.org Delivered-To: mailing list modperl-cvs@perl.apache.org Received: (qmail 53368 invoked by uid 500); 24 Apr 2003 04:32:36 -0000 Delivered-To: apmail-modperl-2.0-cvs@apache.org Date: 24 Apr 2003 04:32:34 -0000 Message-ID: <20030424043234.10425.qmail@icarus.apache.org> From: stas@apache.org To: modperl-2.0-cvs@apache.org Subject: cvs commit: modperl-2.0/t/filter/TestFilter in_str_consume.pm X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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); } }