Use flatten code instead of the over complex bucket manipulation
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@440 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
b906f67123
commit
b54c8ec46c
@ -16,7 +16,6 @@ use APR::Bucket ();
|
|||||||
use APR::Socket ();
|
use APR::Socket ();
|
||||||
use Apache2::Filter ();
|
use Apache2::Filter ();
|
||||||
use ModPerl::Util ();
|
use ModPerl::Util ();
|
||||||
# use Apache::TieBucketBrigade;
|
|
||||||
|
|
||||||
our $VERSION = '0.02';
|
our $VERSION = '0.02';
|
||||||
|
|
||||||
@ -112,14 +111,11 @@ sub getline {
|
|||||||
my $rc = $c->input_filters->get_brigade($bb, Apache2::Const::MODE_GETLINE);
|
my $rc = $c->input_filters->get_brigade($bb, Apache2::Const::MODE_GETLINE);
|
||||||
return if $rc == APR::Const::EOF;
|
return if $rc == APR::Const::EOF;
|
||||||
die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
|
die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
|
||||||
my $data = '';
|
|
||||||
|
|
||||||
while (!$bb->is_empty) {
|
next unless $bb->flatten(my $data);
|
||||||
my $b = $bb->first;
|
|
||||||
$b->read(my $newdata);
|
$bb->cleanup;
|
||||||
$data .= $newdata;
|
return $data;
|
||||||
return $data if index($newdata, "\n") >= 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@ -145,10 +141,11 @@ sub respond {
|
|||||||
my $bb = $self->{bb_out};
|
my $bb = $self->{bb_out};
|
||||||
my $line = $code . (@messages?"-":" ").$msg;
|
my $line = $code . (@messages?"-":" ").$msg;
|
||||||
$self->log(LOGDEBUG, $line);
|
$self->log(LOGDEBUG, $line);
|
||||||
my $bucket = APR::Bucket->new(($c->bucket_alloc), "$line\r\n");
|
my $bucket = APR::Bucket->new(($c->bucket_alloc), "$line\r\n");
|
||||||
$bb->insert_tail($bucket);
|
$bb->insert_tail($bucket);
|
||||||
$c->output_filters->fflush($bb);
|
$c->output_filters->fflush($bb);
|
||||||
$bucket->remove;
|
# $bucket->remove;
|
||||||
|
$bb->cleanup;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user