From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS63949 45.79.64.0/19 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6851E1F404 for ; Tue, 4 Sep 2018 15:28:34 +0000 (UTC) Received: from meer.lwn.net (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id 34FB72D7; Tue, 4 Sep 2018 15:28:34 +0000 (UTC) From: Jonathan Corbet To: meta@public-inbox.org Cc: Jonathan Corbet Subject: [PATCH 1/2] Put the NNTP server name into Xref lines Date: Tue, 4 Sep 2018 09:28:19 -0600 Message-Id: <20180904152820.15594-2-corbet@lwn.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180904152820.15594-1-corbet@lwn.net> References: <20180904152820.15594-1-corbet@lwn.net> List-Id: 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, from the host name otherwise, and use it rather than the domain name of the list server. --- lib/PublicInbox/NNTP.pm | 4 ++-- lib/PublicInbox/NNTPD.pm | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index cdbd8e9..cbd4ecf 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -94,7 +94,7 @@ sub new ($$$) { my $self = fields::new($class); $self->SUPER::new($sock); $self->{nntpd} = $nntpd; - res($self, '201 server ready - post via email'); + res($self, '201 ' . $nntpd->{servername} . ' ready - post via email'); $self->{rbuf} = ''; $self->watch_read(1); update_idle_time($self); @@ -410,7 +410,7 @@ sub header_append ($$$) { sub xref ($$$$) { my ($self, $ng, $n, $mid) = @_; - my $ret = "$ng->{domain} $ng->{newsgroup}:$n"; + my $ret = $self->{nntpd}->{servername} . " $ng->{newsgroup}:$n"; # num_for is pretty cheap and sometimes we'll lookup the existence # of an article without getting even the OVER info. In other words, diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm index 117c9c0..666c53b 100644 --- a/lib/PublicInbox/NNTPD.pm +++ b/lib/PublicInbox/NNTPD.pm @@ -6,15 +6,21 @@ package PublicInbox::NNTPD; use strict; use warnings; +use Sys::Hostname; require PublicInbox::Config; sub new { my ($class) = @_; + my $pi_config = PublicInbox::Config->new; + my $name = $pi_config->{'publicinbox.nntpserver'}; + if ($name eq '') { $name = hostname; } + bless { groups => {}, err => \*STDERR, out => \*STDOUT, grouplist => [], + servername => $name, }, $class; } -- 2.17.1