line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Session::State::URI; |
2
|
2
|
|
|
2
|
|
260486
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
68
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
90
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1583
|
use parent 'Plack::Session::State'; |
|
2
|
|
|
|
|
640
|
|
|
2
|
|
|
|
|
15
|
|
7
|
2
|
|
|
2
|
|
150402
|
use Plack::Request; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
41
|
|
8
|
2
|
|
|
2
|
|
1070
|
use Plack::Util; |
|
2
|
|
|
|
|
6824
|
|
|
2
|
|
|
|
|
56
|
|
9
|
2
|
|
|
2
|
|
2502
|
use Encode (); |
|
2
|
|
|
|
|
32998
|
|
|
2
|
|
|
|
|
57
|
|
10
|
2
|
|
|
2
|
|
2545
|
use HTML::StickyQuery; |
|
2
|
|
|
|
|
25681
|
|
|
2
|
|
|
|
|
1133
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub get_session_id { |
13
|
4
|
|
|
4
|
1
|
59547
|
my ($self, $env) = @_; |
14
|
4
|
|
|
|
|
531
|
Plack::Request->new($env)->param($self->session_key); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub finalize { |
18
|
4
|
|
|
4
|
1
|
12217
|
my ($self, $id, $res) = @_; |
19
|
|
|
|
|
|
|
|
20
|
4
|
50
|
|
|
|
23
|
return unless $id; |
21
|
|
|
|
|
|
|
|
22
|
4
|
100
|
|
|
|
28
|
if ($res->[0] == 200) { |
|
|
50
|
|
|
|
|
|
23
|
3
|
|
|
|
|
15
|
$self->html_filter($id, $res); |
24
|
|
|
|
|
|
|
} elsif ($res->[0] == 302) { |
25
|
1
|
|
|
|
|
6
|
$self->redirect_filter($id, $res); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub html_filter { |
30
|
3
|
|
|
3
|
0
|
10
|
my ($self, $id, $res) = @_; |
31
|
|
|
|
|
|
|
|
32
|
3
|
50
|
|
|
|
16
|
return if (ref $res->[2]) ne 'ARRAY'; |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
8
|
my $encode = 'utf8'; |
35
|
3
|
|
|
|
|
19
|
my $h = Plack::Util::headers($res->[1]); |
36
|
3
|
50
|
|
|
|
218
|
if ($h->get('Content-Type')=~m|^text/\w+;\s*charset="?([^"]+)"?|i) { |
37
|
3
|
|
|
|
|
607
|
$encode = $1; |
38
|
|
|
|
|
|
|
} |
39
|
3
|
|
|
|
|
17
|
my $name = $self->session_key; |
40
|
3
|
|
|
|
|
19
|
my $body = ''; |
41
|
3
|
|
|
|
|
6
|
for my $line (@{ $res->[2] }) { |
|
3
|
|
|
|
|
10
|
|
42
|
3
|
50
|
|
|
|
17
|
$body .= $line if length $line; |
43
|
|
|
|
|
|
|
} |
44
|
3
|
|
|
|
|
22
|
$body = Encode::decode($encode, $body); |
45
|
3
|
|
|
|
|
386
|
$body =~ s{( |
46
|
3
|
|
|
|
|
32
|
my $sticky = HTML::StickyQuery->new; |
47
|
3
|
|
|
|
|
298
|
$body = $sticky->sticky( |
48
|
|
|
|
|
|
|
scalarref => \$body, |
49
|
|
|
|
|
|
|
param => { $name => $id } |
50
|
|
|
|
|
|
|
); |
51
|
3
|
|
|
|
|
1438
|
$res->[2] = [ Encode::encode($encode, $body) ]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub redirect_filter { |
55
|
1
|
|
|
1
|
0
|
3
|
my ($self, $id, $res) = @_; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
6
|
my $h = Plack::Util::headers($res->[1]); |
58
|
1
|
|
|
|
|
39
|
my $path = $h->get('Location'); |
59
|
1
|
|
|
|
|
47
|
my $uri = URI->new($path); |
60
|
1
|
|
|
|
|
88
|
$uri->query_form( $uri->query_form, $self->session_key, $id ); |
61
|
1
|
|
|
|
|
232
|
$h->set('Location', $uri->as_string); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
__END__ |