| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::LWPish; |
|
2
|
52
|
|
|
52
|
|
265
|
use strict; |
|
|
52
|
|
|
|
|
58
|
|
|
|
52
|
|
|
|
|
1441
|
|
|
3
|
52
|
|
|
52
|
|
164
|
use warnings; |
|
|
52
|
|
|
|
|
430
|
|
|
|
52
|
|
|
|
|
1991
|
|
|
4
|
52
|
|
|
52
|
|
28640
|
use HTTP::Tiny; |
|
|
52
|
|
|
|
|
557146
|
|
|
|
52
|
|
|
|
|
1902
|
|
|
5
|
52
|
|
|
52
|
|
15412
|
use HTTP::Response; |
|
|
52
|
|
|
|
|
213561
|
|
|
|
52
|
|
|
|
|
1513
|
|
|
6
|
52
|
|
|
52
|
|
4924
|
use Hash::MultiValue; |
|
|
52
|
|
|
|
|
14678
|
|
|
|
52
|
|
|
|
|
11720
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
17
|
|
|
17
|
0
|
83
|
my $class = shift; |
|
10
|
17
|
|
|
|
|
80
|
my $self = bless {}, $class; |
|
11
|
17
|
50
|
|
|
|
599
|
$self->{http} = @_ == 1 ? $_[0] : HTTP::Tiny->new(verify_SSL => 1, @_); |
|
12
|
17
|
|
|
|
|
3388
|
$self; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub request { |
|
16
|
89
|
|
|
89
|
0
|
194
|
my($self, $req) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
89
|
|
|
|
|
127
|
my @headers; |
|
19
|
89
|
|
|
107
|
|
443
|
$req->headers->scan(sub { push @headers, @_ }); |
|
|
107
|
|
|
|
|
2912
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
89
|
|
|
|
|
2307
|
my $options = { |
|
22
|
|
|
|
|
|
|
headers => Hash::MultiValue->new(@headers)->mixed, |
|
23
|
|
|
|
|
|
|
}; |
|
24
|
89
|
100
|
66
|
|
|
6844
|
$options->{content} = $req->content if defined $req->content && length($req->content); |
|
25
|
|
|
|
|
|
|
|
|
26
|
89
|
|
|
|
|
3344
|
my $response = $self->{http}->request($req->method, $req->url, $options); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $res = HTTP::Response->new( |
|
29
|
|
|
|
|
|
|
$response->{status}, |
|
30
|
|
|
|
|
|
|
$response->{reason}, |
|
31
|
|
|
|
|
|
|
[ Hash::MultiValue->from_mixed($response->{headers})->flatten ], |
|
32
|
|
|
|
|
|
|
$response->{content}, |
|
33
|
89
|
|
|
|
|
32938989
|
); |
|
34
|
89
|
|
|
|
|
28448
|
$res->request($req); |
|
35
|
|
|
|
|
|
|
|
|
36
|
89
|
|
|
|
|
3115
|
return $res; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |