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