From e8fd8b3f0fbd20e82ae04035178ce84fcf7cd0f1 Mon Sep 17 00:00:00 2001 From: Andreas Koenig Date: Sat, 9 Jul 2016 03:04:25 +0200 Subject: [PATCH] Prevent trying Net::FTP when an ftp_proxy variable is set to an http proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - reported in https://rt.cpan.org/Ticket/Display.html?id=110833 Signed-off-by: Petr Písař --- lib/CPAN.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/CPAN.pm b/lib/CPAN.pm index ab2d00f..6e460a8 100644 --- a/lib/CPAN.pm +++ b/lib/CPAN.pm @@ -1064,6 +1064,16 @@ sub has_usable { }, ], 'Net::FTP' => [ + sub { + my $var = $CPAN::Config->{ftp_proxy} || $ENV{ftp_proxy}; + if ($var and $var =~ /^http:/) { + # rt #110833 + for ("Net::FTP cannot handle http proxy") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, sub {require Net::FTP}, sub {require Net::Config}, ], -- 2.7.4