about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-11-04 10:44:48 +0000
committerEric Wong <e@80x24.org>2020-12-26 19:38:23 +0000
commitbf14a3670da7235806740aa55bd7a7248327abf7 (patch)
tree1a940aab558622643ba5d3c5007e08253db8de26
parent2fcf2b14a9ce3336af3f58fd23bc18f9a6876718 (diff)
downloadpublic-inbox-bf14a3670da7235806740aa55bd7a7248327abf7.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>
(cherry picked from commit 47559005ee678592808c351daa1c9f2682beb248)
-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);