about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-11-03 22:55:59 +0000
committerEric Wong <e@80x24.org>2020-11-04 19:50:06 +0000
commit44227c2624e4f954943d632cd5335396351373be (patch)
treef752b350ac11f3ef59738b7fc45cd499fcda1dba /lib
parentc51c22c349529d9c377160abcc7961a6ca7b7d5c (diff)
downloadpublic-inbox-44227c2624e4f954943d632cd5335396351373be.tar.gz
...instead of spaces.  This is specified in RFC 5536 3.1.4.

Include references to RFC 1036, 5536 and 5537 in our docs while
we're at it.

Reported-by: Andrey Melnikov <temnota.am@gmail.com>
Link: https://public-inbox.org/meta/CA+PODjpUN5Q4gBFQhAzUNuMasVEdmp9f=8Uo0Ej0mFumdSwi4w@mail.gmail.com/
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NNTP.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 102ef42c..783c0076 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -432,12 +432,17 @@ sub set_nntp_headers ($$) {
                 $hdr->header_set('X-Alt-Message-ID', @alt);
         }
 
-        # clobber some
+        # clobber some existing headers
         my $ibx = $smsg->{-ibx};
         my $xref = xref($smsg->{nntp}, $ibx, $smsg->{num}, $mid);
         $hdr->header_set('Xref', $xref);
-        $xref =~ s/:[0-9]+//g;
-        $hdr->header_set('Newsgroups', (split(/ /, $xref, 2))[1]);
+
+        # RFC 5536 3.1.4
+        my $newsgroups = (split(/ /, $xref, 2))[1]; # drop server name
+        $newsgroups =~ s/:[0-9]+\b//g; # drop NNTP article numbers
+        $newsgroups =~ tr/ /,/;
+        $hdr->header_set('Newsgroups', $newsgroups);
+
         header_append($hdr, 'List-Post', "<mailto:$ibx->{-primary_address}>");
         if (my $url = $ibx->base_url) {
                 $mid = mid_escape($mid);