There's a hole in my bucket, dear Liza, dear Liza.

There's a hole in my bucket, dear Liza, a hole.

Go fix it, dear Henry, dear Henry, dear Henry.
Go fix it, dear Henry, dear Henry, fix it.

With what shall I fix it, dear Liza ... with what?
With a patch from Joe Schaefer, dear Henry ... with a patch.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@434 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-06-17 13:33:57 +00:00
parent 4360370e7e
commit 8b85efcfe8

View File

@ -6,23 +6,23 @@ use 5.006001;
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use Apache::ServerUtil (); use Apache2::ServerUtil ();
use Apache::Connection (); use Apache2::Connection ();
use Apache::Const -compile => qw(OK MODE_GETLINE); use Apache2::Const -compile => qw(OK MODE_GETLINE);
use APR::Const -compile => qw(SO_NONBLOCK EOF SUCCESS); use APR::Const -compile => qw(SO_NONBLOCK EOF SUCCESS);
use APR::Error (); use APR::Error ();
use APR::Brigade (); use APR::Brigade ();
use APR::Bucket (); use APR::Bucket ();
use APR::Socket (); use APR::Socket ();
use Apache::Filter (); use Apache2::Filter ();
use ModPerl::Util (); use ModPerl::Util ();
# use Apache::TieBucketBrigade; # use Apache::TieBucketBrigade;
our $VERSION = '0.02'; our $VERSION = '0.02';
sub handler { sub handler {
my Apache::Connection $c = shift; my Apache2::Connection $c = shift;
$c->client_socket->opt_set(APR::SO_NONBLOCK => 0); $c->client_socket->opt_set(APR::Const::SO_NONBLOCK => 0);
my $qpsmtpd = Qpsmtpd::Apache->new(); my $qpsmtpd = Qpsmtpd::Apache->new();
$qpsmtpd->start_connection( $qpsmtpd->start_connection(
@ -35,7 +35,7 @@ sub handler {
$qpsmtpd->run($c); $qpsmtpd->run($c);
return Apache::OK; return Apache2::Const::OK;
} }
package Qpsmtpd::Apache; package Qpsmtpd::Apache;
@ -109,16 +109,16 @@ sub getline {
my $bb = $self->{bb_in}; my $bb = $self->{bb_in};
while (1) { while (1) {
my $rc = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE); my $rc = $c->input_filters->get_brigade($bb, Apache2::Const::MODE_GETLINE);
return if $rc == APR::EOF; return if $rc == APR::Const::EOF;
die APR::Error::strerror($rc) unless $rc == APR::SUCCESS; die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
my $data = ''; my $data = '';
while (!$bb->is_empty) { while (!$bb->is_empty) {
my $b = $bb->first; my $b = $bb->first;
$b->remove;
$b->read(my $newdata); $b->read(my $newdata);
$data .= $newdata; $b->delete;
$data .= $newdata;
return $data if index($data, "\n") >= 0; return $data if index($data, "\n") >= 0;
} }
} }