Re: [Question] Handler executing twice!?!

2003-03-30 Thread Stas Bekman
Vince Veselosky wrote:
[...]
The thing that triggered it was the fact that the url was an "index.pl" 
file. When called as "example.com/index.pl", everything worked as 
expected, but when called as "example.com/", apache (or something) 
generated a subrequest for index.pl.

NOW my question is, why does apache generate the subrequest *after* the 
HeaderParser phase, causing it to execute twice? This seems like a pure 
URI translation issue, and I would expect it to happen in the URI 
translation phase, *before* the HeaderParser executes at all. I'm 
wondering if this happens in all requests, or if it is related to 
Apache::Registry in the content handler. I didn't take the time to track 
down exactly where the subrequest originates, so I'm not sure if it is a 
mod_perl issue or just an apache issue. I might one day build some test 
cases and figure it out, but not soon. Anyone have some insight to add?
Do you have mod_dir (DirectoryIndex) configured? It performs a 
rewrite/sub_request-redirect in the fixup stage.
http://httpd.apache.org/docs/mod/mod_dir.html
__
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: [Question] Handler executing twice!?!

2003-03-30 Thread Vince Veselosky
Whew, okay, I have an answer, but I also still have a question. The 
short explanation:

The "bug" in my code was the fact that I forgot that a request might 
also be a subrequest, so now I check if the request is_initial_req and 
short circuit if not. (And a tiny bug in my trace code caused my debug 
log to report is_initial_req as true all the time. Stupid operator 
precedence bugs!) That solves my immediate problem and gives me 
something to watch for in future.

The thing that triggered it was the fact that the url was an "index.pl" 
file. When called as "example.com/index.pl", everything worked as 
expected, but when called as "example.com/", apache (or something) 
generated a subrequest for index.pl.

NOW my question is, why does apache generate the subrequest *after* the 
HeaderParser phase, causing it to execute twice? This seems like a pure 
URI translation issue, and I would expect it to happen in the URI 
translation phase, *before* the HeaderParser executes at all. I'm 
wondering if this happens in all requests, or if it is related to 
Apache::Registry in the content handler. I didn't take the time to track 
down exactly where the subrequest originates, so I'm not sure if it is a 
mod_perl issue or just an apache issue. I might one day build some test 
cases and figure it out, but not soon. Anyone have some insight to add?

Thanks to everyone who sent help and suggestions!
-Vince Veselosky
http://ice.control-escape.com
Vince Veselosky wrote:

Now here is the thing. The PerlHeaderParserHandler executes TWICE for 
every request. The second time through is apparently a different 
Apache object from the first, as when I write to $r->notes, only the 
values from the second execution are visible to the content handler.

Now, if I comment out the PerlHeaderParserHandler line in the conf 
file, the handler never executes at all (which is expected), so it 
isn't getting pushed onto handlers from somewhere else.

Why is this thing running twice, and how can I make it stop??? I hope 
someone can hit me over the head with a clue-stick, because this thing 
is driving me completely bananas!

All help is greatly appreciated,
Vince Veselosky
http://ice.control-escape.com







Re: installing mod_perl with Apache and mod_ssl

2003-03-30 Thread Stas Bekman
Richard Kurth wrote:
Hello ,

I am trying to install mod_perl with Apache apache_1.3.27
mod_ssl-2.8.12-1.3.27 and Frontpage This is what I am doing to install
it but for some reason mod_perl does not install properly.
[...]

This might help:
http://perl.apache.org/docs/1.0/guide/install.html#mod_perl_and_mod_ssl___openssl_
--

__
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


Segmentation fault - is Error.pm the culprit?

2003-03-30 Thread Richard Clarke
I'm using a subclass of Error.pm to throw exceptions when a DBI error
happens.
The SEGV only happens after I "return SERVER_ERROR" in response to the
thrown and propogated error.
This code essentially worked fine 2 weeks ago but at the time I removed my
DBI HandleError subroutine. Today when adding it back in I am facing this
problem

Running with my debug httpd gives me a backtrace of,

Program received signal SIGSEGV, Segmentation fault.
0x810839d in Perl_sv_setsv ()
(gdb) bt
#0  0x810839d in Perl_sv_setsv ()
#1  0x80ff194 in Perl_pp_sassign ()
#2  0x80fedf6 in Perl_runops_standard ()
#3  0x80c1cd6 in S_call_body ()
#4  0x80c1aba in perl_call_sv ()
#5  0x80c1725 in perl_call_method ()
#6  0x807d458 in perl_call_handler (sv=0x978809c, r=0x97db034, args=0x0) at
mod_perl.c:1655
#7  0x807cbf5 in perl_run_stacked_handlers (hook=0x8147199 "PerlHandler",
r=0x97db034, handlers=0x97a4f30) at mod_perl.c:1371
#8  0x807afab in perl_handler (r=0x97db034) at mod_perl.c:897
#9  0x809a841 in ap_invoke_handler (r=0x97db034) at http_config.c:518
#10 0x80afed0 in process_request_internal (r=0x97db034) at
http_request.c:1308
#11 0x80aff3a in ap_process_request (r=0x97db034) at http_request.c:1324
#12 0x80a68ab in child_main (child_num_arg=0) at http_main.c:4603
#13 0x80a6a6d in make_child (s=0x817f034, slot=0, now=1049069980) at
http_main.c:4718
#14 0x80a6be6 in startup_children (number_to_start=50) at http_main.c:4800
#15 0x80a7214 in standalone_main (argc=2, argv=0xbfbffb74) at
http_main.c:5108
#16 0x80a7a74 in main (argc=2, argv=0xbfbffb74) at http_main.c:5456
#17 0x8061f21 in _start ()

For the time being I can use die instead of throw since they are both caught
by my try{} block... this isn't ideal however since I can't identify the
type of exception like this.
Is this likely to be related to Error.pm? Could something else be causing
this? Any advice at all?


This is on,
   mod_perl 1.27, apache 1.3.27, fbsd 4.7-release.

Richard.



Re: [Question] Handler executing twice!?!

2003-03-30 Thread Stas Bekman
Vince Veselosky wrote:

[...]

Now here is the thing. The PerlHeaderParserHandler executes TWICE for 
every request. The second time through is apparently a different Apache 
Could it be that something in your code pushes the handler on the stack again?

I'd suggest debugging with Apache::ShowRequest?
http://search.cpan.org/author/DOUGM/Apache-Module-0.11/lib/Apache/ShowRequest.pm
Do tracing:
http://perl.apache.org/docs/1.0/guide/debug.html#Debug_Tracing
Use the 'h' setting
PerlSetEnv MOD_PERL_TRACE h
Try to use $r->get_handlers() and see what you get.

Finally, if nothing helps, go with gdb.

Also what happens if you don't use Apache::Request?

__
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


installing mod_perl with Apache and mod_ssl

2003-03-30 Thread Richard Kurth
Hello ,

I am trying to install mod_perl with Apache apache_1.3.27
mod_ssl-2.8.12-1.3.27 and Frontpage This is what I am doing to install
it but for some reason mod_perl does not install properly.

cd /tmp
tar xfz apache_1.3.27.tar.gz

#Frontpage Module
cd /tmp
cd apache_1.3.27
rm -f apache_1.3.27/src/modules/extra/mod_frontpage.c
patch -p1 < ../fp-patch-apache_1.3.27-5.0

#modperl Module
cd /tmp
tar zxf mod_perl-1.27.tar.gz
cd mod_perl-1.27
perl Makefile.PL APACHE_SRC=../apache_1.3.27/src \
DO_HTTPD=1 USE_APACI=1 EVERYTHING=1

make && make test && make install

#SSL Module
cd /tmp
echo "Untarring modssl"
tar xfz mod_ssl-2.8.12-1.3.27.tar.gz 
cd mod_ssl-2.8.12-1.3.27
./configure --with-apache=../apache_1.3.27 --with-ssl=/usr --prefix=/usr/apache \
--htdocsdir=/home --enable-module=rewrite --enable-shared=rewrite \
--sysconfdir=/etc/httpd/conf --logfiledir=/home/log --manualdir=/home/manual \
--server-uid=nobody --server-gid=nobody --enable-module=so --htdocsdir=/home/sites \
--cgidir=/home/cgi-bin --enable-module=proxy --enable-shared=proxy --enable-module=ssl 
\
--enable-shared=ssl --activate-module=src/modules/perl/libperl.a

cd ../apache_1.3.27
make
make install


-- 
Best regards,
Richard Kurth
DirectPHP Inc
mailto:[EMAIL PROTECTED]
360-686-8448 Home
360-686-0374 Office