You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/12/19 08:06:31 UTC

cvs commit: modperl-2.0/t/filter/TestFilter both_str_con_add.pm

stas        2003/12/18 23:06:31

  Modified:    t/protocol/TestProtocol echo_filter.pm
               t/filter/TestFilter both_str_con_add.pm
  Log:
  rewrite the error checking in the connection protocol handlers not to warn,
  when $bb comes empty, since it's the end of input
  
  Revision  Changes    Path
  1.7       +7 -8      modperl-2.0/t/protocol/TestProtocol/echo_filter.pm
  
  Index: echo_filter.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_filter.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- echo_filter.pm	11 Apr 2002 11:08:43 -0000	1.6
  +++ echo_filter.pm	19 Dec 2003 07:06:31 -0000	1.7
  @@ -17,22 +17,21 @@
       my $bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
   
       for (;;) {
  -        my $rv = $c->input_filters->get_brigade($bb,
  -                                                Apache::MODE_GETLINE);
  -
  -        if ($rv != APR::SUCCESS or $bb->empty) {
  +        my $rv = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);
  +                if ($rv != APR::SUCCESS && $rv != APR::EOF) {
               my $error = APR::strerror($rv);
  -            unless ($rv == APR::EOF) {
  -                warn "[echo_filter] get_brigade: $error\n";
  -            }
  -            $bb->destroy;
  +            warn __PACKAGE__ . ": get_brigade: $error\n";
               last;
           }
   
  +        last if $bb->empty;
  +
           my $b = APR::Bucket::flush_create($c->bucket_alloc);
           $bb->insert_tail($b);
           $c->output_filters->pass_brigade($bb);
       }
  +
  +    $bb->destroy;
   
       Apache::OK;
   }
  
  
  
  1.8       +7 -8      modperl-2.0/t/filter/TestFilter/both_str_con_add.pm
  
  Index: both_str_con_add.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/both_str_con_add.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- both_str_con_add.pm	23 Sep 2003 23:52:49 -0000	1.7
  +++ both_str_con_add.pm	19 Dec 2003 07:06:31 -0000	1.8
  @@ -54,22 +54,21 @@
       my $bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
   
       for (;;) {
  -        my $rv = $c->input_filters->get_brigade($bb,
  -                                                Apache::MODE_GETLINE);
  -
  -        if ($rv != APR::SUCCESS or $bb->empty) {
  +        my $rv = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);
  +        if ($rv != APR::SUCCESS && $rv != APR::EOF) {
               my $error = APR::strerror($rv);
  -            unless ($rv == APR::EOF) {
  -                warn "[echo_filter] get_brigade: $error\n";
  -            }
  -            $bb->destroy;
  +            warn __PACKAGE__ . ": get_brigade: $error\n";
               last;
           }
   
  +        last if $bb->empty;
  +
           my $b = APR::Bucket::flush_create($c->bucket_alloc);
           $bb->insert_tail($b);
           $c->output_filters->pass_brigade($bb);
       }
  +
  +    $bb->destroy;
   
       Apache::OK;
   }