* Doug MacEachern
|
| On 28 Sep 2000, Bjørn Ola Smievoll wrote:
|
| > [Sorry for being so verbose, hope somebody still have the time and
| > patience to read it all].
| >
| > I have a setup where a PerlTransHandler registers a PerlContentHandler
| > based simply on whether $r->uri ends with '.html' or not. The
| > TransHandler does no verifying of the existence of the file, that
| > doesn't happen until the ContentHandler kicks in. For an unsuccessful
| > '-e' test, NOT_FOUND is returned from the ContentHandler. All this
| > worked fine until I added an perl-based handler for the 404 using the
| > ErrorDocument parameter in httpd.conf[1].
|
| your error handler works fine for me with 404's. what is your
| PerlTransHandler doing?
Well, I'm not shure it works. Request that it handles shows up in the
access_log with status 200. I must admit; I'm quite confused at the
moment. Is it correct to use $r->send_http_header?
Anyways, I've made a couple of dummy modules to make an to-the-point
example. Using them should cause looping.
First the httpd.conf entries:
PerlTransHandler UiO::TransDummy
<Location /http_error>
SetHandler perl-script
PerlHandler UiO::ErrDoc
</Location>
ErrorDocument 404 /http_error
The transhandler:
package UiO::TransDummy;
use strict;
use Apache::Constants qw(OK DECLINED);
sub handler {
my $r = shift;
unless ($r->is_initial_req) {
$r->log->debug('DECLINED');
return DECLINED;
}
if (substr($r->uri, -5) eq '.html') {
$r->filename($r->document_root . $r->uri);
$r->handler('perl-script');
$r->push_handlers(PerlHandler => 'UiO::ContentDummy');
$r->log->debug('Registered ' . $r->filename);
return OK;
}
$r->log->debug('DECLINED');
return DECLINED;
}
1;
__END__
And the contenthandler:
package UiO::ContentDummy;
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
$r->log->debug('Hello');
return NOT_FOUND;
}
1;
__END__
(bo)