line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Docker::Registry::IO::Simple; |
2
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
3
|
1
|
|
|
1
|
|
375
|
use Types::Standard qw/Bool/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
with 'Docker::Registry::IO'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1461
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
41663
|
|
|
1
|
|
|
|
|
46
|
|
7
|
1
|
|
|
1
|
|
682
|
use Data::Dumper; |
|
1
|
|
|
|
|
6374
|
|
|
1
|
|
|
|
|
250
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has debug => (is => 'rw', isa => Bool, default => 0); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has ua => (is => 'ro', default => sub { |
12
|
|
|
|
|
|
|
HTTP::Tiny->new( |
13
|
|
|
|
|
|
|
max_redirect => 0, |
14
|
|
|
|
|
|
|
agent => 'Docker::Registry Perl client' . $Docker::Registry::VERSION, |
15
|
|
|
|
|
|
|
timeout => 60, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
}); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub send_request { |
20
|
0
|
|
|
0
|
|
|
my ($self, $request) = @_; |
21
|
0
|
|
|
|
|
|
my $headers = $request->header_hash; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# HTTP::Tiny derives the Host header from the URL. It's an error to set it. |
24
|
0
|
|
|
|
|
|
delete $headers->{Host}; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
print Dumper($request) if ($self->debug); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
my $response = $self->ua->request( |
29
|
|
|
|
|
|
|
$request->method, |
30
|
|
|
|
|
|
|
$request->url, |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
headers => $headers, |
33
|
|
|
|
|
|
|
(defined $request->content)?(content => $request->content):(), |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
); |
36
|
0
|
0
|
|
|
|
|
print Dumper($response) if ($self->debug); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return Docker::Registry::Response->new( |
39
|
|
|
|
|
|
|
status => $response->{status}, |
40
|
|
|
|
|
|
|
content => $response->{content}, |
41
|
|
|
|
|
|
|
headers => $response->{headers} |
42
|
0
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |