user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] nntp: fix LIST OVERVIEW.FMT ordering and format
@ 2019-07-13 21:38 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-07-13 21:38 UTC (permalink / raw)
  To: meta; +Cc: Jonathan Corbet

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-13 21:38 [PATCH] nntp: fix LIST OVERVIEW.FMT ordering and format Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox