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 Changes
Date Tue, 13 May 2003 09:20:33 GMT
stas        2003/05/13 02:20:33

  Modified:    t/conf   modperl_extra.pl
               .        Changes
  Log:
  $r->get_client_block is bogus in httpd-2.0.45 (and ealier), as it
  can't handle EOS buckets arriving in the same bucket brigade with
  data. so rewrite ModPerl::Test::read_post to use an explicit read
  through all bucket brigades till it sees eos and then it stops. The
  code is longer but it works correctly.
  
  Revision  Changes    Path
  1.27      +38 -10    modperl-2.0/t/conf/modperl_extra.pl
  
  Index: modperl_extra.pl
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- modperl_extra.pl	7 Apr 2003 04:44:59 -0000	1.26
  +++ modperl_extra.pl	13 May 2003 09:20:33 -0000	1.27
  @@ -62,23 +62,51 @@
   
   use constant IOBUFSIZE => 8192;
   
  +use Apache::Const -compile => qw(MODE_READBYTES);
  +use APR::Const    -compile => qw(BLOCK_READ);
  +
   sub ModPerl::Test::read_post {
       my $r = shift;
  +    my $debug = shift || 0;
  +
  +    my @data = ();
  +    my $seen_eos = 0;
  +    my $filters = $r->input_filters();
  +    my $ba = $r->connection->bucket_alloc;
  +    my $bb = APR::Brigade->new($r->pool, $ba);
  +
  +    do {
  +        my $rv = $filters->get_brigade($bb,
  +            Apache::MODE_READBYTES, APR::BLOCK_READ, IOBUFSIZE);
  +        if ($rv != APR::SUCCESS) {
  +            return $rv;
  +        }
   
  -    $r->setup_client_block;
  +        while (!$bb->empty) {
  +            my $buf;
  +            my $b = $bb->first;
   
  -    return undef unless $r->should_client_block;
  +            $b->remove;
   
  -    my $data = '';
  -    my $buf;
  -    while (my $read_len = $r->get_client_block($buf, IOBUFSIZE)) {
  -        if ($read_len == -1) {
  -            die "some error while reading with get_client_block";
  +            if ($b->is_eos) {
  +                warn "EOS bucket:\n" if $debug;
  +                $seen_eos++;
  +                last;
  +            }
  +
  +            my $status = $b->read($buf);
  +            warn "DATA bucket: [$buf]\n" if $debug;
  +            if ($status != APR::SUCCESS) {
  +                return $status;
  +            }
  +            push @data, $buf;
           }
  -        $data .= $buf;
  -    }
   
  -    return $data;
  +        $bb->destroy;
  +
  +    } while (!$seen_eos);
  +
  +    return join '', @data;
   }
   
   sub ModPerl::Test::add_config {
  
  
  
  1.187     +6 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.186
  retrieving revision 1.187
  diff -u -r1.186 -r1.187
  --- Changes	12 May 2003 06:37:12 -0000	1.186
  +++ Changes	13 May 2003 09:20:33 -0000	1.187
  @@ -12,6 +12,12 @@
   
   =item 1.99_10-dev
   
  +$r->get_client_block is bogus in httpd-2.0.45 (and ealier), as it
  +can't handle EOS buckets arriving in the same bucket brigade with
  +data. so rewrite ModPerl::Test::read_post to use an explicit read
  +through all bucket brigades till it sees eos and then it stops. The
  +code is longer but it works correctly. [Stas]
  +
   an attempt to resolve the binary compatibility problem in
   PerlIOAPR_seek API when APR_HAS_LARGE_FILES=0 [Stas]
   
  
  
  

Mime
View raw message