user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Andrey Melnikov <temnota.am@gmail.com>
Cc: meta@public-inbox.org
Subject: Re: [PATCH] nntp: delimit Newsgroup: header with commas
Date: Tue, 3 Nov 2020 23:59:42 +0000	[thread overview]
Message-ID: <20201103235942.GA6163@dcvr> (raw)
In-Reply-To: <CA+PODjoKHq1Rh-LOvTQZg3zMWRetPsohEA41YrAy7B0zo03UfA@mail.gmail.com>

Andrey Melnikov <temnota.am@gmail.com> wrote:
> This break filtering on my leafnode.

OK, thanks for that info.

> What about "Path:" header?

Ah, oops; missed that.  I put "y" there since I figured it
wouldn't matter for leafnode (but only lightly tested it).

Since we don't have any NNTP propagation path, I guess putting
just server-name there is appropriate? (not yet deployed)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 783c0076..cb095bca 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -415,10 +415,6 @@ sub set_nntp_headers ($$) {
 	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).
@@ -438,11 +434,14 @@ sub set_nntp_headers ($$) {
 	$hdr->header_set('Xref', $xref);
 
 	# RFC 5536 3.1.4
-	my $newsgroups = (split(/ /, $xref, 2))[1]; # drop server name
+	my ($server_name, $newsgroups) = split(/ /, $xref, 2);
 	$newsgroups =~ s/:[0-9]+\b//g; # drop NNTP article numbers
 	$newsgroups =~ tr/ /,/;
 	$hdr->header_set('Newsgroups', $newsgroups);
 
+	# required for leafnode (RFC 5536 3.1.5)
+	$hdr->header_set('Path', $server_name);
+
 	header_append($hdr, 'List-Post', "<mailto:$ibx->{-primary_address}>");
 	if (my $url = $ibx->base_url) {
 		$mid = mid_escape($mid);

  reply	other threads:[~2020-11-03 23:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 12:29 nntpd generate wrong headers Andrey Melnikov
2020-11-03 22:55 ` [PATCH] nntp: delimit Newsgroup: header with commas Eric Wong
2020-11-03 23:11   ` Andrey Melnikov
2020-11-03 23:59     ` Eric Wong [this message]
     [not found]       ` <CA+PODjr0NcFBu42mOdFnmf4vvxb3YZ+nUt=GqWEq+agXa8Au0Q@mail.gmail.com>
2020-11-04 10:44         ` Eric Wong
2020-11-04 11:46           ` Andrey Melnikov
2020-11-04 19:47             ` Eric Wong
2020-11-04 21:01               ` Andrey Melnikov
2020-11-05  7:50                 ` Eric Wong
2020-11-06 11:57                   ` Andrey Melnikov

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=20201103235942.GA6163@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    --cc=temnota.am@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).