X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FNNTP.pm;h=7a91e7ebfe49d158080d3a3bbabc0c630b5997da;hb=HEAD;hp=524784cb90ac3a6dfabc29f030d5e7cd32fe2704;hpb=f1e6dbd43146aec82aeb49cd249a8a86813506e1;p=public-inbox.git diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 524784cb..7a91e7eb 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -15,7 +15,7 @@ use PublicInbox::MID qw(mid_escape $MID_EXTRACT); use PublicInbox::Eml; use POSIX qw(strftime); use PublicInbox::DS qw(now); -use Digest::SHA qw(sha1_hex); +use PublicInbox::SHA qw(sha1_hex); use Time::Local qw(timegm timelocal); use PublicInbox::GitAsyncCat; use PublicInbox::Address; @@ -72,9 +72,8 @@ sub process_line ($$) { my $res = eval { $req->($self, @args) }; my $err = $@; if ($err && $self->{sock}) { - local $/ = "\n"; - chomp($l); - err($self, 'error from: %s (%s)', $l, $err); + $l =~ s/\r?\n//s; + warn("error from: $l ($err)\n"); $res = \"503 program fault - command not performed\r\n"; } defined($res) ? $self->write($res) : 0; @@ -189,7 +188,7 @@ sub listgroup_range_i { my ($self, $beg, $end) = @_; my $r = $self->{ibx}->mm(1)->msg_range($beg, $end, 'num'); scalar(@$r) or return; - $self->msg_more(join("\r\n", @$r, '')); + $self->msg_more(join('', map { "$_->[0]\r\n" } @$r)); 1; } @@ -945,11 +944,6 @@ sub cmd_xpath ($$) { '223 '.join(' ', sort(@paths))."\r\n"; } -sub err ($$;@) { - my ($self, $fmt, @args) = @_; - printf { $self->{nntpd}->{err} } $fmt."\n", @args; -} - sub out ($$;@) { my ($self, $fmt, @args) = @_; printf { $self->{nntpd}->{out} } $fmt."\n", @args; @@ -958,7 +952,7 @@ sub out ($$;@) { # callback used by PublicInbox::DS for any (e)poll (in/out/hup/err) sub event_step { my ($self) = @_; - + local $SIG{__WARN__} = $self->{nntpd}->{warn_cb}; return unless $self->flush_write && $self->{sock} && !$self->{long_cb}; # only read more requests if we've drained the write buffer,