Re: mod_perl 2 and problems w/ ErrorDocument Directive
Sounds good. Thanks for the help. I will patch my copy. Will all MP1 functionality be migrating over to MP2? In particular the PerlHandler Apache::Status functionality. Thanks, Tom Stas Bekman wrote: Terra Info wrote: 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. Here is the fix, I've messed up this part while porting. I'll commit that fix soonish + a new test. Index: lib/ModPerl/RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.23 diff -u -r1.23 RegistryCooker.pm --- lib/ModPerl/RegistryCooker.pm 16 Aug 2002 09:01:17 - 1.23 +++ lib/ModPerl/RegistryCooker.pm 24 Dec 2002 01:44:52 - @@ -157,7 +157,8 @@ # handlers shouldn't set $r-status but return it my $old_status = $self-[REQ]-status; my $rc = $self-run; -my $new_status = $self-[REQ]-status($old_status); +my $new_status = $self-[STATUS]; +$self-[REQ]-status($old_status); return ($rc != Apache::OK) ? $rc : $new_status; } __ Stas BekmanJAm_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 -- - Terra Novum Research [EMAIL PROTECTED] www.terranovum.com (617) 923-4132 PO Box 362 Watertown, MA 02471-0362 Patriotism means being loyal to your country all the time and to its government when it deserves it. - Mark Twain
Re: mod_perl 2 and problems w/ ErrorDocument Directive
Terra Info wrote: Sounds good. Thanks for the help. I will patch my copy. Or just grab the latest cvs. Will all MP1 functionality be migrating over to MP2? Pretty much yes. In particular the PerlHandler Apache::Status functionality. Doug mentioned that most of its functionality works as-is. It needs some patching to work with the new registry. __ Stas BekmanJAm_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
Re: mod_perl 2 and problems w/ ErrorDocument Directive
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_blocksok 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 .= 'htmlheadtitleError 404: Object Not Found!/title/headbody bgcolor=#FFh2Error 404: Object Not Found!/h2pBlah, 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=400useXML=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 BekmanJAm_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 -- - Terra Novum Research [EMAIL PROTECTED] www.terranovum.com (617) 923-4132 PO Box 362 Watertown, MA 02471-0362 When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity. -- Einstein, Journal of Exothermic Science and Technology (JEST, Vol. 1, No. 9; 1938) #!/usr/bin/perl -Tw # Relevant httpd.conf entries: # ErrorDocument 404 /cgi-bin/mod_perl_list.pl #Location /cgi-bin #SetHandler
Re: mod_perl 2 and problems w/ ErrorDocument Directive
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_blocksok 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 .= 'htmlheadtitleError 404: Object Not Found!/title/headbody bgcolor=#FFh2Error 404: Object Not Found!/h2pBlah, 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=400useXML=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 BekmanJAm_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
Re: mod_perl 2 and problems w/ ErrorDocument Directive
Terra Info wrote: 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. Here is the fix, I've messed up this part while porting. I'll commit that fix soonish + a new test. Index: lib/ModPerl/RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.23 diff -u -r1.23 RegistryCooker.pm --- lib/ModPerl/RegistryCooker.pm 16 Aug 2002 09:01:17 - 1.23 +++ lib/ModPerl/RegistryCooker.pm 24 Dec 2002 01:44:52 - @@ -157,7 +157,8 @@ # handlers shouldn't set $r-status but return it my $old_status = $self-[REQ]-status; my $rc = $self-run; -my $new_status = $self-[REQ]-status($old_status); +my $new_status = $self-[STATUS]; +$self-[REQ]-status($old_status); return ($rc != Apache::OK) ? $rc : $new_status; } __ Stas BekmanJAm_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
Re: mod_perl 2 and problems w/ ErrorDocument Directive
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=400useXML=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 BekmanJAm_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