Client.pm (CPAN-2.34) | : | Client.pm (CPAN-2.35) | ||
---|---|---|---|---|
# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | |||
# vim: ts=4 sts=4 sw=4: | # vim: ts=4 sts=4 sw=4: | |||
package CPAN::HTTP::Client; | package CPAN::HTTP::Client; | |||
use strict; | use strict; | |||
use vars qw(@ISA); | use vars qw(@ISA); | |||
use CPAN::HTTP::Credentials; | use CPAN::HTTP::Credentials; | |||
use HTTP::Tiny 0.005; | use HTTP::Tiny 0.005; | |||
$CPAN::HTTP::Client::VERSION = $CPAN::HTTP::Client::VERSION = "1.9601"; | $CPAN::HTTP::Client::VERSION = $CPAN::HTTP::Client::VERSION = "1.9602"; | |||
# CPAN::HTTP::Client is adapted from parts of cpanm by Tatsuhiko Miyagawa | # CPAN::HTTP::Client is adapted from parts of cpanm by Tatsuhiko Miyagawa | |||
# and parts of LWP by Gisle Aas | # and parts of LWP by Gisle Aas | |||
sub new { | sub new { | |||
my $class = shift; | my $class = shift; | |||
my %args = @_; | my %args = @_; | |||
for my $k ( keys %args ) { | for my $k ( keys %args ) { | |||
$args{$k} = '' unless defined $args{$k}; | $args{$k} = '' unless defined $args{$k}; | |||
} | } | |||
skipping to change at line 35 | skipping to change at line 35 | |||
# response structure generated by HTTP::Tiny | # response structure generated by HTTP::Tiny | |||
# | # | |||
# If authentication fails, it will attempt to get new authentication | # If authentication fails, it will attempt to get new authentication | |||
# information and repeat up to 5 times | # information and repeat up to 5 times | |||
sub mirror { | sub mirror { | |||
my($self, $uri, $path) = @_; | my($self, $uri, $path) = @_; | |||
my $want_proxy = $self->_want_proxy($uri); | my $want_proxy = $self->_want_proxy($uri); | |||
my $http = HTTP::Tiny->new( | my $http = HTTP::Tiny->new( | |||
verify_SSL => 1, | ||||
$want_proxy ? (proxy => $self->{proxy}) : () | $want_proxy ? (proxy => $self->{proxy}) : () | |||
); | ); | |||
my ($response, %headers); | my ($response, %headers); | |||
my $retries = 0; | my $retries = 0; | |||
while ( $retries++ < 5 ) { | while ( $retries++ < 5 ) { | |||
$response = $http->mirror( $uri, $path, {headers => \%headers} ); | $response = $http->mirror( $uri, $path, {headers => \%headers} ); | |||
if ( $response->{status} eq '401' ) { | if ( $response->{status} eq '401' ) { | |||
last unless $self->_get_auth_params( $response, 'non_proxy' ); | last unless $self->_get_auth_params( $response, 'non_proxy' ); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |