From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Cc: Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH] nntp: fix LIST OVERVIEW.FMT ordering and format
Date: Sat, 13 Jul 2019 21:38:11 +0000 [thread overview]
Message-ID: <20190713213811.1006-1-e@80x24.org> (raw)
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 <corbet@lwn.net>
Reported-by: Urs Janßen
<E1hmKBw-0008Bq-8t@akw>
---
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
reply other threads:[~2019-07-13 21:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190713213811.1006-1-e@80x24.org \
--to=e@80x24.org \
--cc=corbet@lwn.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).