diff options
author | Ricardo Signes <rjbs@cpan.org> | 2013-02-07 16:23:00 -0500 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2013-02-07 16:23:00 -0500 |
commit | 83a55e9bdbb05578b811040c7ee43c2845a0c5fa (patch) | |
tree | 5fbfa1952e080a9c2bd6947b385b3ab78b056bce | |
parent | 59884213af3d88c6945b0197c7a199ea4cd0c187 (diff) |
check that 02packages is sane-ish
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | lib/CPAN/Mini.pm | 14 |
2 files changed, 14 insertions, 1 deletions
@@ -1,6 +1,7 @@ Revision history for CPAN-Mini {{$NEXT}} + check that the received 02packages seems at least remotely plausible 1.111010 2012-10-24 10:46:35 America/New_York fix the old ->trace method, broken in 1.111004 diff --git a/lib/CPAN/Mini.pm b/lib/CPAN/Mini.pm index af654e3..ff849b5 100644 --- a/lib/CPAN/Mini.pm +++ b/lib/CPAN/Mini.pm @@ -215,12 +215,24 @@ sub _get_mirror_list { or die "Cannot open details: $Compress::Zlib::gzerrno"; my $inheader = 1; + my $file_ok = 0; while ($gz->gzreadline($_) > 0) { if ($inheader) { - $inheader = 0 unless /\S/; + if (/\S/) { + my ($header, $value) = split /:\s*/, $_, 2; + chomp $value; + $file_ok = 1 if $header eq 'File' + and $value eq '02packages.details.txt'; + } else { + $inheader = 0; + } + next; } + die "02packages.details.txt file is not a valid index\n" + unless $file_ok; + my ($module, $version, $path) = split; next if $self->_filter_module({ module => $module, |