diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-21 00:15:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-21 00:15:27 +0000 |
commit | a4c42bfb2337d37da89d789cb8cc226367994e32 (patch) | |
tree | c3eabdef5d565a4e515d2be0d9d4d0540bde0250 /Master/tlpkg/tlperl/lib/CPAN/LWP | |
parent | 8274475057f024d35332ac47c2e2f23ea156e6ed (diff) |
perl 5.14.2 from siep
git-svn-id: svn://tug.org/texlive/trunk@26525 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPAN/LWP')
-rw-r--r-- | Master/tlpkg/tlperl/lib/CPAN/LWP/UserAgent.pm | 76 |
1 files changed, 9 insertions, 67 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPAN/LWP/UserAgent.pm b/Master/tlpkg/tlperl/lib/CPAN/LWP/UserAgent.pm index 7bb86f9a15d..e9fbc7bcded 100644 --- a/Master/tlpkg/tlperl/lib/CPAN/LWP/UserAgent.pm +++ b/Master/tlpkg/tlperl/lib/CPAN/LWP/UserAgent.pm @@ -3,9 +3,11 @@ package CPAN::LWP::UserAgent; use strict; use vars qw(@ISA $USER $PASSWD $SETUPDONE); +use CPAN::HTTP::Credentials; # we delay requiring LWP::UserAgent and setting up inheritance until we need it -$CPAN::LWP::UserAgent::VERSION = $CPAN::LWP::UserAgent::VERSION = "1.94"; +$CPAN::LWP::UserAgent::VERSION = $CPAN::LWP::UserAgent::VERSION = "1.9600"; + sub config { return if $SETUPDONE; @@ -20,75 +22,16 @@ sub config { sub get_basic_credentials { my($self, $realm, $uri, $proxy) = @_; - if ($USER && $PASSWD) { - return ($USER, $PASSWD); - } if ( $proxy ) { - ($USER,$PASSWD) = $self->get_proxy_credentials(); + return CPAN::HTTP::Credentials->get_proxy_credentials(); } else { - ($USER,$PASSWD) = $self->get_non_proxy_credentials(); - } - return($USER,$PASSWD); -} - -sub get_proxy_credentials { - my $self = shift; - my ($user, $password); - if ( defined $CPAN::Config->{proxy_user} ) { - $user = $CPAN::Config->{proxy_user}; - $password = $CPAN::Config->{proxy_pass} || ""; - return ($user, $password); - } - my $username_prompt = "\nProxy authentication needed! - (Note: to permanently configure username and password run - o conf proxy_user your_username - o conf proxy_pass your_password - )\nUsername:"; - ($user, $password) = - _get_username_and_password_from_user($username_prompt); - return ($user,$password); -} - -sub get_non_proxy_credentials { - my $self = shift; - my ($user,$password); - if ( defined $CPAN::Config->{username} ) { - $user = $CPAN::Config->{username}; - $password = $CPAN::Config->{password} || ""; - return ($user, $password); + return CPAN::HTTP::Credentials->get_non_proxy_credentials(); } - my $username_prompt = "\nAuthentication needed! - (Note: to permanently configure username and password run - o conf username your_username - o conf password your_password - )\nUsername:"; - - ($user, $password) = - _get_username_and_password_from_user($username_prompt); - return ($user,$password); } -sub _get_username_and_password_from_user { - my $username_message = shift; - my ($username,$password); - - ExtUtils::MakeMaker->import(qw(prompt)); - $username = prompt($username_message); - if ($CPAN::META->has_inst("Term::ReadKey")) { - Term::ReadKey::ReadMode("noecho"); - } - else { - $CPAN::Frontend->mywarn( - "Warning: Term::ReadKey seems not to be available, your password will be echoed to the terminal!\n" - ); - } - $password = prompt("Password:"); - - if ($CPAN::META->has_inst("Term::ReadKey")) { - Term::ReadKey::ReadMode("restore"); - } - $CPAN::Frontend->myprint("\n\n"); - return ($username,$password); +sub no_proxy { + my ( $self, $no_proxy ) = @_; + return $self->SUPER::no_proxy( split(',',$no_proxy) ); } # mirror(): Its purpose is to deal with proxy authentication. When we @@ -125,8 +68,7 @@ sub mirror { my($self,$url,$aslocal) = @_; my $result = $self->SUPER::mirror($url,$aslocal); if ($result->code == 407) { - undef $USER; - undef $PASSWD; + CPAN::HTTP::Credentials->clear_credentials; $result = $self->SUPER::mirror($url,$aslocal); } $result; |