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 Digest::SHA qw(sha1_hex);
+use Time::Local qw(timegm timelocal);
use constant {
r501 => '501 command syntax error',
r221 => '221 Header follows',
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';
sub parse_time ($$;$) {
my ($date, $time, $gmt) = @_;
- use Time::Local qw();
my ($hh, $mm, $ss) = unpack('A2A2A2', $time);
if (defined $gmt) {
$gmt =~ /\A(?:UTC|GMT)\z/i or die "GM invalid: $gmt";
($YYYY, $MM, $DD) = unpack('A4A2A2', $date);
} else { # legacy clients send YYMMDD
($YYYY, $MM, $DD) = unpack('A2A2A2', $date);
- if ($YYYY > strftime('%y', @now)) {
- my $cur_year = $now[5] + 1900;
+ my $cur_year = $now[5] + 1900;
+ if ($YYYY > $cur_year) {
$YYYY += int($cur_year / 1000) * 1000 - 100;
}
}
if ($gmt) {
- Time::Local::timegm($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
+ timegm($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
} else {
- Time::Local::timelocal($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
+ timelocal($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
}
}
return $_[0] = qr/.*/ if (!defined $_[0] || $_[0] eq '*');
my %keep;
my $salt = rand;
- use Digest::SHA qw(sha1_hex);
my $tmp = $_[0];
$tmp =~ s#(?<!\\)\[(.+)(?<!\\)\]#
$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>");
}