about summary refs log tree commit homepage
path: root/t/nntpd.t
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2018-10-13 15:42:20 -0600
committerEric Wong <e@80x24.org>2018-10-16 03:48:39 +0000
commitdd7049951c052c541efe3d1bb6de8950512027a5 (patch)
tree33a44dccc40e63cfc7245ef67af8641cbbbd6ea7 /t/nntpd.t
parenta118d58a402bd31b5cd728a183305581b7d5557e (diff)
downloadpublic-inbox-dd7049951c052c541efe3d1bb6de8950512027a5.tar.gz
RFC 5536 sec 3.2.14 says that the server-name in an Xref line is "which
news server generated the header field"; indeed, that is necessary for
newsreaders like gnus to handle references properly.  So pick up the server
name from the config if available (the first name if there's more than
one), from the host name otherwise, and use it rather than the domain
name of the list server.

Tests have been adjusted to match the new behavior.
Diffstat (limited to 't/nntpd.t')
-rw-r--r--t/nntpd.t9
1 files changed, 6 insertions, 3 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index 960e83c1..f8599080 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -16,6 +16,7 @@ use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD);
 use Socket qw(SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY);
 use File::Temp qw/tempdir/;
 use Net::NNTP;
+use Sys::Hostname;
 
 my $tmpdir = tempdir('pi-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $home = "$tmpdir/pi-home";
@@ -140,13 +141,14 @@ EOF
                 'from' => "El\xc3\xa9anor <me\@example.com>",
                 'to' => "El\xc3\xa9anor <you\@example.com>",
                 'cc' => $addr,
-                'xref' => "example.com $group:1",
+                'xref' => hostname . " $group:1",
                 'references' => '<reftabsqueezed>',
         );
 
         my $s = IO::Socket::INET->new(%opts);
         sysread($s, my $buf, 4096);
-        is($buf, "201 server ready - post via email\r\n", 'got greeting');
+        is($buf, "201 " . hostname . " ready - post via email\r\n",
+                'got greeting');
         $s->autoflush(1);
 
         ok(syswrite($s, "   \r\n"), 'wrote spaces');
@@ -156,7 +158,8 @@ EOF
 
         $s = IO::Socket::INET->new(%opts);
         sysread($s, $buf, 4096);
-        is($buf, "201 server ready - post via email\r\n", 'got greeting');
+        is($buf, "201 " . hostname . " ready - post via email\r\n",
+                'got greeting');
         $s->autoflush(1);
 
         syswrite($s, "NEWGROUPS 19990424 000000 GMT\r\n");