FramesReady

 view release on metacpan or  search on metacpan

lib/LWP/UserAgent/FramesReady.pm  view on Meta::CPAN

=item $ua->size([$size])

Get/Set the size suggested for chunks when the callback routine is used.

=item $ua->nomax([$max])

Get/set the B<$self->{'nomax'}> can be used by the included callback
routine to enforce truncation of received content even if the request
to do so is not honored by the server called for the content.

=item $ua->credent([$credentials])

Get/set the credentials for authentification if called for.

=item $ua->errors()

Get the last error encountered if a return was an undef.  This routine
has only been tested in development so there is no guarantee that it
will work within your functions.

=cut

sub callbk   { shift->_elem('callback', @_); }

lib/LWP/UserAgent/FramesReady.pm  view on Meta::CPAN

    }

    if ($scheme && ! grep {$scheme eq $_} @schema) {
        $self->{'errstring'} = "Invalid scheme [$scheme]";
        return 0;
    }

    return 1;
}

=item $ua->get_basic_credentials()

This routine overloads the LWP::UserAgent::get_basic_credentials in
order to supply authorization if it has been pre-loaded an initial/new
or by use of the $ua->credent() routine.  Supplies a return in a list
context of a UserID and a Password to LWP::UserAgent::credentials().

=cut

sub get_basic_credentials {
    my($self, $realm, $uri) = @_;

    $self->{'errstring'} = '';
    if ($self->{credent}) {
        return split(':', $self->{credent}, 2);
    } else {
        $self->{'errstring'} = "Not found: Credent $realm";
        return (undef, undef);
    }
}

t/local/http.t  view on Meta::CPAN

    }
    else {
        $c->send_basic_header(401);
	$c->print("WWW-Authenticate: Basic realm=\"libwww-perl\"\015\012");
	$c->send_crlf;
    }
}

{
   package MyUA; @ISA=qw(LWP::UserAgent);
   sub get_basic_credentials {
      my($self, $realm, $uri, $proxy) = @_;
      if ($realm eq "libwww-perl" && $uri->rel($base) eq "basic") {
	  return ("ok 12", "xyzzy");
      }
      else {
          return undef;
      }
   }
}
$req = new HTTP::Request GET => url("/basic", $base);
$res = MyUA->new->request($req);
#print $res->as_string;

print "not " unless $res->is_success;
print $res->content;

# Let's try with a $ua that does not pass out credentials
$res = $ua->request($req);
print "not " unless $res->code == 401;
print "ok 13\n";

# Let's try to set credentials for this realm
$ua->credentials($req->url->host_port, "libwww-perl", "ok 12", "xyzzy");
$res = $ua->request($req);
print "not " unless $res->is_success;
print "ok 14\n";

# Then illegal credentials
$ua->credentials($req->url->host_port, "libwww-perl", "user", "passwd");
$res = $ua->request($req);
print "not " unless $res->code == 401;
print "ok 15\n";


#----------------------------------------------------------------
print "Check proxy...\n";
sub httpd_get_proxy
{
   my($c,$r) = @_;



( run in 0.242 second using v1.01-cache-2.11-cpan-4d50c553e7e )