From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 12F3C1F461; Sat, 13 Jul 2019 21:38:12 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Jonathan Corbet Subject: [PATCH] nntp: fix LIST OVERVIEW.FMT ordering and format Date: Sat, 13 Jul 2019 21:38:11 +0000 Message-Id: <20190713213811.1006-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: RFC3977 8.4.2 mandates the order of non-standard headers to be after the first seven standard headers/metadata; so "Xref:" must appear after "Lines:"|":lines". Additionally, non-required header names must be followed by ":full". Cc: Jonathan Corbet Reported-by: Urs Janßen --- lib/PublicInbox/NNTP.pm | 5 +++-- t/nntpd.t | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 0d2bc4f3..800ce926 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -29,8 +29,9 @@ use constant { use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT); use Errno qw(EAGAIN); -my @OVERVIEW = qw(Subject From Date Message-ID References Xref); -my $OVERVIEW_FMT = join(":\r\n", @OVERVIEW, qw(Bytes Lines)) . ":\r\n"; +my @OVERVIEW = qw(Subject From Date Message-ID References); +my $OVERVIEW_FMT = join(":\r\n", @OVERVIEW, qw(Bytes Lines), '') . + "Xref:full\r\n"; my $LIST_HEADERS = join("\r\n", @OVERVIEW, qw(:bytes :lines Xref To Cc)) . "\r\n"; my $CAPABILITIES = <<""; diff --git a/t/nntpd.t b/t/nntpd.t index e264fa6b..bebecc69 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -101,6 +101,12 @@ EOF is_deeply([$n->group($group)], [ qw(0 1 1), $group ], 'GROUP works'); is_deeply($n->listgroup($group), [1], 'listgroup OK'); + { + my $expect = [ qw(Subject: From: Date: Message-ID: + References: Bytes: Lines: Xref:full) ]; + is_deeply($n->overview_fmt, $expect, + 'RFC3977 8.4.2 compliant LIST OVERVIEW.FMT'); + } SKIP: { $n->can('starttls') or skip('Net::NNTP too old to support STARTTLS', 2); -- EW