perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/t/filter/TestFilter input_msg.pm
Date Tue, 06 Nov 2001 00:08:46 GMT
dougm       01/11/05 16:08:46

  Modified:    t/filter/TestFilter input_msg.pm
  Log:
  change filter logic to what is currently considered the "right way"
  
  Revision  Changes    Path
  1.7       +21 -11    modperl-2.0/t/filter/TestFilter/input_msg.pm
  
  Index: input_msg.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/input_msg.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- input_msg.pm	2001/07/15 22:33:49	1.6
  +++ input_msg.pm	2001/11/06 00:08:46	1.7
  @@ -16,26 +16,36 @@
   sub handler : FilterConnectionHandler {
       my($filter, $bb, $mode, $readbytes) = @_;
   
  -    if ($bb->empty) {
  -        my $rv = $filter->next->get_brigade($bb, $mode, $readbytes);
  +    my $ctx_bb = APR::Brigade->new($filter->c->pool);
   
  -        if ($rv != APR::SUCCESS) {
  -            return $rv;
  -        }
  +    my $rv = $filter->next->get_brigade($ctx_bb, $mode, $readbytes);
  +
  +    if ($rv != APR::SUCCESS) {
  +        return $rv;
       }
   
  -    for (my $bucket = $bb->first; $bucket; $bucket = $bb->next($bucket)) {
  +    while (!$ctx_bb->empty) {
           my $data;
  -        my $status = $bucket->read($data);
  +        my $bucket = $ctx_bb->first;
   
           $bucket->remove;
   
  -        if ($data and $data =~ s,GET $from_url,GET $to_url,) {
  -            $bb->insert_tail(APR::Bucket->new($data));
  -        }
  -        else {
  +        if ($bucket->is_eos) {
               $bb->insert_tail($bucket);
  +            last;
           }
  +
  +        my $status = $bucket->read($data);
  +
  +        if ($status != APR::SUCCESS) {
  +            return $status;
  +        }
  +
  +        if ($data and $data =~ s,GET $from_url,GET $to_url,) {
  +            $bucket = APR::Bucket->new($data);
  +        }
  +
  +        $bb->insert_tail($bucket);
       }
   
       Apache::OK;
  
  
  

Mime
View raw message