diff --git a/Makefile.PL b/Makefile.PL index 0bd5ef243..7b272d6bb 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -79,6 +79,7 @@ my $prereq_pm = { # Scalar::Util; # PathTools-3.16.tar.gz 'File::Temp' => 0, # TJENNESS; requires Test::More; + 'Mozilla::CA' => 0, # enables LWP::UserAgent https cert checks 'Net::Ping' => 0, # SMPETERS; 'Scalar::Util' => 0, # GBARR; # Scalar-List-Utils-1.18.tar.gz; @@ -125,6 +126,7 @@ for my $interesting_module (qw( MIME::Base64 Module::Build Module::Signature + Mozilla::CA Net::FTP Parse::CPAN::Meta Scalar::Util diff --git a/lib/App/Cpan.pm b/lib/App/Cpan.pm index 87549126d..255a7544d 100644 --- a/lib/App/Cpan.pm +++ b/lib/App/Cpan.pm @@ -976,12 +976,12 @@ sub _find_good_mirrors { ); foreach my $mirror ( @mirrors ) { - next unless eval { $mirror->can( 'http' ) }; + next unless eval { $mirror->can( 'http' ) || $mirror->can( 'https' ) }; _print_ping_report( $mirror->http ); } $CPAN::Config->{urllist} = [ - map { $_->http } @mirrors + map { $->can( 'https' ) ? $_->https : $_->http } @mirrors ]; } diff --git a/lib/CPAN.pm b/lib/CPAN.pm index 1f69119e5..49f09be70 100644 --- a/lib/CPAN.pm +++ b/lib/CPAN.pm @@ -107,7 +107,7 @@ unless (@CPAN::Defaultsites) { @CPAN::Defaultsites = map { CPAN::URL->new(TEXT => $_, FROM => "DEF") } - "http://www.perl.org/CPAN/", + "https://www.cpan.org/", "ftp://ftp.perl.org/pub/CPAN/"; } # $CPAN::iCwd (i for initial) diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm index 72101afc7..be2d0da1b 100644 --- a/lib/CPAN/Distribution.pm +++ b/lib/CPAN/Distribution.pm @@ -4265,7 +4265,7 @@ sub _getsave_url { "); my $Ua; CPAN::LWP::UserAgent->config; - eval { $Ua = CPAN::LWP::UserAgent->new; }; + eval { $Ua = CPAN::LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); }; if ($@) { $CPAN::Frontend->mywarn("ERROR: CPAN::LWP::UserAgent->new dies with $@\n"); return; @@ -4414,7 +4414,7 @@ sub reports { CPAN::LWP::UserAgent->config; my $Ua; - eval { $Ua = CPAN::LWP::UserAgent->new; }; + eval { $Ua = CPAN::LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); }; if ($@) { $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n"); } diff --git a/lib/CPAN/Mirrors.pm b/lib/CPAN/Mirrors.pm index 4ceca0458..0a76b6857 100644 --- a/lib/CPAN/Mirrors.pm +++ b/lib/CPAN/Mirrors.pm @@ -491,6 +491,9 @@ sub _parse { elsif ( $prop eq 'dst_http' ) { $mirror->{http} = $value; } + elsif ( $prop eq 'dst_https' ) { + $mirror->{https} = $value; + } elsif ( $prop eq 'dst_ftp' ) { $mirror->{ftp} = $value; } @@ -535,6 +538,7 @@ sub hostname { shift->{hostname} } sub continent { shift->{continent} } sub country { shift->{country} } sub http { shift->{http} || '' } +sub https { shift->{https} || '' } sub ftp { shift->{ftp} || '' } sub rsync { shift->{rsync} || '' } sub rtt { shift->{rtt} } @@ -542,7 +546,7 @@ sub ping_time { shift->{ping_time} } sub url { my $self = shift; - return $self->{http} || $self->{ftp}; + return $self->{https} || $self->{http} || $self->{ftp}; } sub ping { diff --git a/lib/CPAN/Shell.pm b/lib/CPAN/Shell.pm index 423131cc2..c8cf849fb 100644 --- a/lib/CPAN/Shell.pm +++ b/lib/CPAN/Shell.pm @@ -1944,7 +1944,7 @@ sub recent { } CPAN::LWP::UserAgent->config; my $Ua; - eval { $Ua = CPAN::LWP::UserAgent->new; }; + eval { $Ua = CPAN::LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); }; if ($@) { $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n"); } diff --git a/t/11mirroredby.t b/t/11mirroredby.t index 42b359d97..2a9e610cb 100644 --- a/t/11mirroredby.t +++ b/t/11mirroredby.t @@ -18,6 +18,7 @@ my $cmb = CPAN::Mirrored::By->new( continent => "continent", country => "country", http => "http", + https => "https", ftp => "ftp", } ); @@ -26,7 +27,7 @@ isa_ok( $cmb, 'CPAN::Mirrored::By' ); is( $cmb->continent(), 'continent', 'continent() should return continent entry' ); is( $cmb->country(), 'country', 'country() should return country entry' ); -is( $cmb->url(), 'http', 'url() should return best url entry' ); +is( $cmb->url(), 'https', 'url() should return best url entry' ); __END__ # Local Variables: diff --git a/t/CPAN/TestMirroredBy b/t/CPAN/TestMirroredBy index 6ec8b038c..9370f8cf1 100644 --- a/t/CPAN/TestMirroredBy +++ b/t/CPAN/TestMirroredBy @@ -17,6 +17,7 @@ # frequency = "daily/bidaily/.../weekly" # dst_ftp = "ftp://the.same.host.name:/CPAN/mirror/directory/" # dst_http = "http://the.same.host.name:/CPAN/mirror/directory/" +# dst_https = "https://the.same.host.name:/CPAN/mirror/directory/" # dst_rsync = "the.same.host.name::CPAN" # dst_location = "city, (area?, )country, continent (lat long)" # dst_organisation = "full organisation name" @@ -4237,5 +4238,17 @@ telmexchile.cl: # dst_contact = "mailto:rdc.cl$ftpadm # dst_src = "ftp.oleane.net" +weekly.org: + frequency = "daily" + dst_http = "http://cpan.weekly.org/" + dst_https = "https://cpan.weekly.org/" + dst_location = "Palo Alto, California, United States, North America (+37.424891 -122.100833)" + dst_organisation = "Primatech Paper Co." + dst_timezone = "-8" + dst_bandwidth = "100 Mb/s" + dst_contact = "weekly.org(david" + dst_src = "rsync://cpan-rsync.perl.org/CPAN/" + +# dst_dst = "http://cpan.weekly.org/" # here endeth MIRRORED.BY