| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
1133
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
38
|
|
|
2
|
|
|
|
|
|
|
package Siesta::Web; |
|
3
|
1
|
|
|
1
|
|
6
|
use Apache::Constants qw( :common ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Template; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
15
|
|
|
5
|
1
|
|
|
1
|
|
848
|
use Apache::Session::SharedMem; |
|
|
1
|
|
|
|
|
16206
|
|
|
|
1
|
|
|
|
|
13
|
|
|
6
|
1
|
|
|
1
|
|
35
|
use CGI; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
7
|
1
|
|
|
1
|
|
62
|
use Siesta; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
7
|
|
|
8
|
1
|
|
|
1
|
|
26
|
use Siesta::Config; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
38
|
use constant Cookie => 'siesta_session'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
542
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
PerlModule Siesta::Web |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
SetHandler perl-script |
|
17
|
|
|
|
|
|
|
PerlHandler Siesta::Web |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $tt; |
|
23
|
|
|
|
|
|
|
sub handler { |
|
24
|
0
|
|
|
0
|
0
|
|
my $r = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $file = $r->filename; |
|
27
|
0
|
0
|
|
|
|
|
$file =~ /\.tt2$/ or return DECLINED; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $cgi = CGI->new; |
|
30
|
0
|
|
|
|
|
|
my $session_id = $cgi->cookie( Cookie ); |
|
31
|
0
|
|
|
|
|
|
my %session; |
|
32
|
|
|
|
|
|
|
# try the session in the cookie, or a new one |
|
33
|
0
|
|
|
|
|
|
for my $id ($session_id, undef) { |
|
34
|
0
|
|
|
|
|
|
eval { |
|
35
|
0
|
|
|
|
|
|
tie %session, 'Apache::Session::SharedMem', $id, |
|
36
|
|
|
|
|
|
|
+{ expires_in => 24 * 60 * 60 }; # 24 hours |
|
37
|
|
|
|
|
|
|
}; |
|
38
|
0
|
0
|
|
|
|
|
last unless $@; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
unless ( $session{_session_id} ) { |
|
42
|
0
|
|
|
|
|
|
$r->log_reason( "couldn't get session" ); |
|
43
|
0
|
|
|
|
|
|
return SERVER_ERROR; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my @headers = ( |
|
47
|
|
|
|
|
|
|
[ 'Set-Cookie' => |
|
48
|
|
|
|
|
|
|
$cgi->cookie(-name => Cookie, |
|
49
|
|
|
|
|
|
|
-value => $session{_session_id}) ] |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $params = { |
|
53
|
0
|
|
|
0
|
|
|
set_header => sub { push @headers, @_; return }, |
|
|
0
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
uri => $r->uri, |
|
55
|
|
|
|
|
|
|
cgi => $cgi, |
|
56
|
|
|
|
|
|
|
session => \%session, |
|
57
|
|
|
|
|
|
|
}; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $root = $Siesta::Config::config->root; |
|
60
|
0
|
|
0
|
|
|
|
$tt ||= Template->new( |
|
61
|
|
|
|
|
|
|
ABSOLUTE => 1, |
|
62
|
|
|
|
|
|
|
INCLUDE_PATH => "$root/web-frontend/siesta:$root/web-frontend/lib" ); |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $out; |
|
65
|
|
|
|
|
|
|
$tt->process($file, $params, \$out) |
|
66
|
0
|
0
|
|
|
|
|
or do { |
|
67
|
0
|
|
|
|
|
|
$r->log_reason( $tt->error ); |
|
68
|
0
|
|
|
|
|
|
return SERVER_ERROR; |
|
69
|
|
|
|
|
|
|
}; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$r->header_out( @$_ ) for @headers; |
|
72
|
0
|
|
|
|
|
|
$r->content_type('text/html'); |
|
73
|
0
|
|
|
|
|
|
$r->send_http_header; |
|
74
|
0
|
|
|
|
|
|
$r->print( $out ); |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return OK; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |