line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ACME::HTTP::Response; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
128860
|
use strict; |
|
8
|
|
|
|
|
26
|
|
|
8
|
|
|
|
|
243
|
|
4
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
225
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
41
|
use parent qw( HTTP::Tiny::UA::Response ); |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
5424
|
use Call::Context (); |
|
8
|
|
|
|
|
788
|
|
|
8
|
|
|
|
|
136
|
|
9
|
8
|
|
|
8
|
|
42
|
use JSON (); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
135
|
|
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
8
|
|
428
|
use Net::ACME::X (); |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
2350
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub die_because_unexpected { |
14
|
4
|
|
|
4
|
0
|
836
|
my ($self) = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
117
|
die Net::ACME::X::create( |
17
|
|
|
|
|
|
|
'UnexpectedResponse', |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
uri => $self->url(), |
20
|
|
|
|
|
|
|
status => $self->status(), |
21
|
|
|
|
|
|
|
reason => $self->reason(), |
22
|
|
|
|
|
|
|
headers => $self->headers(), |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#Useful for everything but certificate issuance, apparently? |
28
|
|
|
|
|
|
|
sub content_struct { |
29
|
10
|
|
|
10
|
0
|
11175
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
|
31
|
10
|
|
|
|
|
359
|
return JSON->new()->allow_nonref()->decode( $self->content() ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#A “poor man’s Link header parser” that only knows how to handle |
35
|
|
|
|
|
|
|
#these values as described in the ACME protocol spec: |
36
|
|
|
|
|
|
|
#a single “rel” parameter, and no extra whitespace. |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
#This returns key/value pairs. They should probably go into a hash, |
39
|
|
|
|
|
|
|
#but I don’t see anything in the spec that says the same “rel” |
40
|
|
|
|
|
|
|
#parameter can’t occur twice. |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
#If we need something more robust down the line, |
43
|
|
|
|
|
|
|
#HTTP::Link::Parser::parse_single_link() may do the trick. |
44
|
|
|
|
|
|
|
sub links { |
45
|
8
|
|
|
8
|
0
|
3430
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
8
|
|
|
|
|
94
|
Call::Context::must_be_list(); |
48
|
|
|
|
|
|
|
|
49
|
8
|
|
|
|
|
215
|
my $links_ar = $self->header('link'); |
50
|
8
|
100
|
|
|
|
100
|
if ( !ref $links_ar ) { |
51
|
5
|
|
66
|
|
|
59
|
$links_ar = [ $links_ar || () ]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
8
|
|
|
|
|
19
|
my @resp; |
55
|
|
|
|
|
|
|
|
56
|
8
|
|
|
|
|
23
|
for my $l (@$links_ar) { |
57
|
8
|
100
|
|
|
|
68
|
$l =~ m/\A<([^>]+)>;rel="([^"]+)"\z/ or do { |
58
|
1
|
|
|
|
|
18
|
warn "Unrecognized link: “$l”"; |
59
|
1
|
|
|
|
|
8
|
next; |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
35
|
push @resp, $2, $1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
8
|
|
|
|
|
71
|
return @resp; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |