From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 95BC31F5AE for ; Sat, 1 Aug 2020 20:16:58 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] nntp: fix STAT command Date: Sat, 1 Aug 2020 20:16:58 +0000 Message-Id: <20200801201658.16500-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The return value of art_lookup changed but this command wasn't updated since it wasn't tested. Fixes: 0e6ceff37fc38f28 ("nntp: support slow blob retrievals") --- lib/PublicInbox/NNTP.pm | 8 ++++---- t/nntpd.t | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 87ddf7a4..595a4046 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -581,11 +581,11 @@ sub cmd_body ($;$) { sub cmd_stat ($;$) { my ($self, $art) = @_; - my $r = art_lookup($self, $art); - return $r unless ref $r; - my ($n, $mid) = @$r; + my $smsg = art_lookup($self, $art); # art may be msgid + return $smsg unless ref $smsg; + $art = $smsg->{num}; set_art($self, $art); - "223 $n <$mid> article retrieved - request text separately"; + "223 $art <$smsg->{mid}> article retrieved - request text separately"; } sub cmd_ihave ($) { '435 article not wanted - do not send it' } diff --git a/t/nntpd.t b/t/nntpd.t index aaf6661d..0b4a2636 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -206,6 +206,7 @@ EOF is_deeply($n->head(1), $n->head(''), 'HEAD OK'); is_deeply($n->body(1), $n->body(''), 'BODY OK'); + is_deeply($n->nntpstat(1), '', 'STAT'); is($n->body(1)->[0], "This is a test message for El\xc3\xa9anor\n", 'body really matches'); my $art = $n->article(1);