line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Helper::UserAgent; |
6
|
|
|
|
|
|
|
|
7
|
32
|
|
|
32
|
|
429
|
use v5.12.5; |
|
32
|
|
|
|
|
124
|
|
8
|
32
|
|
|
32
|
|
197
|
use warnings; |
|
32
|
|
|
|
|
91
|
|
|
32
|
|
|
|
|
1603
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.3'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
32
|
|
|
32
|
|
222
|
use base 'LWP::UserAgent'; |
|
32
|
|
|
|
|
192
|
|
|
32
|
|
|
|
|
1480
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
1
|
|
my $that = shift; |
16
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
17
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get_basic_credentials { |
25
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
0
|
|
|
|
if ( exists $self->{__user__} && $self->{__password__} ) { |
28
|
0
|
|
|
|
|
|
return $self->{__user__}, $self->{__password__}; |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get { |
34
|
0
|
|
|
0
|
1
|
|
my ( $self, $url, %option ) = @_; |
35
|
0
|
0
|
|
|
|
|
if ( exists $option{user} ) { |
36
|
0
|
|
|
|
|
|
$self->{__user__} = $option{user}; |
37
|
|
|
|
|
|
|
} |
38
|
0
|
0
|
|
|
|
|
if ( exists $option{password} ) { |
39
|
0
|
|
|
|
|
|
$self->{__password__} = $option{password}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self->SUPER::get($url); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |