]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTP.pm
www: do not unecessarily escape some chars in paths
[public-inbox.git] / lib / PublicInbox / NNTP.pm
index 0b30d43a174562328df2a78d767c6c3d6b18f0d1..7bfc6dd6f5f0294a8b7bbfa946eba951cd06981f 100644 (file)
@@ -9,12 +9,12 @@ use base qw(Danga::Socket);
 use fields qw(nntpd article rbuf ng long_res);
 use PublicInbox::Search;
 use PublicInbox::Msgmap;
+use PublicInbox::MID qw(mid_escape);
 use PublicInbox::Git;
 require PublicInbox::EvCleanup;
 use Email::Simple;
 use POSIX qw(strftime);
 use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
-use URI::Escape qw(uri_escape_utf8);
 use constant {
        r501 => '501 command syntax error',
        r221 => '221 Header follows',
@@ -125,6 +125,7 @@ sub process_line ($$) {
        my $res = eval { $req->($self, @args) };
        my $err = $@;
        if ($err && !$self->{closed}) {
+               local $/ = "\n";
                chomp($l);
                err($self, 'error from: %s (%s)', $l, $err);
                $res = '503 program fault - command not performed';
@@ -420,7 +421,7 @@ sub set_nntp_headers {
        $hdr->header_set('Xref', xref($ng, $n));
        header_append($hdr, 'List-Post', "<mailto:$ng->{-primary_address}>");
        if (my $url = $ng->base_url) {
-               $mid = uri_escape_utf8($mid);
+               $mid = mid_escape($mid);
                header_append($hdr, 'Archived-At', "<$url$mid/>");
                header_append($hdr, 'List-Archive', "<$url>");
        }
@@ -894,7 +895,7 @@ sub more ($$) {
 sub do_write ($$) {
        my ($self, $data) = @_;
        my $done = $self->write($data);
-       die if $self->{closed};
+       return if $self->{closed};
 
        # Do not watch for readability if we have data in the queue,
        # instead re-enable watching for readability when we can