line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PAD::Plugin; |
2
|
3
|
|
|
3
|
|
21200
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
90
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
61
|
|
4
|
3
|
|
|
3
|
|
13
|
use Carp (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
39
|
|
5
|
3
|
|
|
3
|
|
13
|
use File::Spec::Unix; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
864
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
5
|
|
|
5
|
0
|
51
|
my ($class, %args) = @_; |
9
|
5
|
|
|
|
|
24
|
bless { %args }, $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
3046
|
sub suffix { qr/.+/ } |
13
|
1
|
|
|
1
|
1
|
4
|
sub content_type { 'text/plain; charset=UTF-8' } |
14
|
|
|
|
|
|
|
|
15
|
9
|
|
|
9
|
1
|
40
|
sub request { shift->{request} } |
16
|
|
|
|
|
|
|
sub relative_path { # extracted from Plack::App::File :) |
17
|
6
|
|
|
6
|
1
|
3450
|
my $self = shift; |
18
|
6
|
|
|
|
|
39
|
my $path = $self->request->path_info; |
19
|
|
|
|
|
|
|
|
20
|
6
|
100
|
|
|
|
25
|
if ($path =~ /\0/) { |
21
|
1
|
|
|
|
|
158
|
Carp::croak "Bad Request"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
21
|
my @path = split '/', $path; |
25
|
5
|
50
|
|
|
|
17
|
if (@path) { |
26
|
5
|
50
|
|
|
|
16
|
if ($path[0] eq '') { |
27
|
|
|
|
|
|
|
shift @path |
28
|
5
|
|
|
|
|
8
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
|
|
|
|
0
|
@path = '.'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
5
|
100
|
|
|
|
10
|
if (grep { $_ eq '..' } @path) { |
|
12
|
|
|
|
|
30
|
|
35
|
2
|
|
|
|
|
180
|
Carp::croak "Forbidden"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
42
|
File::Spec::Unix->catfile('.', @path); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
1
|
3
|
sub execute { shift->request->new_response(501)->finalize } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
__END__ |