]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntp: attempt RFC 5536 3.1.5-conformant Path: headers
authorEric Wong <e@80x24.org>
Wed, 4 Nov 2020 10:44:48 +0000 (10:44 +0000)
committerEric Wong <e@80x24.org>
Sat, 26 Dec 2020 19:38:23 +0000 (19:38 +0000)
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>
(cherry picked from commit 47559005ee678592808c351daa1c9f2682beb248)

lib/PublicInbox/NNTP.pm

index 783c0076e7d0771ba76f6a607be63f26c54ba80a..2f821fa6b9b51902ddc221c9ca3f225d06e708af 100644 (file)
@@ -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);