From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9770C633859 for ; Sat, 19 Sep 2015 02:03:46 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 05/12] nntp: XOVER does not require range Date: Sat, 19 Sep 2015 02:03:33 +0000 Message-Id: <20150919020340.6484-6-e@80x24.org> In-Reply-To: <20150919020340.6484-1-e@80x24.org> References: <20150919020340.6484-1-e@80x24.org> List-Id: XOVER uses the current article if no range is given as stipulated in RFC 2980. --- lib/PublicInbox/NNTP.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 7a73573..8275ef0 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -434,7 +434,7 @@ sub cmd_help ($) { '.' } -sub get_range ($;$) { +sub get_range ($$) { my ($self, $range) = @_; my $ng = $self->{ng} or return '412 no news group has been selected'; defined $range or return '420 No article(s) selected'; @@ -508,11 +508,7 @@ sub long_response ($$$$) { sub cmd_xhdr ($$;$) { my ($self, $header, $range) = @_; defined $self->{ng} or return '412 no news group currently selected'; - unless (defined $range) { - defined($range = $self->{article}) or - return '420 no current article has been selected'; - } - if ($range =~ /\A<(.+)>\z/) { # Message-ID + if (defined $range && $range =~ /\A<(.+)>\z/) { # Message-ID my $r = $self->art_lookup($range, 2); return $r unless ref $r; more($self, '221 Header follows'); @@ -521,6 +517,7 @@ sub cmd_xhdr ($$;$) { } '.'; } else { # numeric range + $range = $self->{article} unless defined $range; my $r = get_range($self, $range); return $r unless ref $r; my ($beg, $end) = @$r; @@ -537,6 +534,7 @@ sub cmd_xhdr ($$;$) { sub cmd_xover ($;$) { my ($self, $range) = @_; + $range = $self->{article} unless defined $range; my $r = get_range($self, $range); return $r unless ref $r; my ($beg, $end) = @$r; -- EW