line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Apache::ASP::Server; |
3
|
46
|
|
|
46
|
|
317
|
use strict; |
|
46
|
|
|
|
|
103
|
|
|
46
|
|
|
|
|
2111
|
|
4
|
46
|
|
|
46
|
|
1228
|
use vars qw($OLESupport); |
|
46
|
|
|
|
|
98
|
|
|
46
|
|
|
|
|
97503
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
0
|
0
|
bless {asp => $_[0]}; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub CreateObject { |
11
|
0
|
|
|
0
|
0
|
0
|
my($self, $name) = @_; |
12
|
0
|
|
|
|
|
0
|
my $asp = $self->{asp}; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# dynamically load OLE at request time, especially since |
15
|
|
|
|
|
|
|
# at server startup, this seems to fail with "start_mutex" error |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# no reason to preload this unix style when module loads |
18
|
|
|
|
|
|
|
# because in win32, threaded model does not need this prefork |
19
|
|
|
|
|
|
|
# parent httpd compilation |
20
|
|
|
|
|
|
|
# |
21
|
0
|
0
|
|
|
|
0
|
unless(defined $OLESupport) { |
22
|
0
|
|
|
|
|
0
|
eval 'use Win32::OLE'; |
23
|
0
|
0
|
|
|
|
0
|
if($@) { |
24
|
0
|
|
|
|
|
0
|
$OLESupport = 0; |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
0
|
$OLESupport = 1; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
0
|
unless($OLESupport) { |
31
|
0
|
|
|
|
|
0
|
die "OLE-active objects not supported for this platform, ". |
32
|
|
|
|
|
|
|
"try installing Win32::OLE"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
0
|
unless($name) { |
36
|
0
|
|
|
|
|
0
|
die "no object to create"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
Win32::OLE->new($name); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub Execute { |
43
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
44
|
0
|
|
|
|
|
0
|
$self->{asp}{Response}->Include(@_); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub File { |
48
|
4
|
|
|
4
|
0
|
134
|
shift->{asp}{filename}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub Transfer { |
52
|
3
|
|
|
3
|
0
|
33
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
5
|
my $file = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# find the file we are about to execute, and alias $0 to it |
57
|
3
|
|
|
|
|
5
|
my $file_found; |
58
|
3
|
100
|
|
|
|
18
|
if(ref($file)) { |
59
|
1
|
50
|
|
|
|
4
|
if($file->{File}) { |
60
|
1
|
|
|
|
|
6
|
$file_found = $self->{asp}->SearchDirs($file->{File}); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} else { |
63
|
2
|
|
|
|
|
8
|
$file_found = $self->{asp}->SearchDirs($file); |
64
|
|
|
|
|
|
|
} |
65
|
3
|
50
|
|
|
|
11
|
my $file_final = defined($file_found) ? $file_found : $0; |
66
|
|
|
|
|
|
|
|
67
|
3
|
|
|
|
|
7
|
local *0 = \$file_final; |
68
|
3
|
|
|
|
|
47
|
$self->{asp}{Response}->Include($file, @_); |
69
|
2
|
|
|
|
|
11
|
$self->{asp}{Response}->End; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# shamelessly ripped off from CGI.pm, by Lincoln D. Stein. |
73
|
|
|
|
|
|
|
sub URLEncode { |
74
|
10
|
|
|
10
|
0
|
20
|
my $toencode = $_[1]; |
75
|
10
|
|
|
|
|
24
|
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/esg; |
|
1
|
|
|
|
|
9
|
|
76
|
10
|
|
|
|
|
35
|
$toencode; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub HTMLDecode { |
80
|
33
|
|
|
33
|
0
|
78
|
my($self, $decode) = @_; |
81
|
|
|
|
|
|
|
|
82
|
33
|
|
|
|
|
111
|
$decode=~s/>/>/sg; |
83
|
33
|
|
|
|
|
63
|
$decode=~s/</
|
84
|
33
|
|
|
|
|
83
|
$decode=~s/'/'/sg; |
85
|
33
|
|
|
|
|
340
|
$decode=~s/"/\"/sg; |
86
|
33
|
|
|
|
|
61
|
$decode=~s/&/\&/sg; |
87
|
|
|
|
|
|
|
|
88
|
33
|
|
|
|
|
102
|
$decode; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub HTMLEncode { |
92
|
35
|
|
|
35
|
0
|
101
|
my($self, $toencode) = @_; |
93
|
35
|
50
|
|
|
|
84
|
return '' unless defined $toencode; |
94
|
|
|
|
|
|
|
|
95
|
35
|
|
|
|
|
55
|
my $data_ref; |
96
|
35
|
100
|
|
|
|
74
|
if(ref $toencode) { |
97
|
1
|
|
|
|
|
2
|
$data_ref = $toencode; |
98
|
|
|
|
|
|
|
} else { |
99
|
34
|
|
|
|
|
54
|
$data_ref = \$toencode; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
35
|
|
|
|
|
72
|
$$data_ref =~ s/&/&/sg; |
103
|
35
|
|
|
|
|
69
|
$$data_ref =~ s/\"/"/sg; |
104
|
35
|
|
|
|
|
647
|
$$data_ref =~ s/\'/'/sg; |
105
|
35
|
|
|
|
|
98
|
$$data_ref =~ s/>/>/sg; |
106
|
35
|
|
|
|
|
66
|
$$data_ref =~ s/</sg; |
107
|
|
|
|
|
|
|
|
108
|
35
|
100
|
|
|
|
147
|
ref($toencode) ? $data_ref : $$data_ref; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub RegisterCleanup { |
112
|
0
|
|
|
0
|
0
|
0
|
my($self, $code) = @_; |
113
|
0
|
0
|
|
|
|
0
|
if(ref($code) =~ /^CODE/) { |
114
|
0
|
0
|
|
|
|
0
|
$self->{asp}{dbg} && $self->{asp}->Debug("RegisterCleanup() called", caller()); |
115
|
0
|
|
|
|
|
0
|
push(@{$self->{asp}{cleanup}}, $code); |
|
0
|
|
|
|
|
0
|
|
116
|
|
|
|
|
|
|
} else { |
117
|
0
|
|
|
|
|
0
|
$self->{asp}->Error("$code need to be a perl sub reference, see README"); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub MapInclude { |
122
|
4
|
|
|
4
|
0
|
52
|
my($self, $file) = @_; |
123
|
4
|
|
|
|
|
15
|
$self->{asp}->SearchDirs($file); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub MapPath { |
127
|
0
|
|
|
0
|
0
|
0
|
my($self, $path) = @_; |
128
|
0
|
|
|
|
|
0
|
my $subr = $self->{asp}{r}->lookup_uri($path); |
129
|
0
|
0
|
|
|
|
0
|
$subr ? $subr->filename : undef; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
*SendMail = *Mail; |
133
|
|
|
|
|
|
|
sub Mail { |
134
|
0
|
|
|
0
|
0
|
0
|
shift->{asp}->SendMail(@_); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub URL { |
138
|
4
|
|
|
4
|
0
|
29
|
my($self, $url, $params) = @_; |
139
|
4
|
|
100
|
|
|
15
|
$params ||= {}; |
140
|
|
|
|
|
|
|
|
141
|
4
|
100
|
|
|
|
22
|
if($url =~ s/\?(.*)$//is) { |
142
|
1
|
|
|
|
|
9
|
my $old_params = $self->{asp}{Request}->ParseParams($1); |
143
|
1
|
|
50
|
|
|
4
|
$old_params ||= {}; |
144
|
1
|
|
|
|
|
6
|
$params = { %$old_params, %$params }; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
4
|
|
|
|
|
23
|
my $asp = $self->{asp}; |
148
|
4
|
50
|
66
|
|
|
25
|
if($asp->{session_url} && $asp->{session_id} && ! $asp->{session_cookie}) { |
|
|
|
66
|
|
|
|
|
149
|
1
|
|
|
|
|
3
|
my $match = $asp->{session_url_match}; |
150
|
1
|
50
|
33
|
|
|
43
|
if( |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
151
|
|
|
|
|
|
|
# if we have match expression, try it |
152
|
|
|
|
|
|
|
($match && $url =~ /$match/) |
153
|
|
|
|
|
|
|
# then if server path, check matches cookie space |
154
|
|
|
|
|
|
|
|| ($url =~ m|^/| and $url =~ m|^$asp->{cookie_path}|) |
155
|
|
|
|
|
|
|
# then do all local paths, matching NOT some URI PROTO |
156
|
|
|
|
|
|
|
|| ($url !~ m|^[^\?\/]+?:|) |
157
|
|
|
|
|
|
|
) |
158
|
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
|
# this should overwrite an incorrectly passed in data |
160
|
1
|
|
|
|
|
4
|
$params->{$Apache::ASP::SessionCookieName} = $asp->{session_id}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
4
|
|
|
|
|
4
|
my($k,$v, @query); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# changed to use sort so this function outputs the same URL every time |
167
|
4
|
|
|
|
|
19
|
for my $k ( sort keys %$params ) { |
168
|
5
|
|
|
|
|
11
|
my $v = $params->{$k}; |
169
|
|
|
|
|
|
|
# inline the URLEncode function for speed |
170
|
5
|
|
|
|
|
11
|
$k =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/egs; |
|
1
|
|
|
|
|
5
|
|
171
|
5
|
100
|
66
|
|
|
29
|
my @values = (ref($v) and ref($v) eq 'ARRAY') ? @$v : ($v); |
172
|
5
|
|
|
|
|
9
|
for my $value ( @values ) { |
173
|
6
|
|
|
|
|
12
|
$value =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/egs; |
|
2
|
|
|
|
|
19
|
|
174
|
6
|
|
|
|
|
24
|
push(@query, $k.'='.$value); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
4
|
100
|
|
|
|
13
|
if(@query) { |
178
|
3
|
|
|
|
|
11
|
$url .= '?'.join('&', @query); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
4
|
|
|
|
|
26
|
$url; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub XSLT { |
185
|
0
|
|
|
0
|
0
|
0
|
my($self, $xsl_data, $xml_data) = @_; |
186
|
0
|
|
|
|
|
0
|
$self->{asp}->XSLT($xsl_data, $xml_data); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub Config { |
190
|
65
|
|
|
65
|
0
|
286
|
shift->{asp}->config(@_); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; |