Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub get {
- my($self, $uri, $cb_gen) = @_;
- my $http = HTTP::Lite->new;
- $http->http11_mode(1); # hopefully, CPAN mirrors can handle this
- my $retries = 0;
- while ( $retries++ < 5 ) {
- my $rc = $self->_make_request( $http, $uri, $data_cb );
- if ( $rc == 401 ) {
- last unless $self->_prepare_auth( $http, 'non_proxy' );
- }
- elsif ( $rc == 407 ) {
- last unless $self->_prepare_auth( $http, 'proxy' );
- }
- elsif ( $rc == 301 || $rc == 302 ) {
- $uri = $self->_get_redirect( $http, $uri );
- }
- else {
- last;
- }
- }
- return $http;
- }
Add Comment
Please, Sign In to add comment