| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Idea of RequestAgent is cut-n-paste from lwp-request |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# If you know a better way of doing this, please let me know. |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# We make our own specialization of LWP::UserAgent that asks for |
|
6
|
|
|
|
|
|
|
# user/password if document is protected. |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# $Id: RequestAgent.pm,v 1.2 2000/04/10 03:49:57 mah Exp $ |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Image::Grab::RequestAgent; |
|
11
|
|
|
|
|
|
|
|
|
12
|
8
|
|
|
8
|
|
46
|
use strict; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
471
|
|
|
13
|
8
|
|
|
8
|
|
42
|
use vars qw($VERSION @ISA @EXPORT_OK); |
|
|
8
|
|
|
|
|
88
|
|
|
|
8
|
|
|
|
|
890
|
|
|
14
|
|
|
|
|
|
|
require LWP::UserAgent; |
|
15
|
|
|
|
|
|
|
@ISA = qw(LWP::UserAgent Exporter); |
|
16
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
|
17
|
|
|
|
|
|
|
&new |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
$VERSION='1.01'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
8
|
|
|
8
|
|
45
|
use Carp; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
2118
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %realm; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
|
26
|
11
|
|
|
11
|
1
|
84
|
my $that = shift; |
|
27
|
11
|
|
33
|
|
|
68
|
my $class = ref($that) || $that; |
|
28
|
11
|
|
|
|
|
129
|
my $self = LWP::UserAgent->new(@_); |
|
29
|
|
|
|
|
|
|
|
|
30
|
11
|
|
|
|
|
29465
|
$self->env_proxy; |
|
31
|
|
|
|
|
|
|
|
|
32
|
11
|
|
|
|
|
119421
|
bless $self, $class; |
|
33
|
11
|
|
|
|
|
160
|
return $self; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub register_realm { |
|
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
38
|
0
|
|
|
|
|
|
my $realm = shift; |
|
39
|
0
|
|
|
|
|
|
my $user = shift; |
|
40
|
0
|
|
|
|
|
|
my $pass = shift; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$realm{$realm}->{user} = $user; |
|
43
|
0
|
|
|
|
|
|
$realm{$realm}->{pass} = $pass; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub get_basic_credentials { |
|
47
|
0
|
|
|
0
|
1
|
|
my ($self, $realm) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if(defined $realm{$realm}) { |
|
50
|
0
|
|
|
|
|
|
return ($realm{$realm}->{user}, |
|
51
|
|
|
|
|
|
|
$realm{$realm}->{pass}); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |