Re: mod_perl 2 and problems w/ ErrorDocument Directive

2002-12-27 Thread Terra Info
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

2002-12-27 Thread Stas Bekman
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

2002-12-23 Thread Terra Info
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

2002-12-23 Thread Terra Info
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

2002-12-23 Thread Stas Bekman
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



mod_perl 2 and problems w/ ErrorDocument Directive

2002-12-20 Thread Terra Info
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.


The setup is plain vanilla on RH 8 and httpd2. The latest patch level of 
everything RH8 basically. The config of the cgi-global is:
Location /cgi-global
SetHandler perl-script
PerlHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
/Location
Output of perl -V and httpd -V are below and not that this is a vhost 
using named vhosts via the directive NameVirtualHost *.
If you need anything else let me know since I do not have the script on 
my system you set up for posting bug reports. (RH did not include it)

Examples can be seen at http://dev.terranovum.com/cgi-global/500.pl or 
http://dev.terranovum.com/bad-link

Thomas Bolioli
PS: Any idea if there will be a replacement for Apache::Status?

#httpd -V
Server version: Apache/2.0.40
Server built:   Oct  9 2002 08:01:13
Server's Module Magic Number: 20020628:0
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=/etc/httpd
 -D SUEXEC_BIN=/usr/sbin/suexec
 -D DEFAULT_PIDLOG=logs/httpd.pid
 -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
 -D DEFAULT_LOCKFILE=logs/accept.lock
 -D DEFAULT_ERRORLOG=logs/error_log
 -D AP_TYPES_CONFIG_FILE=conf/mime.types
 -D SERVER_CONFIG_FILE=conf/httpd.conf

# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.18-11smp, archname=i386-linux-thread-multi
uname='linux daffy.perf.redhat.com 2.4.18-11smp #1 smp thu aug 15 
06:41:59 edt 2002 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 
-Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red 
Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux 
-Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads 
-Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db 
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio 
-Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less 
-isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing 
-I/usr/include/gdbm'
ccversion='', gccversion='3.2 20020822 (Red Hat Linux Rawhide 
3.2-5)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
alignbytes=4, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=/lib/libc-2.2.92.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.2.92'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Sep  1 2002 23:56:49
  

Re: mod_perl 2 and problems w/ ErrorDocument Directive

2002-12-20 Thread Stas Bekman
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