Buffer output of Qpsmtpd::TcpServer::respond() for broken clients who don't

follow RFC's for multiline responses.
Patch from Brian Szymanski <ski-qpsmtpd@allafrica.com>

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@664 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2006-10-04 13:49:49 +00:00
parent 9c39c530b2
commit 6c3dc88f37

View File

@ -72,11 +72,13 @@ sub read_input {
sub respond { sub respond {
my ($self, $code, @messages) = @_; my ($self, $code, @messages) = @_;
my $buf = '';
while (my $msg = shift @messages) { while (my $msg = shift @messages) {
my $line = $code . (@messages?"-":" ").$msg; my $line = $code . (@messages?"-":" ").$msg;
$self->log(LOGDEBUG, $line); $self->log(LOGDEBUG, $line);
print "$line\r\n" or ($self->log(LOGERROR, "Could not print [$line]: $!"), return 0); $buf .= "$line\r\n";
} }
print $buf or ($self->log(LOGERROR, "Could not print [$buf]: $!"), return 0);
return 1; return 1;
} }