my $wbuf;
if ($sock->can('accept_SSL') && !$sock->accept_SSL) {
return CORE::close($sock) if $! != EAGAIN;
- $ev = PublicInbox::TLS::epollbit();
+ $ev = PublicInbox::TLS::epollbit() or return CORE::close($sock);
$wbuf = [ \&PublicInbox::DS::accept_tls_step, \&greet ];
}
$self->SUPER::new($sock, $ev | EPOLLONESHOT);
wildmat2re($wildmat);
foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
$ng->{newsgroup} =~ $wildmat or next;
- my $c = eval { $ng->mm->created_at } || time;
+ my $c = eval { $ng->uidvalidity } // time;
more($self, "$ng->{newsgroup} $c $ng->{-primary_address}");
}
}
# TODO dists
more($self, '231 list of new newsgroups follows');
foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
- my $c = eval { $ng->mm->created_at } || 0;
+ my $c = eval { $ng->uidvalidity } // 0;
next unless $c > $ts;
group_line($self, $ng);
}
my ($hdr, $smsg) = @_;
my ($mid) = $smsg->{mid};
- # why? leafnode requires a Path: header for some inexplicable
- # reason. We'll fake the shortest one possible.
- $hdr->header_set('Path', 'y');
-
# leafnode (and maybe other NNTP clients) have trouble dealing
# with v2 messages which have multiple Message-IDs (either due
# to our own content-based dedupe or buggy git-send-email versions).
$hdr->header_set('X-Alt-Message-ID', @alt);
}
- # clobber some
+ # clobber some existing headers
my $ibx = $smsg->{-ibx};
my $xref = xref($smsg->{nntp}, $ibx, $smsg->{num}, $mid);
$hdr->header_set('Xref', $xref);
- $xref =~ s/:[0-9]+//g;
- $hdr->header_set('Newsgroups', (split(/ /, $xref, 2))[1]);
+
+ # RFC 5536 3.1.4
+ my ($server_name, $newsgroups) = split(/ /, $xref, 2);
+ $newsgroups =~ s/:[0-9]+\b//g; # drop NNTP article numbers
+ $newsgroups =~ tr/ /,/;
+ $hdr->header_set('Newsgroups', $newsgroups);
+
+ # *something* here is required for leafnode, try to follow
+ # RFC 5536 3.1.5...
+ $hdr->header_set('Path', $server_name . '!not-for-mail');
+
header_append($hdr, 'List-Post', "<mailto:$ibx->{-primary_address}>");
if (my $url = $ibx->base_url) {
$mid = mid_escape($mid);