Revision 23f79a87
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Dispatcher.pm | ||
---|---|---|
22 | 22 |
# number 'die' was called in. |
23 | 23 |
use constant END_OF_REQUEST => "END-OF-REQUEST\n"; |
24 | 24 |
|
25 |
sub new { |
|
26 |
my ($class, $interface) = @_; |
|
27 |
|
|
28 |
my $self = bless {}, $class; |
|
29 |
$self->{interface} = lc($interface || 'cgi'); |
|
30 |
|
|
31 |
return $self; |
|
32 |
} |
|
33 |
|
|
25 | 34 |
sub pre_request_checks { |
26 | 35 |
if (!$::auth->session_tables_present) { |
27 | 36 |
if ($::form->{script} eq 'admin.pl') { |
... | ... | |
138 | 147 |
} |
139 | 148 |
|
140 | 149 |
sub handle_request { |
150 |
my $self = shift; |
|
151 |
|
|
141 | 152 |
$::lxdebug->enter_sub; |
142 | 153 |
$::lxdebug->begin_request; |
143 | 154 |
|
144 |
my $interface = lc(shift || 'cgi'); |
|
145 | 155 |
my ($script, $path, $suffix, $script_name, $action, $routing_type); |
146 | 156 |
|
147 | 157 |
$script_name = $ENV{SCRIPT_NAME}; |
148 | 158 |
|
149 |
unrequire_bin_mozilla($interface);
|
|
159 |
$self->unrequire_bin_mozilla;
|
|
150 | 160 |
|
151 | 161 |
$::cgi = CGI->new(''); |
152 | 162 |
$::locale = Locale->new($::language); |
... | ... | |
230 | 240 |
} |
231 | 241 |
|
232 | 242 |
sub unrequire_bin_mozilla { |
233 |
return unless $_[0] =~ m/^(?:fastcgi|fcgid|fcgi)$/; |
|
243 |
my $self = shift; |
|
244 |
return unless $self->{interface} =~ m/^(?:fastcgi|fcgid|fcgi)$/; |
|
234 | 245 |
|
235 | 246 |
for (keys %INC) { |
236 | 247 |
next unless m#^bin/mozilla/#; |
admin.pl | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use SL::Dispatcher; |
6 | 6 |
|
7 |
SL::Dispatcher::pre_startup(); |
|
8 |
SL::Dispatcher::handle_request('CGI'); |
|
7 |
my $dispatcher = SL::Dispatcher->new('CGI'); |
|
8 |
$dispatcher->pre_startup; |
|
9 |
$dispatcher->handle_request; |
|
9 | 10 |
|
10 | 11 |
1; |
dispatcher.fpl | ||
---|---|---|
8 | 8 |
|
9 | 9 |
SL::FCGIFixes::apply_fixes(); |
10 | 10 |
|
11 |
SL::Dispatcher::pre_startup(); |
|
11 |
my $dispatcher = SL::Dispatcher->new('FastCGI'); |
|
12 |
$dispatcher->pre_startup; |
|
13 |
|
|
12 | 14 |
my $request = FCGI::Request(); |
13 |
SL::Dispatcher::handle_request('FastCGI') while $request->Accept() >= 0;
|
|
15 |
$dispatcher->handle_request($request) while $request->Accept() >= 0;
|
|
14 | 16 |
|
15 | 17 |
1; |
Auch abrufbar als: Unified diff
Umstellung des Dispatcher-Moduls auf Objekt-Aufrufsyntax