Re: apache segfaults on mod_perl dlclose

1999-12-14 Thread Doug MacEachern

On Tue, 14 Dec 1999, Saar Picker wrote:

 
 Hrm. Does perl use 0x as a marker? 

yes, see malloc.c

 I thought once an sv was freed it gets a null value or something. 

sure, but with Perls before 5.005_60-ish, Perl's malloc overrides system
malloc/free *everywhere*, not just for Perl data, but also for other C
code using malloc/free in the same runtime

 In any case, this shouldn't be happening due to any strictly perl 
 modules I'm loading. 

true, but pure Perl can't be ruled out as triggering such a bug.

it might help if you can run your server under gdb and post a stacktrace
after this core dump.



Re: troubleshooting seg fault/child exit

1999-12-14 Thread Doug MacEachern

 What I find odd is that all of the sudden people seem to be coming out of 
 the woodwork about this stuff.  Whe I searched through mailing list 
 archives, some of them going back years, I found something odd...  Many 
 people were talking about this same problem between December of last year 
 and January of this year.  No one found a satisfactory solution (at least, I 
 didn't see one).  Some blamed it on pre-loading CGI.pm in startup.perl, 
 while others blamed it on having a PerlFreshRestart On in the Apache 
 confguration scripts.  This seems to be a pretty big deal, if so many people 
 are complaining under so many configurations, and apparently it has gone on 
 for over a year.

core dumps can happen for many different reasons.  why there are so many
these past couple of days, I don't know, but doubt they are all triggered
by the same thing.  if you could follow suit and post a stacktrace from
gdb, that would help.



Re: Problems with dynamically-loaded perl modules under Solaris2.5.1

1999-12-13 Thread Doug MacEachern

are you still stuck on this?  did you link mod_perl static or dso?  if
dso, try static.  you can also try configuring Perl with -Dusemymalloc=n,
but that comes with a large performance hit.
I've never had a problem with solaris and any combo of mod_perl/Perl

On Mon, 1 Nov 1999, Dan Rench wrote:

 
 I did some experimenting with my Solaris2.5.1/mod_perl/Data::Dumper/Storable
 problem that I wrote about last week.  A grid:
 
 
  | mod_perl 1.21 | 1.21-dev (19991101174047)
 -+---+--
 perl5.004_05 | works fine| didn't try
 perl5.005_03 | doesn't work  | doesn't work
 perl5.005_62 | won't compile | works fine!
 
 
 All versions of perl compiled with all solaris hints.
 
 So is this a 5.005_03-specific bug?  Any word on 5.005_04?
 





RE: no luck uploading

1999-12-13 Thread Doug MacEachern

On Mon, 1 Nov 1999, Tubbs, Derric L wrote:

 Well, I finally got it to work with Apache::Request.  I had to do "$args =
 Apache::Request-new($r);" and "$file = $args-upload;" in the handler sub
 and then pass $args and $file to any other subs that needed it.  Maybe this
 is normal but if so I was unaware of it.  I was doing all of the above
 within a different sub that gets called from handler.
 
 BTW, Can I do a conditional on the creation of $file that would return false
 if there was no file uploaded???

just test for -filename:

if (my $upload = $apr-upload) {
my $filename = $upload-filename;

unless ($filename) {
print "no file specified";
return;
}
...



Re: PerlFixupHandler vs. PerlHandler

1999-12-13 Thread Doug MacEachern

On Mon, 1 Nov 1999, James G Smith wrote:

 I have some code working, but I'm curious as to why it has to work in the
 way it does.  The code:
 
 package My::TAMU;
 
 sub handler ($$) {
   my $class = shift;
   my $r = shift;
 
   if($r-current_callback eq "PerlHandler" ||  # this one makes sense
  $r-current_callback eq "PerlFixupHandler") { # but why this one?

$r-current_callback is store in a global, set to PerlHandler when
entered, but then the setup of %ENV does a subrequest, and sets the global
to PerlFixupHandler in doing so.  this bug will be fixed in 1.22



Re: setting cookies?

1999-12-13 Thread Doug MacEachern

On Mon, 1 Nov 1999, Robin Berjon wrote:

 At 11:44 01/11/1999 -0800, Doug MacEachern wrote:
 On Mon, 1 Nov 1999, Wyman Eric Miles wrote:
  The next question is, when the cookie expires 2 hours later, the initial
  SecurID user/password has long since expired.  How do I cause the module
  to force the basic auth dialogs again?
  
  $r - note_basic_auth_failure;
  return AUTH_REQUIRED;
  
  Doesn't seem to work.
 
 that's cause netscape, ie, etc, cache basic credentials.  so even though a
 401 code is sent to the client, they just reuse the existing
 username/password in memory.
 
 I've never tried this but doesn't sending two 401s in a row for the same
 document have the auth popup appear again ?

yeah, except that clicking 'cancel' causes the browser to send the cached
credentials.  at least, that was my experience last I tried.



Re: suggestion about PerlRun

1999-12-13 Thread Doug MacEachern

thanks, I'll add this for 1.22.

On Tue, 2 Nov 1999, Yasushi Nakajima wrote:

 Doug the handler() in Apache::PerlRun was not originally indended to be
 Doug subclassed.  however, if somebody submits a patch to make is
 Doug subclass-able that doesn't break the way Apache::PerlRun currently works,
 Doug that would be fine.
 
 Following modified code works itself and as derived module on my
 Apache/1.3.9 (Unix) mod_perl/1.21.
 
 259,261c259,267
  sub handler {
  my $r = shift;
  my $pr = Apache::PerlRun-new($r);
 ---
  sub handler($$) {
  my($class, $r);
  if( @_ = 2 ) {
($class, $r) = (shift, shift);
  } else {
($class, $r) = (__PACKAGE__, shift);
  }
  my $pr = $class-new($r);
 
 I copied this code from RegistryNG.pm.
 
 Sey Nakajima [EMAIL PROTECTED]
 Kyoto, Japan
 



Re: referenced symbol not found error

1999-12-13 Thread Doug MacEachern

you need the cvs snapshot of mod_perl to use 5.005_62+, or wait for 1.22

On Tue, 2 Nov 1999, Arkadiy Goykhberg wrote:

 *This message was transferred with a trial version of CommuniGate(tm) Pro*
 Hello, I'm trying to compile mod_perl-1.21 as DSO module for apache 
 version 1.3.9 on Solaris 2.6 using gcc version 2.8.1 and perl version 
 5.00562. Right now I'am using out the box vanilla configuration of apache.
 
 Everything compiles ok, but then I try to start apache, I get the 
 following error:
 Syntax error on line 224 of /usr/local/apache/conf/httpd.conf:
 Cannot load /usr/local/apache/libexec/libperl.so into server: ld.so.1:
 /usr/local/apache/bin/httpd: fatal: relocation error: file
 /usr/local/apache/libexec/libperl.so: symbol perl_eval_pv: referenced 
 symbol not found
 /usr/local/apache/bin/apachectl start: httpd could not be started. 
 
 Here is the output of make test:
 SNIP
 /usr/bin/perl t/TEST 0
 Syntax error on line 1 of 
 /local/packages/apache/mod_perl-1.21/t/conf/httpd.conf:
 Cannot load 
 /local/packages/apache/mod_perl-1.21/t/../../apache_1.3.9/src/modules
 /perl/libperl.so into server: ld.so.1: ../apache_1.3.9/src/httpd: 
 fatal: relocation error: file 
 /local/packages/apache/mod_perl-1.21/t/../../apache_1.3.9/src/modules
 /perl/libperl.so: symbol perl_eval_pv: referenced symbol not found
 still waiting for server to warm upnot ok
 server failed to start! at t/TEST line 95.
 make: *** [run_tests] Error 146
 /SNIP
 
 # perl -V   
 Summary of my perl5 (revision 5.0 version 5 subversion 62) 
 configuration:
   Platform:
 osname=solaris, osvers=2.6, archname=sun4-solaris
 uname='sunos arkadiy 5.6 generic_105181-05 sun4u sparc 
 sunw,ultra-5_10 '
 config_args=''
 hint=previous, useposix=true, d_sigaction=define
 usethreads=undef useperlio=undef d_sfio=undef
 use64bits=define usemultiplicity=undef
   Compiler:
 cc='gcc', optimize='-O', gccversion=2.8.1
 cppflags='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
 -DUSE_LONG_LONG -DSOCKS -I/usr/local/include -DUSE_LONG_LONG'
 ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
 -DUSE_LONG_LONG -DSOCKS -I/usr/local/include -DUSE_LONG_LONG'
 stdchar='unsigned char', d_stdstdio=define, usevfork=false
 intsize=4, longsize=4, ptrsize=4, doublesize=8
 d_longlong=define, longlongsize=8, d_longdbl=define, 
 longdblsize=16
 alignbytes=8, usemymalloc=y, prototype=define
   Linker and Libraries:
 ld='gcc', ldflags ='  -L/usr/local/lib'
 libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
 libs=-lsocket -lnsl -ldl -lm -lc -lcrypt \lsec
 libc=, so=so, useshrplib=false, libperl=libperl.a
   Dynamic Linking:
 dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
 cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
 
 
 Characteristics of this binary (from libperl): 
   Built under solaris
   Compiled at Oct 29 1999 13:01:49
   @INC:
 /usr/local/lib/perl5/5.00562/sun4-solaris
 /usr/local/lib/perl5/5.00562
 /usr/local/lib/site_perl/5.00562/sun4-solaris
 /usr/local/lib/site_perl
 .
   
 Have anybody seen this before, or better yet, found a solution for 
 this problem?
   
 Thanks in advance.
 
 PS I apologize if this message was sent more then once.
 
 
 



Re: hostname fails under Apache::Registry, but not as CGI??

1999-12-13 Thread Doug MacEachern

try Apache-request-get_server_name instead of hostname()
it's cheaper too, since Sys::Hostname::hostname forks, at least once
per-process.  not so bad if you call it in the parent though (in a
PerlRequire script), then all children have the cached results

On Wed, 3 Nov 1999, Nick Urbanik wrote:

 Dear folks,
 
 When I run a CGI program as such, hostname works.  When I run it under
 Aapche::Registry, it fails.   Can anyone understand why?  Sorry, I am
 new to all this.
 
  [error] Cannot get host name of local machine at
 /home/httpd/dbi/frame_control.cgi line 13
 
 use Sys::Hostname;
 
 my $hostname = hostname();
 my $URL = "http://$hostname/dbi/";
 
 --
 Nick Urbanik, Dept. of Electrical  Communications Engineering
 Hong Kong Institute of Vocational Education (Tsing Yi)
 email: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Tel:   (852) 2436 8660, (825) 2436 8674   Fax: (852) 2436 8643
 pgp ID: 7529555D fingerprint: 53 B6 6D 73 52 EE 1F EE EC F8 21 98 45 1C 23 7B
 
 
 



Re: Problems building

1999-12-13 Thread Doug MacEachern


On 3 Nov 1999, Greg Stark wrote:

 
 I'm trying to update to 1.3.9+1.21 but I'm having various problems:
 
 1) The makefile seems to try to run ../apaci even though perl is two levels
deep, so it can't find ../apaci, it would have to be ../../apaci
 
 === src/modules/perl
 gcc -I. -I../../include -I../../include/regex -I../../include/.././os/unix -DLINUX=2 
-DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite `../apaci`  `/data/app/perl/bin/perl 
-MExtUtils::Embed -e ccopts`   -DNO_PERL_RESTART   
-DMOD_PERL_VERSION=\"1.21\"  -I./os/unix -I../../include -c mod_perl_opmask.c -o 
mod_perl_opmask.o
 /bin/sh: ../apaci: No such file or directory
 
 2) when it tries to link it gets pages and pages of these errors:
 
 gcc  -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite `./apaci`\
   -o httpd buildmark.o modules.o modules/perl/libperl.a 
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a 
regex/libregex.a lib/expat-lite/libexpat.a  -lm -lcrypt
 modules/perl/libperl.a(mod_perl.o): In function `perl_shutdown':

did you ever get this sorted out?  this link line isn't even close to
correct, how did you go about building, Makefile.PL options, etc??



Re: mod_perl on Apache 2.0

1999-12-13 Thread Doug MacEachern

On Wed, 3 Nov 1999, Jeffrey Baker wrote:

 There was a short discussion a while ago about getting mod_perl working
 with Apache 2.0.  Since Apache 2.0 can actually be built and run on a
 few platforms now, I think it is worth taking a lot at this for real.

I started to fiddle with 5.005_63 and perl_clone(), running concurrent
interpreters in seperate threads.  it didn't core dump, like old
MULTIPLICTY Perls would, but didn't work quite right either.  sarathy says
it's not quite ready yet, but it looks very promising from what I've seen
so far.  I hope to start looking into 2.0 things once I catch up here, and
get 1.22 released.



Re: make fails

1999-12-13 Thread Doug MacEachern

did you ever get this sorted out?  looks like an rpm version of Perl
maybe?  have you tried configuring/build Perl from source?

On Thu, 4 Nov 1999, Eva Neuberger wrote:

 Hallo,
 I'm trying to install mod_perl_1.21 with apache 1.36 perl 5.005_03
 and Linux Kernel 2.2.10
 
 I follow the instructions in INSTALL.apaci
 
 perl Makefile.PL APACHE_SRC=../apache_1.3.6/src DO_HTTPD=1
 PREP_HTTPD=1 USE_APACI=1 EVERYTHING=1
 
 Everything is ok, then typing make
 . 
 cc -c  -Dbool=char -DHAS_BOOL -I/usr/local/include -O2 -pipe   
 -DVERSION=\"1.00\" -DXS_VERSION=\"1.00\" -fpic
 -I/usr/lib/perl5/5.00503/i586-linux/CORE  Leak.c 
 In file included from Leak.xs:12: 
 /usr/lib/perl5/5.00503/i586-linux/CORE/perl.h:2546: redefinition of
 `union semun' 
 make[1]: *** [Leak.o] Error 1 
 make[1]: Leaving directory`/usr/src/mod_perl-1.21/Leak' 
 make: *** [subdirs] Error 2
 
 and with
 perl Makefile.PL 
 APACHE_SRC=../apache_1.3.6/src APACHE_PREFIX=/usr/local/apache 
 DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
 
 I've got
 cc -c -I../..  -I/usr/lib/perl5/5.00503/i586-linux/CORE 
 -I../../os/unix -I../../include   -DLINUX=2 -DMOD_PERL -DUSE_PERL_SSI
 -Dbool=char -DHAS_BOOL -I/usr/local/include -DUSE_HSREGEX
 `../../apaci` mod_include.c In file included from
 ../../modules/perl/mod_perl.h:41,
  from mod_include.c:85:
 /usr/lib/perl5/5.00503/i586-linux/CORE/perl.h:2546: redefinition of
 `union semun' 
 make[5]: *** [mod_include.o] Error 1 
 make[4]: *** [all] Error 1 
 make[3]: *** [subdirs] Error 1  
 make[3]:Leaving directory`/usr/src/apache_1.3.6/src' 
 make[2]: ***[build-std] Error 2 
 make[2]: Leaving directory`/usr/src/apache_1.3.6' 
 make[1]: ***[build] Error 2 
 make[1]: Leaving directory`/usr/src/apache_1.3.6' 
 make: *** [apaci_httpd] Error 2
 
 the same "redefinition of union semun"
 I've no idea, what's wrong.
 
 Eva Neuberger
 



Re: Unresolved References

1999-12-13 Thread Doug MacEachern


On Mon, 8 Nov 1999, Brad Bonkoski wrote:

 This message was sent from Geocrawler.com by "Brad Bonkoski" [EMAIL PROTECTED]
 Be sure to reply to that address.
 
 Hello, I am trying to build mod_perl and PHP together with apache and this is a 
sample of what I am getting:
 
   === src/modules/perl
 === src/modules
 gcc -c  -I./os/unix -I./include   -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/ex
 pat-lite `./apaci` modules.c
 gcc -c  -I./os/unix -I./include   -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/ex
 pat-lite `./apaci` buildmark.c
 gcc  -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite `./apaci`   -rdynami
 c \
   -o httpd buildmark.o modules.o modules/perl/libperl.a modules/example/libe
 xample.a modules/php3/libphp3.a modules/experimental/libexperimental.a modules/s
 tandard/libstandard.a modules/proxy/libproxy.a main/libmain.a ./os/unix/libos.a
 ap/libap.a regex/libregex.a lib/expat-lite/libexpat.a
 modules/perl/libperl.a(mod_perl.o): In function `perl_shutdown':

you're missing quite a bit here in the link line.  I know folks have
posted how to build Apache+mod_php+mod_perl, maybe Stas added it to the
guide?



Re: My doesn't it start ?

1999-12-13 Thread Doug MacEachern

try adding:
PerlModule Apache
to your httpd.conf

On Tue, 9 Nov 1999, Shay Mandel wrote:

 Hi all,
 
 It is my first time I am building the apache with the mod_perl enabled.
 
 I have installed it as static module. Then I compiled the apache
 (1.3.9). Everything passed ok (I skipped the make test because I don't
 have the LWP package).
 
 Now, when I start the apache I get this in the error_log:
 
 Apache.pm failed to load!.
 [Tue Nov  9 17:10:46 1999] [warn] pid file
 /www/apache/v1.3.9/logs/httpd.pid overwritten -- Unclean shutdown of
 previous Apache run?
 Apache.pm failed to load!.
 
 What should I do ?  should I add the addModule directive to the
 httpd.conf ?
 Should I alter the @INC variable ? when I run the Apache.pm by myself I
 see that it has a problem that it cannot find modules in the @INC - how
 do I change this environment variable ?  which of the (three) Apache.pm
 I have is the one that the apache is running ?
 
 I read all the docs,readme's, Install's, but still I have all these
 questions - please help.
 
 



Re: mod_perl crash

1999-12-13 Thread Doug MacEachern

more details please, Makefile.PL options, etc.

On Thu, 11 Nov 1999, Dominic A. V. Amann wrote:

 I am trying to build apache 1.3.9 (or 1.3.anything)
 with mod_perl.  It builds fine without, on libc-2.0.7 platform,
 using gcc 2.7.2.3
 
 I have tried many options in the APACI make process, all
 have same result (segmentation fault).
 
 This is the gdb backtrace from running the mod-perl version:
 
 fido:/usr/src/mod_perl-1.21$ gdb ../apache_1.3.6/src/httpd 
 GNU gdb 4.18
 Copyright 1998 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i686-pc-linux-gnulibc1"...
 (gdb) run -X -f `pwd`/t/conf/httpd.conf -d `pwd`/t
 Starting program: /usr/src/mod_perl-1.21/../apache_1.3.6/src/httpd -X -f
 `pwd`/t/conf/httpd.conf -d `pwd`/t
 
 Program received signal SIGSEGV, Segmentation fault.
 0x80c1e88 in perl_parse ()
 (gdb) bt
 #0  0x80c1e88 in perl_parse ()
 (gdb) 
 
 
 Please advise.
 
 
 -- 
 Dominic Amann, http://www.interlog.com/~damann/
   Linux Based Solutions Ltd.
   Toronto, ON, M3J 1G8, Canada
   Tel: (416) 638-8649, Fax: (416) 630-1584
 



Re: Apache::Registry and 304 status code in log file

1999-12-13 Thread Doug MacEachern

see Apache::RedirectLogFix

On Thu, 11 Nov 1999, Bill Moseley wrote:

 In an Apache::Registry script I'm print()ing
 
Status: 304 Not Modified
 
 when the client sends an If-Modified-Since: header.
 
 The 304 error is returned to the client properly, but the log file shows a
 200 status.  Can I make Apache log the access as a 304 with my
 Apache::Registry script?  The same script runs someplace else as mod_cgi.
 
 Thanks,
 
 BTW -- In perldoc Apache::Registry
 
 I'm sure this is known, but...
 
  Location /perl
   SetHandler perl-script
   PerlHandler Apache::Registry
   Options ExecCGI
   ...
   /Directory  -- shouldn't this be /Location
 
 
 
 
 Bill Moseley
 mailto:[EMAIL PROTECTED]
 



Re: Seg fault on fork w/ PerlModule

1999-12-13 Thread Doug MacEachern

can you get a stacktrace with gdb?  see the SUPPORT doc for hints.

On Tue, 16 Nov 1999, Tony Demark wrote:

 
 I have compiled the following:
 
   Apache 1.3.9
   mod_perl 1.21 (PERL_AUTHEN PERL_LOG PERL_STACKED_HANDLERS)
 
 on:
 
   Ultra 10
   Solaris 7
 
 with:
 
   gcc 2.95.2 19991024
   perl 5.005_03
 
 When starting an httpd process with a 'PerlModule' defined in the conf file,
 the process will seg fault when it attempts to fork:
 
 open("/opt/apache/logs/access_log", O_WRONLY|O_APPEND|O_CREAT, 0644) = 3
 fcntl(3, F_DUPFD, 0x000F)   = 16
 close(3)= 0
 chdir("/")  = 0
 fork()  = 16024
 Incurred fault #6, FLTBOUNDS  %pc = 0xD002
   siginfo: SIGSEGV SEGV_MAPERR addr=0xD002
 Received signal #11, SIGSEGV [default]
   siginfo: SIGSEGV SEGV_MAPERR addr=0xD002
 *** process killed ***
 
 However, comment out the 'PerlModule' statement, and the process forks fine
 and exits:
 
 open("/opt/apache/logs/access_log", O_WRONLY|O_APPEND|O_CREAT, 0644) = 3
 fcntl(3, F_DUPFD, 0x000F)   = 16
 close(3)= 0
 chdir("/")  = 0
 fork()  = 16030
 llseek(0, 0, SEEK_CUR)  = 101628
 _exit(0)
 
 I didn't see anything about this on the maillist... get anyone give me an
 idea of where I should at least start to track down this problem?
 
 Thanks,
 - Tony
 



Re: module Safe ?

1999-12-13 Thread Doug MacEachern

On Thu, 18 Nov 1999, Ekaterina Ivannikova wrote:

 Hi All!
 
 I should have mentioned that there is a Safe.pm 2.06
 in perl5 directory tree. But after browsing modperl
 archive I was under the impression that a special
 Apache::Safe was needed due to some subtle problems.
 Is it not so ? It seems there used to be a PerlSafe
 directive at some time but no mention of it in the
 current docs.

yes, there was indeed an Apache::Safe at one time, but it was never
finished, too some thorny problems.  there was an experimental PerlOpMask
directive added in 1.15_01 over a year ago (see Changes), derived from
Safe/Opcode.pm logic, but I haven't looked at that for quite a while.



Re: multipart POST problems

1999-12-13 Thread Doug MacEachern

On Thu, 18 Nov 1999, John S. Evans wrote:

 I've been attempting to write a perl module that handles POSTs of type
 multipart/form-data, and have been having a rough time.
 
 I'm using Apache::Request to process the request.  I have dumped the
 content-type of the incoming request, and verified that it's
 "multipart/form-data".  I can use param() to get the parameters, but I can't
 seem to use upload() to access the blocks directly.
 
 I've included the code from my test handler below.  Basically it attempts to
 access a large parameter MIME block two ways - using param() and using
 upload().  The param() version works fine, but the upload() version can't
 find the block.
 
 Any clues?  The only thing that I can think of is that for this test case,
 the MIME type of the "message" block is text/plain (it's in a TEXTAREA
 field, for testing purposes).  Is it possible that Apache::Request will not
 allow me to process "normal" form fields with upload()?

does the libapreq-x.xx/eg/perl/file_upload.pl script work for you?



Re: Apache::Cookie confusion

1999-12-13 Thread Doug MacEachern

On Fri, 19 Nov 1999, John Siracusa wrote:

 Apache::Cookie seems to have two different interfaces...or maybe there
 are two different distributions of Apache::Cookie?  Whatever it is, the
 interface seems different on two machines here at work.  One has 5.004
 and one has 5.005, but that shouldn't change the Apache::Cookie interface
 should it?

there is an Apache::Cookie in the libapreq bundle, which is supported
here.  I'm not sure how another module named Apache::Cookie made it
onto CPAN.



Re: Access handlers for CGI's...

1999-12-13 Thread Doug MacEachern

why don't you just use a PerlAuthenHandler?  see chapter 6 online at
modperl.com

On Tue, 23 Nov 1999, Trevor Phillips wrote:

 I've written an Authentication Handler using the Access phase, where someone
 must validate themselves before accessing a resource. The way I've done it, if
 the client is not validated, it changes the PerlHandler to reference a "Login"
 subroutine, which produces the login page. This works fine, although currently
 the protected documents are also handled by the module (to append a footer
 relating to their session), and so the normal handler is already associated
 with "perl-script".
 
 I'm now encountering a problem where I'm trying to use the same module to
 protect simple CGI's, where I'm trying to avoid requiring any custom code
 additions to the CGI's (and would also work with binary CGI's). The problem is
 the normal content handler. Is there a way to leave the handler as the normal
 CGI handler, but in an instance where a login is required, override the handler
 and enable the perl-script handler??
 
 ie;
 
   If authenticated
   {
   handle CGI as per usual
   }
   else
   {
   replace handler with custom login screen page
   }
 
 This is the code I've currently got, which alters the handlers:
 
$r-handler("perl-script");
$r-set_handlers(PerlHandler=[\LoginScreen]);
return OK;
 
 As far as I can see, this should both change the handler to use the Perl
 Script, AND define the perl handler as referencing a subroutine LoginScreen.
 However, in practice the CGI is being executed as per usual (ie; the CGI
 handler isn't being overridden by the mod_perl one).
 
 Any ideas?
 
 -- 
 . Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
 : CWIS Technical Officer -   [EMAIL PROTECTED] : 
 | IT Services   -   Murdoch University | 
  --- Member of the #SAS#  #CFC# 
 | On nights such as this, evil deeds are done. And good deeds, of /
 | course. But mostly evil, on the whole. /
  \  -- (Terry Pratchett, Wyrd Sisters)  /
 



Re: Limiting CPU (was Re: embperl pages and braindead sucking robots)

1999-12-13 Thread Doug MacEachern

 My CPU-based limiter is working quite nicely.  It lets oodles of
 static pages be served, but if someone starts doing CPU intensive
 stuff, they get booted for hogging my server machine.  The nice thing
 is that I return a standard "503" error including a "retry-after", so
 if it is a legitimate mirroring program, it'll know how to deal with
 the error.

choice!
 
 Doug - one thing I noticed is that mod_cgi isn't charging the
 child-process time to the server anywhere between post-read-request
 and log phases.  Does that mean there's no "wait" or "waitpid" until
 cleanup?

it should be, mod_cgi waits for the child, parsing it's header output,
etc.
 
 Also, Doug, can there be only one $r-cleanup_handler?  I was getting
 intermittent results until I changed my -cleanup_handler into a
 push'ed loghandler.  I also use -cleanup_handler in other modules, so
 I'm wondering if there's a conflict.

you should be able to use any number of cleanup_handlers.  do you have a
small test case to reproduce the problem?



Re: VelociGen for Perl, Competetive Analysis?

1999-12-13 Thread Doug MacEachern

 Here's a snip from an email that I just receved from one of your
 co-workers, Alex Shah [EMAIL PROTECTED] in response to this same
 email:
 
 ---begin quote
 
 Why the comparison with mod_perl?  This was part of the agreement we
 made with Sun in order to bundle our product with their web server.  It
 was a strategic decision which step on mod_perl toes.  Sun needed us to
 come up with a white paper to show how the new iPlanet web server was
 superior to the free Apache solution.
 
 ---end quote

hmm, guess we should take this as a complement!
 
   I understand that you guys even use core mod_perl code in your product,
   and yet you have to resort to FUD aginst mod_perl to sell it.
  
VelociGen was written completely independently of mod_perl -
  in fact mod_perl wasn't really around when we start writing the
  code for the Netscape and IIS versions of VelociGen. Our Apache
  port came out quite a bit later, and we didn't use any mod_perl
  code for that. Our architecture is quite a bit different, so 
  not a lot of the code is applicable. We do use Apache::DBI, and
  possibly one or two other Perl modules, which could be classified
  as parts of mod_perl, but to say VelociGen uses core mod_perl code
  is entirely inaccurate.

this isn't true.  mod_perl was around for quite a while before velocigen.
in fact, I downloaded the first version to see what is was all about and
saw a copy-n-pasted file from perlembed.pod, the "Maintaining a persistent
interpreter" section.  that code and documentation was written (by me),
based on mod_perl/Apache::Registry.  I do agree that velocigen is quite
different from mod_perl, but let's be honest here, mod_perl certainly
helped to kick start your product.



Re: Altering handler not working...

1999-12-13 Thread Doug MacEachern

the TypeHandler phase will override your changes, I think.  try setting
$r-handler with a PerlTypeHandler, apache stops after the first one
returns OK, so mod_mime won't stomp your $r-handler settings in that
case.

On Thu, 25 Nov 1999, Trevor Phillips wrote:

 I'm trying to write an access routine which requires altering the handler if
 certain conditions are (not) met. There are a few interesting examples of this
 in the "Apache Modules in Perl  C" book, chapter 7, which do something similar
 within the TransHandler and some other phases, but I'm trying to do it in the
 AccessHandler phase.
 
 Here's a simple test module:
 
 package Access;
 
 use Apache::Constants qw(:common);
 
 sub handler
 {
my $r = shift;
if ( -- some condition test -- )
{
   $r-handler("perl-script");
   $r-set_handlers(PerlHandler=[\SomeRoutine]);
   return OK;
}
return DECLINED;
 }
 
 sub SomeRoutine
 {
my $r = shift;
 
$r-content_type('text/html');
$r-send_http_header;
 
print "Some content...";
return OK;   
 }

 So, basically, if a condition is met, then I return Access as OK, but I also
 override whatever handler is there with a custom one.
 
 The problem is, I cannot get this to work!! If a URI's handler is already
 perl-script, then SomeRoutine is called, but it is NOT overriding other
 handlers.
 
 If I use this module as a TransHandler, then it DOES work correctly, but I
 really need this to come in at the Access phase (as that's what it relates to).
 
 Any ideas?
 
 -- 
 . Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
 : CWIS Technical Officer -   [EMAIL PROTECTED] : 
 | IT Services   -   Murdoch University | 
  --- Member of the #SAS#  #CFC# 
 | On nights such as this, evil deeds are done. And good deeds, of /
 | course. But mostly evil, on the whole. /
  \  -- (Terry Pratchett, Wyrd Sisters)  /
 



Re: Release for 1.22?

1999-12-13 Thread Doug MacEachern


On Fri, 26 Nov 1999, Ken Williams wrote:

 Hi,
 
 I've got an ISP running Apache/1.3.4 mod_perl/1.18, and I'm trying to get them
 to fix some of the broken functionality therein by upgrading to the latest
 versions.  I really need the latest CVS snapshot so that Perl sections work
 correctly, but I doubt I'll be able to convince them to upgrade without a
 formal release.
 
 Any ideas about when that might happen?

soonish, before the new year, I hope.



Re: Eagle Book - mod_hello.c, hello.pl :)

1999-12-13 Thread Doug MacEachern

On Mon, 29 Nov 1999, Michael Dearman wrote:

...
 When looking at http_config.h at the handler_rec structure, the elements
 don't seem to match the way they're used in the example in the book.
 Going to the book site, the src's for the examples are NOT available.
 *shrug*

all of the book source and then some is available from the site, there's a
link on the homepage.  it includes an apxs/Makefile for building the C
modules.



Re: PerlLogHandler - bytes always zero for proxy requests

1999-12-13 Thread Doug MacEachern

On Thu, 2 Dec 1999, Brian S. Craigie wrote:

 Hi Doug,
 
 Thanks and sorry if I looked impatient :-)

nah, sorry if I looked like I thought you looked impatient ;-)
 
 I'm glad that this was spotted.  I thought I was doing something wrong.  I'm
 assuming you are referring to the cvs snapshot of mod_perl?  It wasn't clear
 in my own mind where the problem lay, but I was pretty certain it wasn't in
 either of the DBI logger modules.

yes.
 
 I'll check out the CVS.  Many thanks.

did it cure the problem for you?



Re: PerlLogHandler - bytes always zero for proxy requests

1999-12-01 Thread Doug MacEachern

On Wed, 1 Dec 1999, Brian S. Craigie wrote:

 I presume from the lack of response that nobody knows the answer to this
 one?  Or have I sent this to the wrong mailing list?  Or is it a stupid
 question?

or because you just posted on monday and some people have been extra
super buzy with other things?
have a look at the cvs snapshot and the Changes file, the problem was
fixed a while back:

if $r-bytes_sent has not been calculated, then do so before returning
the value.  thanks to Dirk Melchers for the spot



Re: mod_perl programming logic error

1999-11-03 Thread Doug MacEachern

 thanks Michael!  I've committed your change to the cvs tree.

actually, Eric Cholet did, mine failed, cvs rocks.  need more coffee.

cvs server: Up-to-date check failed for `Changes'
cvs server: Up-to-date check failed for `src/modules/perl/Apache.xs'
cvs [server aborted]: correct above errors first!
cvs commit: saving log message in /tmp/cvs00820baa




Re: Intentional Premature Finish in an Apache Module

1999-11-01 Thread Doug MacEachern

On Mon, 1 Nov 1999, John Siracusa wrote:

 On 11/1/99 2:32 AM, Doug MacEachern wrote:
  or use this undocumented feature:
  
  $Apache::ERRSV_CAN_BE_HTTP = 1; #set this anywhere, startup script is best
  die FORBIDDEN;
  
  mod_perl peeks at $@, if it's a 3 digit http status code, it propagates
  that value to Apache.
 
 Sounds great, but I'm hesitant to use "undocumented features."  Will
 anything like this ever make it into the official spec?  For now I'm
 using eval, I guess, but I'm all for official support for this
 functionality! :)  Of course, the method could be a bit more friendly.
 I mean, no one likes seeing "SV" on the Perl side of things, even if
 it is just a variable name ;)

well, it's only undocumented and awkward to enable because I wasn't sure
how useful the feature would be.  it's in the code base for when the need
arises, like right now, so try it, if it's useful then it can be
documented, etc.



Re: no luck uploading

1999-11-01 Thread Doug MacEachern

On Mon, 1 Nov 1999, Tubbs, Derric L wrote:

 I've been trying to use the "file" input field to upload some files and I'm
 having no luck at all.  I first tried using Apache::Request with no luck and
 the error message "Can't call method "filename" without a package or object
 reference at ..." but I had in fact done a $args = Apache::Request-new($r)
 and $file = Apache::Request-upload.

I don't understand what you are trying to say, without seeing an example.
try the libapreq-x.xx/eg/perl/file_upload.pl script



RE: mod-perl logo

1999-11-01 Thread Doug MacEachern

On Mon, 1 Nov 1999, Kent, Mr. John wrote:

 Doug,
 
 I asked O'Reilly's permission to use the "camel and feather" without
 acknowledging them, and  they said NO, see letter below from Edie Freedman.

gad, I hate politics.  Tim O'Reilly gave us permission to use the camel in
the mod_perl logo two years ago.  I'm can't remember if that means every
site that uses the logo also needs to include the permission text like
perl.apache.org does.

 I say mod-perl needs to adopt a non-proprietary logo.  Wasn't
 there a page somewhere that had competing designs?  Perhaps
 I can use one of them.

perl.apache.org/logos/



Re: Using Apache::Util outside mod_perl

1999-11-01 Thread Doug MacEachern

 So you can't use Apache::Util unless you are running Apache.

exactly.  but it might be possible with the SHARED_CORE configure option,
that builds libhttpd.so, I've never tried though.



Re: follow-up - no luck uploading

1999-11-01 Thread Doug MacEachern

 Our httpd's were spinning out of control on uploads until Doug sent us
 this patch.  I don't know whether it made it into the distribution or
 not.

yabut, that was only when netscape was trying to upload a directory
name and lied about the content length.  anyhow, the patch is in the
distribution, just not released yet.



Re: PATH env garbled in mod_perl 1.21 patch

1999-11-01 Thread Doug MacEachern

On 1 Nov 1999, Greg Stark wrote:

 
 Was this ever resolved? 

yes, fixed in cvs.
 
 I'm concerned because for Oracle the environment variable ORACLE_HOME is
 critical and I think the environment corruption explains some of our past
 database problems.

PATH was the only corrupted variable, this was explained too, see the
archive for details.



Re: setting cookies?

1999-11-01 Thread Doug MacEachern

On Mon, 1 Nov 1999, Wyman Eric Miles wrote:

 
 I should have realized that.  I managed to architect a kludge that sets
 the cookie but causes a fragment of the HTTP header to appear in the
 browser the first time.  For now, I'm content with it.
 
 The next question is, when the cookie expires 2 hours later, the initial
 SecurID user/password has long since expired.  How do I cause the module
 to force the basic auth dialogs again?
 
 $r - note_basic_auth_failure;
 return AUTH_REQUIRED;
 
 Doesn't seem to work.

that's cause netscape, ie, etc, cache basic credentials.  so even though a
401 code is sent to the client, they just reuse the existing
username/password in memory.



Re: Make errors

1999-10-31 Thread Doug MacEachern

On Fri, 15 Oct 1999, John Whitehead wrote:

 I can succesfully make Apache and perl with the following versions ;
  
 apache_1.2.6
 perl5.004_05
 
 when trying to make mod_perl-1.21

mod_perl no longer supports 1.2.x, try 1.3.9 instead.



Re: setting cookies?

1999-10-31 Thread Doug MacEachern

On Mon, 18 Oct 1999, Wyman Eric Miles wrote:

 
 System:
 
 Solaris 2.6
 Apache 1.3.9/mod_perl 1.19/gcc 2.8.1/perl-5.004.04
 
 I'm using SecurID to authenticate for an Apache proxy server.  I've
 written a little perl module that uses a username/tokencode returned by
 basic auth to validate a user and return a session cookie.  The SecurID
 auth works fine and I'm able to generate a cookie for the user.  
 
 The problem is, I can't get the module to return the cookie to the browser
 before the proxy request is completed.

mod_proxy doesn't look at r-headers_out table, it just passing along the
headers from the downstream server.



Re: mod_perl with APXS plus Raven equals segfault

1999-10-31 Thread Doug MacEachern

try building Perl with Configure -Uusemymalloc, solaris+perl malloc don't
seem to get along when mod_perl is a dso.  you're better off to link
static though, solaris system malloc is 25%-30% slower than using Perl's
malloc

On Mon, 18 Oct 1999, Steve Snodgrass wrote:

 I've been using mod_perl with Raven's SSL package for some time now, but I'm
 building a refresh of our environment with new versions of everything and I
 ran into trouble.  I decided to use APXS this time instead of building
 mod_perl statically.  Everything compiled and installed fine but Apache
 immediately segfaults on startup.  The details:
 
 Sun Ultra Enterprise 3500
 Solaris 7 (HW 5/99)
 Apache 1.3.9 (built from Raven pre-patched source)
 Raven SSL 1.4.1
 mod_perl 1.21
 perl 5.005_03
 gcc 2.95.1 (regular Solaris ld, GNU ld is not even on the system)
 
 I guess I can go back to compiling mod_perl statically, but it would be nice
 to get this fixed.  Any thoughts?  Thanks.
 
 -- 
 Steve "Pheran" Snodgrass * [EMAIL PROTECTED] * FORE Systems Unix Administrator
 Geek Code: GCS d? s: a- C++ US$ P+++ L+ w PS+ 5++ b++ DI+ D++ e++ r++ y+*
 "What to do I find it hard to know/The road I walk is not the one I chose" -Yes
 



Re: redirect after POST again?

1999-10-31 Thread Doug MacEachern

if you read POST data, then redirect, you need to do this before the
redirect or apache will hang:
$r-method_number(M_GET);
$r-method('GET');
$r-headers_in-unset('Content-length');

On Wed, 20 Oct 1999, Ilya Obshadko wrote:

 Hello,
 
   Weird things: this simple  plain code
 
 $req-header_out('Location' = $ENV{SCRIPT_NAME});
 $req-status(REDIRECT);
 $req-send_http_header;
 
   in POST script doesn't work with Netscape. It results in 'document
   contains no data' message. If $req-send_http_header is omitted,
   Netscape waits indefinitely until timeout. With IE, it's all ok.
   
   Even more strange - some weeks ago I've installed a VERY similar
   server with the same mod_perl  apache, and all such scripts
   worked fine. But don't advice to diff on all the config files -- it
   would take too long ;)
 
 Best regards,
  Ilya  mailto:[EMAIL PROTECTED]
 
 



Re: Problem at startup (Apache.pm)

1999-10-31 Thread Doug MacEachern

try adding to httpd.conf:
PerlModule Apache


On Thu, 21 Oct 1999, Alessio Bragadini wrote:

 I am sorry to bother you with what seems a FAQ, but the solutions found
 on the list archive (do make install, check permissions, use PerlSetEnv
 PERL5LIB) are not working for me:
 
 after make  make install I have the perl modules in
 /usr/local/apache+mod_perl/lib/site_perl/5.005/alpha-dec_osf
 
 put server startup fails with
 
 Apache.pm failed to load!
 
 Looks like I am missing sometimes, but I cannot find what, probabily
 because it's my firtst mod_perl build.
 
 Apache 1.3.9, mod_perl 1.21, perl 5.005_03, Digital Unix 4.0, Digital cc
 
 Thanks in advance
 
 -- 
 Alessio F. Bragadini  [EMAIL PROTECTED]
 APL Financial Serviceshttp://staff.dsnet.it/~alessio
 Nicosia, Cyprus   phone: +357-2-750652
 
 You are welcome, sir, to Cyprus. -- Shakespeare's "Othello"
 



Re: undefined reference problem

1999-10-31 Thread Doug MacEachern


On Thu, 21 Oct 1999, Scott Anderson wrote:

  am having the following errors trying to compile apache with mod_perl
 
 my mod perl configuration script looks like this
 
 perl Makefile.PL \
 APACHE_SRC=/usr/local/src/apache_1.3.9 \
 NO_HTTPD=1 \
 PREP_HTTPD=1 \
 EVERYTHING=1
 
 i answer yes when it asks about the src dir and no when it asks me if i want to 
build httpd.
 then i do
 make
 make install
 
 and everything seems to be ok
 
 then i goto the apache dir and use this configure script
 
 CC=cc \
 ./configure \
 --prefix=/usr/local/apache \
 --enable-rule=SHARED_CORE \
 --enable-module=so \
 --enable-module=auth_dbm \
 --enable-module=auth_db \
 --enable-module=rewrite \
 --enable-module=info \
 --activate-module=src/modules/jserv/mod_jserv \
 --activate-module=src/modules/php3/libphp3.a \
 --activate-module=src/modules/perl/libperl.a

you're better off to let Makefile.PL do all the work, you can pass those
options to Apache via APACI_ARGS, see also: makepl_args.mod_perl




Re: Apache-read timed out?

1999-10-31 Thread Doug MacEachern

sounds like somebody has already read the POST data before your code is
reached.

On Fri, 22 Oct 1999, Marler, Gordon wrote:

 I'm running mod_perl 1.21, Apache 1.39 on Solaris 2.5.1.
 
 I'm using the proxy example from pp. 374-381 of the "Writing Apache Modules"
 book, and I've come up with a strange case in handling a POST request in the
 following part of the code (explained on page 377).  Here's my doctored
 version of the code snippet:
 
  # Copy POST data, if any
   if ($r-method eq 'POST') {
 $log-debug("Posting!");
 my $len = $r-header_in('Content-length');
 $log-debug("Got the content length for POSTing: $len");
 my $buf;
 $r-read($buf,$len);
 $log-debug("Read the content for POSTing into a buffer");
 $request-content($buf);
 $log-debug("Copied POSTed data into the LWP request");
   }
 
 Turns out that this code hangs (just for this particular POST) at the
 $r-read($buf,$len) for a few minutes, then I get the
 "Apache-read timed out" message in the Apache error log.
 
 Any ideas in what I could look for in the URI or the headers that might give
 me a clue on why this is happening or how I could debug this?  Since the
 Content-length is greater than 0, I can't imagine why this would time out!
 I'm sure this is a special case, since most POSTs work just fine with this
 code.
 
 Gordon Marler
 ATT Wireless Services, WLTG
 Unix System Architect
 [EMAIL PROTECTED]
 Phone: 425 702 2980
 FAX: 425 702 2568
 



Re: Hanging process: detection and determination (was Re: Runawayprocesses)

1999-10-31 Thread Doug MacEachern

 I've checked the Apache::SIG and $r-connection-aborted, but is there a
 way to "write" without actually writing, probably some control char will
 do? Something like:
 
   while(1){
 $r-print("\0");
 last if $r-connection-aborted;
 $i++;
 sleep (1);
   }

have a look at what Eric recently added to the api:

=item $c-fileno( [$direction] )

Returns the client file descriptor. If $direction is 0, the input fd
is returned. If $direction is not null or ommitted, the output fd is
returned.

This can be used to detect client disconnect without doing any I/O,
e.g. using IO::Select.
 
 See the output of strace, when I press Stop - it detects the SIGPIPE but
 doesn't quit!
... 
 So Apache::SIG doesn't set correctly the mod_perl's default behaviour,
 since when I add: 
 
 use Apache::SIG ();
 Apache::SIG-set;

hmm, I thought we were done with SIGPIPE, the patch below will re-enable
auto-calling of Apache::SIG-set

Index: mod_perl.c
===
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.91
diff -u -u -r1.91 mod_perl.c
--- mod_perl.c  1999/08/16 07:50:15 1.91
+++ mod_perl.c  1999/11/01 07:15:47
@@ -484,14 +484,12 @@
 exit(1);
 }
 
-#if !HAS_MMN_136
 static void set_sigpipe(void)
 {
 char *dargs[] = { NULL };
 perl_require_module("Apache::SIG", NULL);
 perl_call_argv("Apache::SIG::set", G_DISCARD, dargs);
 }
-#endif
 
 void perl_module_init(server_rec *s, pool *p)
 {
@@ -543,9 +541,7 @@
 if(PERL_RUNNING()  PERL_STARTUP_IS_DONE) {
saveINC;
mp_check_version();
-#if !HAS_MMN_136
set_sigpipe();
-#endif
 }
 
 if(perl_is_running == 0) {



Re: Apache::SSI and lookup_uri and POST req fails

1999-10-31 Thread Doug MacEachern

On Tue, 26 Oct 1999, Pouneh Mortazavi wrote:

 i'm so close to getting apache::ssi to work correctly but right now my
 work has come to a halt... 
 
 I've tracked the problem down to POST-ed forms + SSI + virtual includes +
 $r-lookup_uri, but i don't know how to fix it!
 
 I use Apache::SSI to parse the contents of an HTML string and include any
 ssi variables, templates etc before printing to the screen.
 
 my modperl handler has a snippet of code like this:
 
my $ssi = Apache::SSI-new($output_html, $r);
$output_html = $ssi-output();
 
 
 the modperl handler is used to
 
 - display a login page
 - authenticate the user and display any error information
 
 I have  a POST form  for people to type in username,password and trigger
 off this handler. i'm noticing that if i use a POST request, the returned
 page just hangs forever, in the $r-lookup_uri stage of implementing a
 virtual include via SSI. If I use a GET request, $r-lookup_uri completes
 normally.

after the first time you read post data, you need the code below to
prevent somebody else from trying to read post data that's already been
read.
$r-method_number(M_GET);
$r-method('GET');
$r-headers_in-unset('Content-length');



Re: suggestion about PerlRun

1999-10-31 Thread Doug MacEachern

On Thu, 28 Oct 1999, Yasushi Nakajima wrote:

 Hello All
 
 I have made a module derived from PerlRun. It overrides only readscript()
 method in PerlRun. First I wrote as follows (essencial part only)
 
 package Apache::PerlRunFake;
 use Apache::PerlRun;
 @ISA = qw(Apache::PerlRun);
 sub readscript {
   ...
 }
 *handler = \Apache::PerlRun::handler;
 
 But Apache::PerlRun::handler() inclueds following code.
 
 my $pr = Apache::PerlRun-new($r);

the handler() in Apache::PerlRun was not originally indended to be
subclassed.  however, if somebody submits a patch to make is
subclass-able that doesn't break the way Apache::PerlRun currently works,
that would be fine.



Re: forking from the main Apache process

1999-10-31 Thread Doug MacEachern

On Sat, 23 Oct 1999, Stas Bekman wrote:

 
 After investigating deeper into a hanging detection problem, I understood
 that I can quite easily write a monitor that will detect these processes
 and kill them off. I wrote a module Apache::SafeHang with help of
 Apache::Scoreboard that should solve the problem.
 
 The only problem I have with this module, is that it should be forked from
 the main process after the server has completed the configuration. I've
 tried to fork it during the startup (from startup.pl), but then I don't
 get a valid Apache::Scoreboard image, so it's like starting it from shell.
 Is it possible to execute some perl code in the parent process, a moment
 before a first child starts or any time after that?

if you put your code in a Perl section and wait until the second time it
is called, apache will have initialized the scoreboard by then.  if you
use a PerlRequire script, that's only call during the first init-modules
call, before the scoreboard is created.
 
 The third question is again regarding the main process. If I fork the
 process during a startup, when I perform 'apachectl stop' all the
 processes die but the one I've forked. Is there any way to install END{}
 block in the parent main process, so the children wouldn't inherit it?
 Otherwise if they do and it supposed to kill the forked process, a first
 child that quits will kill off the monitor. (I could probably test the pid
 of the process that executes the END block, since I know the pid of the
 parent, I could execute the block only if it's parent process...)

not really, you'd have to put logic in the END routines to do things (or
not do things) based on pid or some other flag.



Re: Intentional Premature Finish in an Apache Module

1999-10-31 Thread Doug MacEachern

On Thu, 28 Oct 1999, Public Interactive wrote:

 I'd like to be able to prematurely end the thread of execution
 within a Perl apache module from someplace *other than* the
 PerlHandler entry point subroutine (usually "handler()").  That is,
 when I'm a few subroutines deep inside my module, I want to be able
 to spit out an error page and have the module finish as if handler()
 had returned OK.  Right now I'm painstakingly propagating return
 values back up to my handler() subroutine, but I'm hoping there's a
 better way.

here's a possible option (from my Mail/.sent-mail a few weeks back):
...
or use this undocumented feature:

$Apache::ERRSV_CAN_BE_HTTP = 1; #set this anywhere, startup script is best
die FORBIDDEN;

mod_perl peeks at $@, if it's a 3 digit http status code, it propagates
that value to Apache.



Re: Memory Leaks?

1999-10-31 Thread Doug MacEachern

sounds like you have PerlFreshRestart On, try turning it Off.  scan the
archives for more info.

On Fri, 29 Oct 1999, Ben Bell wrote:

 Hi,
 
 I'm using the Debian package of mod_perl (1.21) and apache 1.3.9 and
 I've noticed quite nasty memory leaks on server restart. I've noticed
 unresolved bug reports on the Debian pages about this. Is it a known
 issue with this version?
 
 The leak is ca. 2MB each restart (or graceful) with my startup script
 enabled (which queries a database, and uses the following modules:
  Apache
  Apache::PerlSections
  Apache::DBI
  Data::Dumper
  Carp
  VI::Utils
 
 All my vars are declared as "my".
 When I disable all Perl stuff (my startup script, the perl sections etc)
 I still see a memory leak, albeit a smaller one.
 
 Can anyone shed any light on this?
 
 Cheers,
 Ben
 
 
 -- 
 +-Ben Bell - "A song, a perl script and the occasional silly sig.-+
   ///  email: [EMAIL PROTECTED]www: http://www.deus.net/~bjb/
   bjbDon't try to drive me crazy... 
   \_/...I'm close enough to walk. 
 



Re: Profiling

1999-10-31 Thread Doug MacEachern

On 31 Oct 1999, Greg Stark wrote:

 
 Does anyone have any idea how much overhead Apache::DProf or Apache::SmallProf
 add? Will it be possible to use these on a production system without having a
 severe impact?

I wouldn't using profiling on a production site, there is considerable
overhead involved with profiling.  and, as you've seen, possible oddities,
such as random core dumps.  I've seen cases such this code:
my $len = $#array + 1; #dump core
vs.
my $len = scalar @array; #no problem




Re: modules to be left enabled in a mod_perl back-end server?

1999-10-07 Thread Doug MacEachern

On 1 Oct 1999, Stephen Zander wrote:

  "Stephen" == Stephen Zander [EMAIL PROTECTED] writes:
 Stephen Is the SetHandler functionaity of mod_mime available from
 Stephen within mod_perl somehow?  This was the one ovbious
 Stephen problem I could see with removing everything.
 
 Nevermind.  The Eagle book, chapter 8 p407 is my friend.

that's just an example though, you're probably better off just letting
mod_mime take care of things if you don't need to change it's behavior.
 
 image
 Stephen goes off to thwap himself unconscious with Doug  Lincoln's
 excellent book
 /image

:)

-Doug



RE: HTML::Embperl and 'undefined symbol: perl_eval_sv'

1999-10-07 Thread Doug MacEachern

On Sun, 3 Oct 1999, Gerald Richter wrote:

 
  When I use HTML::Embperl for instance like:
 
  perl -MHTML::Embperl -e 'HTML::Embperl::Execute(some_embperl.epl)'
 
  I got: perl: error in loading shared libraries:
  /usr/local/lib/site_perl/5.00561/i686-linux/auto/HTML/Embperl/Embperl.so:
  undefined symbol: perl_eval_sv
 
  it seams that it can't be linked to perl.
 
  The versions is:
 
  Linux 2.3.10
  5.005_61 built for i686-linux
  HTML-Embperl-1.2b9
 
  there was no errors making the Embperl package.
 
 
 Does the "make test" runs without problem, or does it show the same error?
 
 The newest perl version I tried was 5.005_57, where it works without
 problem. Maybe something has changed inside perl since that version?

yup, have a look at mod_perl.h in cvs:

#ifdef eval_pv
#   ifndef perl_eval_pv
#  define perl_eval_pv eval_pv
#   endif
#endif
#ifdef eval_sv
#   ifndef perl_eval_sv
#  define perl_eval_sv eval_sv
#   endif
#endif

-Doug



<    4   5   6   7   8   9