Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

ap_save_brigade

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


dorian.taylor.lists at gmail

Jul 22, 2013, 12:14 AM

Post #1 of 2 (74 views)
Permalink
ap_save_brigade

Hello,

Is there a reason why ap_save_brigade hasn't been implemented? Does it
have special needs?

(Funnily, after googling this issue, I found I had asked the same
question in 2005:
http://mail-archives.apache.org/mod_mbox/perl-modperl/200505.mbox/%3C20050509222133.GB31691 [at] foobarsystems%3E
—and apparently written a patch.)

Cheers,

--
Dorian Taylor
http://doriantaylor.com/


dorian.taylor.lists at gmail

Jul 22, 2013, 2:08 AM

Post #2 of 2 (71 views)
Permalink
Re: ap_save_brigade [In reply to]

OK, I have a clue why ap_save_brigade wasn't implemented. I looked at
its source and it basically does this:

# XXX UNTESTED CODE
sub Apache2::Filter::save_brigade {
my ($f, $saveto, $bb, $pool) = @_;
# XXX should this be $f->r->pool?
$pool ||= $f->c->pool;

my $ret = APR::Const::SUCCESS;

for (my $b = $bb->first; !$b->is_eos; $b = $bb->next($b)) {
my $rv = $b->setaside($pool);

if ($rv == APR::Const::ENOTIMPL) {
my $len = $b->read(my $data);
# apparently this changes the bucket type?
$rv = $b->setaside($pool) if $len;
}

# check for some other kind of error
if ($rv != APR::Const::SUCCESS) {
$ret = $rv;
return $rv if $rv != APR::Const::ENOTIMPL;
}
}

# now concatenate the brigade to the target
$saveto->concat($bb);

return $ret;
}

The difference in the C version is that saveto and bb are pointers to
pointers to brigades, so if saveto is NULL, ap_save_brigade creates
one, which would be kind of icky for a Perl interface. It also means
that patch I submitted in 2005 was probably broken anyway.

There's really no reason why it couldn't be implemented in mod_perl in
a way that stipulates passing a target brigade in as input though. I'm
pretty sure it'd be a heck of a lot more efficient than that
subroutine I just wrote above.


On Mon, Jul 22, 2013 at 12:14 AM, dorian taylor
<dorian.taylor.lists [at] gmail> wrote:
> Hello,
>
> Is there a reason why ap_save_brigade hasn't been implemented? Does it
> have special needs?
>
> (Funnily, after googling this issue, I found I had asked the same
> question in 2005:
> http://mail-archives.apache.org/mod_mbox/perl-modperl/200505.mbox/%3C20050509222133.GB31691 [at] foobarsystems%3E
> —and apparently written a patch.)
>
> Cheers,
>
> --
> Dorian Taylor
> http://doriantaylor.com/



--
Dorian Taylor
http://doriantaylor.com/

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.