stas 2003/03/02 02:30:56
Modified: src/modules/perl modperl_filter.c . Changes Added: t/filter in_str_declined.t t/filter/TestFilter in_str_declined.pm Log: fix the input filters handling of DECLINED handlers (consume the data, on behalf of the handler) + tests Revision Changes Path 1.1 modperl-2.0/t/filter/in_str_declined.t Index: in_str_declined.t =================================================================== use strict; use warnings FATAL => 'all'; use Apache::TestRequest; my $location = '/TestFilter::in_str_declined'; my $chunk = "1234567890"; my $data = $chunk x 2000; my $res = POST $location, content => $data; if ($res->is_success) { print $res->content; } else { die "server side has failed (response code: ", $res->code, "),\n", "see t/logs/error_log for more details\n"; } 1.1 modperl-2.0/t/filter/TestFilter/in_str_declined.pm Index: in_str_declined.pm =================================================================== package TestFilter::in_str_declined; use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestUtil; use Apache::Filter (); use Apache::Const -compile => qw(OK DECLINED M_POST); # make sure that if the input filter returns DECLINED without # reading/printing data the data flow is not broken sub handler { my $filter = shift; my $ctx = $filter->ctx; $ctx->{invoked}++; $filter->ctx($ctx); # can't use $f->seen_eos, since we don't read the data, so # we have to set the note on each invocation $filter->r->notes->set(invoked => $ctx->{invoked}); #warn "filter was invoked $ctx->{invoked} times\n"; return Apache::DECLINED; } sub response { my $r = shift; plan $r, tests => 1; $r->content_type('text/plain'); if ($r->method_number == Apache::M_POST) { # consume the data so the input filter is invoked my $data = ModPerl::Test::read_post($r); } # ~20k of input: makes it four bucket briages # 2 full bucket brigades of 8k # 1 half full brigade <8k # eos bucket brigade my $expected = 4; my $invoked = $r->notes->get('invoked') || 0; ok t_cmp($expected, $invoked, "input stream filter declined"); Apache::OK; } 1; __DATA__ SetHandler modperl PerlResponseHandler TestFilter::in_str_declined::response 1.53 +2 -1 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- modperl_filter.c 8 Feb 2003 04:36:35 -0000 1.52 +++ modperl_filter.c 2 Mar 2003 10:30:56 -0000 1.53 @@ -598,8 +598,9 @@ switch (status) { case OK: - case DECLINED: return APR_SUCCESS; + case DECLINED: + return ap_get_brigade(f->next, bb, input_mode, block, readbytes); default: return status; /*XXX*/ } 1.136 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- Changes 1 Mar 2003 00:53:20 -0000 1.135 +++ Changes 2 Mar 2003 10:30:56 -0000 1.136 @@ -10,6 +10,9 @@ =item 1.99_09-dev +fix the input filters handling of DECLINED handlers (consume the data, +on behalf of the handler) + tests [Stas] + fix the code that autogenerates modperl_largefiles.h not to define macros matching m/^-/ (was a problem on aix-4.3.3) [Stas]