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=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 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 4A0581F66F; Tue, 3 Nov 2020 23:59:42 +0000 (UTC) Date: Tue, 3 Nov 2020 23:59:42 +0000 From: Eric Wong To: Andrey Melnikov Cc: meta@public-inbox.org Subject: Re: [PATCH] nntp: delimit Newsgroup: header with commas Message-ID: <20201103235942.GA6163@dcvr> References: <20201103225559.GA5247@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: 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) 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', "{-primary_address}>"); if (my $url = $ibx->base_url) { $mid = mid_escape($mid);