PS: I forgot to let you know if it works on MP1. I do not have that installed on any machines so if someone out there on the list could check that out and post back I would appreciate it. Everything you need is below.
Tom

Terra Info wrote:

Thanks for the help. Below is all the info you requested. I have also attached the test script (code below for those attachement challenged, et al;) and an example can be seen at http://dev.terranovum.com/some-bad-link/. To see what it should be doing call it directly at http://dev.terranovum.com/cgi-bin/mod_perl_list.pl. Both links are the same script under the same mod_perl directives. The only difference is how they are being called. If you need anything else let me know.
Tom

Relevant httpd.conf entries:
ErrorDocument 404 /cgi-bin/mod_perl_list.pl
<Location /cgi-bin>
SetHandler perl-script
PerlHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>

Only Log Entry:
[Sat Dec 21 17:35:46 2002] [error] [client 146.115.56.67] File does not exist: /var/www/terradev/docs/bad-link
Output:
[snip]Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.[snip]


[root@nova t]# ./TEST.PL
*** setting ulimit to allow core files
ulimit -c unlimited; ./TEST.PL
/usr/sbin/httpd -d /root/downloads/mod_perl-1.99_07/ModPerl-Registry/t -f /root/downloads/mod_perl-1.99_07/ModPerl-Registry/t/conf/httpd.conf -DAPACHE2 -DPERL_USEITHREADS
using Apache/2.0.40 (prefork MPM)

waiting for server to start: ...
waiting for server to start: ok (waited 2 secs)
server localhost.localdomain:8529 started
basic.............ok
closure...........ok
redirect..........ok
special_blocks....ok
All tests successful.
Files=4, Tests=30, 5 wallclock secs ( 1.91 cusr + 0.18 csys = 2.09 CPU)
*** server localhost.localdomain:8529 shutdown

#!/usr/bin/perl -Tw
$ENV{'PATH'} = '';
use strict;
my $retstr = "Content-Type: text/html\n";
#$retstr .= sprintf("Status: %s %s\n", $status, $codes{$status}[0]);
$retstr .= sprintf("Status: %s %s\n", 404, 'Object Not Found!');
$retstr .= "\n";
$retstr .= '<html><head><title>Error 404: Object Not Found!</title></head><body bgcolor="#FFFFFF"><h2>Error 404: Object Not Found!</h2><p>Blah, blah, blah...</p></body></html>';
print($retstr);

exit;

Stas Bekman wrote:

Terra Info wrote:

I have a script that provides custom error messages that I set up using the ErrorDocument directive (ie; ErrorDocument 400 /cgi-global/error.pl?error=400&useXML=1). When run under typical mod_cgi all works as planned and it outputs the proper stuff. When run under mod_perl it outputs the same but then appends the default ErrorDocument (ie; ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var) output on the end so I have effectively two HTML docs on the output page.

The odd part of this issue is this. When it is a 404 error The stock error doc says that "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request" which makes no sense since the only log entry is "File does not exist: /var/www/terradev/docs/bad-link". When you use the 500.pl example below you get "Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request." despite the fact that the custom error script did work and output what it was supposed to and the error logs confirm that.


Looks like ModPerl::Registry is not handling correctly the return status , hence you get the run of the default handler as well. I'll look into it. But first, does it work properly with mod_perl 1.0?

Finally please attach the script that fails, preferrably removing all but the very minimal code that allows to reproduce the problem. Thanks.

And if you can a test to modperl-2.0/ModPerl-Registry/t that reproduces the problem, that would be even better. If you don't know Apache::Test, you can learn more about it at:
http://perl.apache.org/docs/general/testing/testing.html
and looking at the existing tests. To run the registry tests you need to cd to the ModPerl-Registry dir first and run 'make test'. If it seems like too much work, I'll take care of adding the test. But it'd be cool if people who encounter problems were able to submit tests with their reports.

Thanks.


__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com


------------------------------------------------------------------------

#!/usr/bin/perl -Tw

# Relevant httpd.conf entries:
# ErrorDocument 404 /cgi-bin/mod_perl_list.pl
# <Location /cgi-bin>
# SetHandler perl-script
# PerlHandler ModPerl::Registry
# PerlOptions +ParseHeaders
# Options +ExecCGI
# </Location>

# Only Log Entry:
# [Sat Dec 21 17:35:46 2002] [error] [client 146.115.56.67] File does not exist: /var/www/terradev/docs/bad-link
# Output: # [snip]Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.[snip]


$ENV{'PATH'} = '';
use strict;

my $retstr = "Content-Type: text/html\n";
#$retstr .= sprintf("Status: %s %s\n", $status, $codes{$status}[0]);
$retstr .= sprintf("Status: %s %s\n", 404, 'Object Not Found!');
$retstr .= "\n";
$retstr .= '<html><head><title>Error 404: Object Not Found!</title></head><body bgcolor="#FFFFFF"><h2>Error 404: Object Not Found!</h2><p>Blah, blah, blah...</p></body></html>';
print($retstr);

exit;

__END__

[root@nova t]# ./TEST.PL
*** setting ulimit to allow core files
ulimit -c unlimited; ./TEST.PL
/usr/sbin/httpd -d /root/downloads/mod_perl-1.99_07/ModPerl-Registry/t -f /root/downloads/mod_perl-1.99_07/ModPerl-Registry/t/conf/httpd.conf -DAPACHE2 -DPERL_USEITHREADS
using Apache/2.0.40 (prefork MPM)

waiting for server to start: ...
waiting for server to start: ok (waited 2 secs)
server localhost.localdomain:8529 started
basic.............ok
closure...........ok
redirect..........ok
special_blocks....ok
All tests successful.
Files=4, Tests=30, 5 wallclock secs ( 1.91 cusr + 0.18 csys = 2.09 CPU)
*** server localhost.localdomain:8529 shutdown

--
-----------------------------------------------------
Terra Novum Research
[EMAIL PROTECTED]
www.terranovum.com
(617) 923-4132

PO Box 362
Watertown, MA 02471-0362

I feel my body weakened by the years,
as people turn to gods of cruel design.
Is it that they fear the pain of death,
or could it be they fear the joy of life.

 - Glenn Philips


Reply via email to