unofficial mirror of meta@public-inbox.org
 help / color / mirror / 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: Wed, 4 Nov 2020 10:44:48 +0000	[thread overview]
Message-ID: <20201104104448.GA6053@dcvr> (raw)
In-Reply-To: <CA+PODjr0NcFBu42mOdFnmf4vvxb3YZ+nUt=GqWEq+agXa8Au0Q@mail.gmail.com>

Andrey Melnikov <temnota.am@gmail.com> wrote:

(re-adding meta@public-inbox.org to Cc)

> ср, 4 нояб. 2020 г. в 02:59, Eric Wong <e@80x24.org>:
> >
> > 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)
> Yes. Leafnode only checks presence on Path: header.

OK, that matches my limited, one-off experience with it.

> > +       # required for leafnode (RFC 5536 3.1.5)
> > +       $hdr->header_set('Path', $server_name);
> I think
> $hdr->header_set('Path', $server_name . '!not-for-mail');
> more RFC conform.

I guess...   Though it seems like blindly following stuff for
historical reasons, since I'm not seeing a great explanation of
"not-for-mail", other than it's "common" in RFC 5536/5537...
"not-for-mail" could be a valid hostname, after all.

I suppose a few extra bytes won't hurt, too much :x

----------8<--------
Subject: [PATCH] nntp: attempt RFC 5536 3.1.5-conformant Path: headers

Perhaps some NNTP clients would be unhappy with the old value
"y".  So use a bit more bandwidth+space to use the server-name
and historical "!not-for-mail" tail-entry to better conform to
a published RFC.

Reported-by: Andrey Melnikov <temnota.am@gmail.com>
---
 lib/PublicInbox/NNTP.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 783c0076..2f821fa6 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,15 @@ 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);
 
+	# *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);

  parent reply	other threads:[~2020-11-04 10:44 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
     [not found]       ` <CA+PODjr0NcFBu42mOdFnmf4vvxb3YZ+nUt=GqWEq+agXa8Au0Q@mail.gmail.com>
2020-11-04 10:44         ` Eric Wong [this message]
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=20201104104448.GA6053@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.
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).