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-Status: No, score=-2.5 required=3.0 tests=ALL_TRUSTED,BAYES_00, BODY_8BITS 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 455A71F66F; Wed, 4 Nov 2020 10:44:48 +0000 (UTC) Date: Wed, 4 Nov 2020 10:44:48 +0000 From: Eric Wong To: Andrey Melnikov Cc: meta@public-inbox.org Subject: Re: [PATCH] nntp: delimit Newsgroup: header with commas Message-ID: <20201104104448.GA6053@dcvr> References: <20201103225559.GA5247@dcvr> <20201103235942.GA6163@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: Andrey Melnikov wrote: (re-adding meta@public-inbox.org to Cc) > ср, 4 нояб. 2020 г. в 02:59, Eric Wong : > > > > Andrey Melnikov 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 --- 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', "{-primary_address}>"); if (my $url = $ibx->base_url) { $mid = mid_escape($mid);