| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5440
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
no warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
125
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
|
|
4
|
our $VERSION = '0.0200'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
|
11
|
1
|
50
|
|
1
|
|
167
|
if ($INC[0] =~ /^FatPacked::/) { |
|
12
|
0
|
|
|
|
|
0
|
require Clone::PP; |
|
13
|
0
|
|
|
|
|
0
|
$INC{'Clone.pm'} = $INC{'Clone/PP.pm'}; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
INIT { |
|
18
|
1
|
50
|
33
|
1
|
|
28618
|
if ($^O eq 'darwin' && $ENV{OBJC_DISABLE_INITIALIZE_FORK_SAFETY} ne 'YES') { |
|
19
|
0
|
|
|
|
|
0
|
$ENV{OBJC_DISABLE_INITIALIZE_FORK_SAFETY} = 'YES'; |
|
20
|
0
|
|
|
|
|
0
|
exec $^X, $0, @ARGV; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
BEGIN { |
|
25
|
1
|
|
|
1
|
|
73
|
*warnings::import = sub { }; |
|
|
|
|
|
57
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
11
|
use Config; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
82
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use constant SERVER => $ENV{PUREPROXY_SERVER} |
|
31
|
1
|
50
|
33
|
1
|
|
7
|
|| $Config{useithreads} ? 'Thrall' : 'Starlight'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
145
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
BEGIN { |
|
34
|
1
|
|
|
1
|
|
8
|
delete $ENV{http_proxy}; |
|
35
|
1
|
|
|
|
|
59
|
delete $ENV{https_proxy}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
814
|
use Plack::Builder; |
|
|
1
|
|
|
|
|
1764
|
|
|
|
1
|
|
|
|
|
104
|
|
|
39
|
1
|
|
|
1
|
|
663
|
use Plack::App::Proxy; |
|
|
1
|
|
|
|
|
8064
|
|
|
|
1
|
|
|
|
|
122
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $app = builder { |
|
42
|
1
|
|
|
1
|
|
61
|
enable 'Proxy::Connect::IO'; |
|
43
|
1
|
|
|
|
|
18048
|
enable 'Proxy::Requests'; |
|
44
|
1
|
|
|
|
|
168
|
Plack::App::Proxy->new(backend => 'HTTP::Tiny')->to_app; |
|
45
|
1
|
|
|
|
|
14
|
}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
2619
|
use Plack; |
|
|
1
|
|
|
|
|
153
|
|
|
|
1
|
|
|
|
|
54
|
|
|
48
|
1
|
|
|
1
|
|
894
|
use Plack::Runner; |
|
|
1
|
|
|
|
|
4164
|
|
|
|
1
|
|
|
|
|
86325
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
387
|
my $runner = Plack::Runner->new(server => SERVER, env => 'proxy', loader => 'Plack::Loader', version_cb => \&version,); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _version () { |
|
53
|
2
|
|
|
2
|
|
6
|
my $server = $runner->{server}; |
|
54
|
|
|
|
|
|
|
my $server_version |
|
55
|
|
|
|
|
|
|
= eval { Plack::Util::load_class($server); $server->VERSION } |
|
56
|
2
|
|
50
|
|
|
6
|
|| eval { Plack::Util::load_class("Plack::Handler::$server"); "Plack::Handler::$server"->VERSION } |
|
57
|
|
|
|
|
|
|
|| 0; |
|
58
|
2
|
|
|
|
|
51
|
return "PureProxy/$VERSION $server/$server_version Plack/" . Plack->VERSION . " Perl/$] ($^O)"; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub version { |
|
62
|
1
|
|
|
1
|
|
32
|
my ($class) = @_; |
|
63
|
1
|
|
|
|
|
3
|
print _version(), "\n"; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
22
|
$runner->parse_options('--max-workers=50', @ARGV); |
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
50
|
|
|
|
1973
|
if ($runner->{help}) { |
|
69
|
0
|
|
|
|
|
0
|
require Pod::Usage; |
|
70
|
0
|
|
|
|
|
0
|
Pod::Usage::pod2usage(-verbose => 99, -sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS", -input => \*DATA); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
5
|
my %options = @{ $runner->{options} }; |
|
|
1
|
|
|
|
|
5
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
1
|
50
|
|
|
|
29
|
if ($options{traffic_log}) { |
|
76
|
0
|
|
|
|
|
0
|
my $body_eol = $options{traffic_log_body_eol}; |
|
77
|
0
|
0
|
|
|
|
0
|
if ($options{traffic_log} ne '1') { |
|
78
|
0
|
0
|
|
|
|
0
|
open my $logfh, ">>", $options{traffic_log} or die "open($options{traffic_log}): $!"; |
|
79
|
0
|
|
|
|
|
0
|
$logfh->autoflush(1); |
|
80
|
|
|
|
|
|
|
$app = builder { |
|
81
|
|
|
|
|
|
|
enable 'TrafficLog', |
|
82
|
0
|
|
|
|
|
0
|
logger => sub { $logfh->print(@_) }, |
|
83
|
0
|
|
|
0
|
|
0
|
body_eol => $body_eol, |
|
84
|
|
|
|
|
|
|
with_body => !!$body_eol; |
|
85
|
0
|
|
|
|
|
0
|
$app; |
|
86
|
0
|
|
|
|
|
0
|
}; |
|
87
|
|
|
|
|
|
|
} else { |
|
88
|
0
|
|
|
0
|
|
0
|
$app = builder { enable 'TrafficLog', body_eol => $body_eol, with_body => !!$body_eol; $app; }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
1
|
50
|
33
|
|
|
45
|
if (not defined $runner->{access_log} or $runner->{access_log} eq '1') { |
|
93
|
1
|
|
|
|
|
4
|
$runner->{access_log} = undef; |
|
94
|
1
|
|
|
1
|
|
16
|
$app = builder { enable 'AccessLog'; $app; }; |
|
|
1
|
|
|
|
|
92
|
|
|
|
1
|
|
|
|
|
15780
|
|
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
957
|
push @{ $runner->{options} }, 'server_software', _version(); |
|
|
1
|
|
|
|
|
8
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
1
|
|
|
|
|
11
|
$runner->run($app); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__DATA__ |