line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#$Id$ |
2
|
|
|
|
|
|
|
package REST::Neo4p::Agent::LWP::UserAgent; |
3
|
4
|
|
|
4
|
|
38
|
use base qw/LWP::UserAgent REST::Neo4p::Agent/; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1270
|
|
4
|
4
|
|
|
4
|
|
2354
|
use LWP::Authen::Basic; |
|
4
|
|
|
|
|
74598
|
|
|
4
|
|
|
|
|
183
|
|
5
|
4
|
|
|
4
|
|
1987
|
use LWP::ConnCache; |
|
4
|
|
|
|
|
5101
|
|
|
4
|
|
|
|
|
133
|
|
6
|
4
|
|
|
4
|
|
29
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
105
|
|
7
|
4
|
|
|
4
|
|
38
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
170
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
4
|
|
|
4
|
|
844
|
$REST::Neo4p::Agent::LWP::UserAgent::VERSION = '0.4003'; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
sub new { |
12
|
4
|
|
|
4
|
1
|
19
|
my ($class,@args) = @_; |
13
|
4
|
|
|
|
|
97
|
my $self = $class->SUPER::new(@_); |
14
|
|
|
|
|
|
|
#This really helps server not to be blown by TIME_WAIT'ed sockets. |
15
|
|
|
|
|
|
|
#If load is high - even if 1 thread is used - |
16
|
|
|
|
|
|
|
#with disabled keep-alive sockets are screwed on the server side. |
17
|
4
|
|
|
|
|
10255
|
my $cache = LWP::ConnCache->new; |
18
|
|
|
|
|
|
|
#TODO FIXME This number should be configurable in some comfortable way |
19
|
4
|
|
|
|
|
190
|
$cache->total_capacity([30]); |
20
|
4
|
|
|
|
|
119
|
$self->conn_cache($cache); |
21
|
4
|
|
|
|
|
75
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
0
|
0
|
|
sub add_header { shift->default_headers->header(@_) } |
24
|
0
|
|
|
0
|
0
|
|
sub remove_header { shift->default_headers->remove_header($_[0]) } |
25
|
|
|
|
|
|
|
sub credentials { |
26
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
27
|
0
|
|
|
|
|
|
my ($host, $realm, $user, $pass) = @_; |
28
|
0
|
0
|
0
|
|
|
|
if ($user && $pass) { |
29
|
0
|
|
|
|
|
|
$self->default_header( |
30
|
|
|
|
|
|
|
Authorization => LWP::Authen::Basic->auth_header($user, $pass) |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
1; |