Skip to content

Commit

Permalink
Don't undef $nntp until we're finished with it.
Browse files Browse the repository at this point in the history
  • Loading branch information
oalders committed Mar 2, 2017
1 parent 4a0bd13 commit 5430d0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/LWP/Protocol/nntp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ sub request {
my $art = $nntp->$get("<$groupart>");
unless ($art) {
$nntp->quit;
$nntp = undef;
$response->code(HTTP::Status::RC_NOT_FOUND);
$response->message($nntp->message);
$nntp = undef;
return $response;
}

Expand Down
12 changes: 12 additions & 0 deletions t/base/protocols/nntp.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use strict;
use warnings;

use LWP::UserAgent ();
use Test::More;
use Test::RequiresInternet ( 'nntp.perl.org' => 119 );

plan tests => 1;
my $ua = LWP::UserAgent->new;

my $res = $ua->get('nntp://nntp.perl.org/blahblahblah@blahblahblah');
is($res->code, 404, '404 on fake nntp url');

0 comments on commit 5430d0e

Please sign in to comment.