about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-11-04 10:44:48 +0000
committerEric Wong <e@80x24.org>2020-11-04 19:50:16 +0000
commit47559005ee678592808c351daa1c9f2682beb248 (patch)
tree1cd845896bc205b89a707f3bf2832da38e3f81f9 /lib
parent44227c2624e4f954943d632cd5335396351373be (diff)
downloadpublic-inbox-47559005ee678592808c351daa1c9f2682beb248.tar.gz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NNTP.pm10
1 files 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);