Jonathan Corbet <[email protected]> wrote:
> 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.
Thanks. Oops, I didn't realize the server-name was supposed to be there :x.
But it looks like some test cases need to be adjusted for these.
(see below)
> 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; }
> +
I haven't tested, but I think this needs to account for
multi-value nntpserver in the config (picking the first value is
fine, I suppose)
For example, I use the following config on news.public-inbox.org
because it's also available as a Tor hidden service:
[publicinbox]
nntpserver = news.public-inbox.org
nntpserver = ou63pmih66umazou.onion
And here are test failures from t/nntp.t and t/nntpd.t: ("grep -v ^ok")
Use of uninitialized value $name in string eq at
$HOME/public-inbox/lib/PublicInbox/NNTPD.pm line 16.
# Failed test 'got greeting'
# at t/nntpd.t line 149.
# got: '201 $HOSTNAME ready - post via email
# '
# expected: '201 server ready - post via email
# '
# Failed test 'got greeting'
# at t/nntpd.t line 159.
# got: '201 $HOSTNAME ready - post via email
# '
# expected: '201 server ready - post via email
# '
# Failed test 'XHDR xref by message-id works'
# at t/nntpd.t line 167.
# Structures begin differing at:
# $got->{<[email protected]>} = '$HOSTNAME test-nntpd:1'
# $expected->{<[email protected]>} = 'example.com test-nntpd:1'
# Failed test 'xref by article number works'
# at t/nntpd.t line 169.
# Structures begin differing at:
# $got->{1} = '$HOSTNAME test-nntpd:1'
# $expected->{1} = 'example.com test-nntpd:1'
# Failed test 'xref by article range works'
# at t/nntpd.t line 171.
# Structures begin differing at:
# $got->{1} = '$HOSTNAME test-nntpd:1'
# $expected->{1} = 'example.com test-nntpd:1'
# Failed test 'got expected response for HDR'
# at t/nntpd.t line 178.
# got: '0 $HOSTNAME test-nntpd:1'
# expected: '0 example.com test-nntpd:1'
# Failed test 'xref by message-id works without group'
# at t/nntpd.t line 184.
# Structures begin differing at:
# $got->{<[email protected]>} = '$HOSTNAME test-nntpd:1'
# $expected->{<[email protected]>} = 'example.com test-nntpd:1'
# Looks like you failed 7 tests of 92.
t/nntpd.t ..
not ok 15 - got greeting
not ok 19 - got greeting
not ok 46 - XHDR xref by message-id works
not ok 47 - xref by article number works
not ok 48 - xref by article range works
not ok 50 - got expected response for HDR
not ok 66 - xref by message-id works without group
1..92
Dubious, test returned 7 (wstat 1792, 0x700)
Failed 7/92 subtests
Use of uninitialized value in concatenation (.) or string at
$HOME/public-inbox/lib/PublicInbox/NNTP.pm line 413.
# Failed test 'Xref: set'
# at t/nntp.t line 125.
# Structures begin differing at:
# $got->[0] = ' test:1'
# $expected->[0] = 'example.com test:1'
Use of uninitialized value in concatenation (.) or string at
$HOME/public-inbox/lib/PublicInbox/NNTP.pm line 413.
# Failed test 'Old Xref: clobbered'
# at t/nntp.t line 135.
# Structures begin differing at:
# $got->[0] = ' test:2'
# $expected->[0] = 'example.com test:2'
# Looks like you failed 2 tests of 27.
t/nntp.t ...
not ok 24 - Xref: set
not ok 27 - Old Xref: clobbered
1..27
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/27 subtests
Test Summary Report
-------------------
t/nntpd.t (Wstat: 1792 Tests: 92 Failed: 7)
Failed tests: 15, 19, 46-48, 50, 66
Non-zero exit status: 7
t/nntp.t (Wstat: 512 Tests: 27 Failed: 2)
Failed tests: 24, 27
Non-zero exit status: 2
Files=2, Tests=119, 1 wallclock secs ( 0.05 usr 0.00 sys + 0.97 cusr 0.21
csys = 1.23 CPU)
Result: FAIL
Thanks again.
--
unsubscribe: [email protected]
archive: https://public-inbox.org/meta/