Re: Big pages and gzip

2000-08-15 Thread Doug MacEachern

On Sat, 10 Jun 2000, Ken Williams wrote:

 Darn.  Or perhaps: cool.  Is it possible for me to usurp this module?
 The Apache::Gzip module I've been working on has the same goals and same
 purpose as the one in the eagle, but a bit of a different interface and
 a very different implementation inside.  It's reasonable that if the
 only thing changing is the interface (can I say that with a straight
 face?), the module could be kept the same.  Doug, what do you think?
 
 I assume it would be a bad idea to have two modules, an Apache::GZip
 (from the book) and an Apache::Gzip (on CPAN).  Or might that be okay,
 if notes were added to the docs for each?

how about calling it Apache::GZipStream ?  you can borrow whatever you
like from the book example.




Re: Can anybody explain this?

2000-08-15 Thread Doug MacEachern

On Sat, 17 Jun 2000, Rob Tanner wrote:

 Here's the scenario:
 
 I have a modperl program I've been working on for a while (my first, so I'm 
 a newbie).  I was having problem getting php to run and discovered that if 
 modperl was configured, it ran fine.  But it wasn't my immediate priority, 
 so I let it slide.  This evening, I discovered a similar problem with 
 cgi-bin scripts.  I found that if my modperl script is sandwiched in a 
 location/location directive, everything works as advertised (cgi and 
 php).  In otherwords:
 
 location /foo
   SetHandler perl
   PerlHandler Apache::foofoo
 /location
 
 But if I remove the location directive (the module looks at $r-filename to 
 see if it's the object of the get request), it all breaks again -- i.e., 
 cgi and php, the module works in either case.  This is even true if the 
 very first statement in the module is "return DECLINED;" which should not 
 be necessary since the perl module shouldn't even see the cgi request.  And 
 just to satisfy myself, I confirmed that assumption absolutely with a 
 couple of print statements to STDERR (prints to the error_log).
 
 What is actually going on here?  I loose some useful but not essential 
 functionality by using location and/or directory directives, and I would 
 prefer not to.  What do I need to do to fix it?

the problem is that without the Location, SetHandler perl-script applies
to every request, only mod_perl can handle that type, so returning
DECLINED doesn't help.  you'd be better off with a PerlFixupHandler (and
no SetHandler perl-script), let the FixupHandler decide if the request
should be handled by mod_perl, and if so:
$r-handler('perl-script');
$r-push_handlers(PerlHandler = \Apache::foo);





Re: Segfault Apache1.3.12/mod_perl1.24/Solaris2.6

2000-08-15 Thread Doug MacEachern

On Mon, 19 Jun 2000, G.W. Haywood wrote:

 Hi Eric,
 
   [Fri Jun 16 17:20:21 2000] [notice] \
   child pid 22310 exit signal Segmentation Fault (11)
 
 On Mon, 19 Jun 2000, Eric Cholet wrote:
 
  backtrace.
 
 (gdb) bt
 #0  0x2b444 in perl_handler_ismethod ()
 #1  0x2c43c in perl_call_handler ()
 #2  0x2bd5c in perl_run_stacked_handlers ()
 #3  0x29920 in perl_handler ()
 #4  0x7fce8 in ap_invoke_handler ()
 #5  0x9bdfc in ap_some_auth_required ()
 #6  0x9be7c in ap_process_request ()
 #7  0x8fbac in ap_child_terminate ()
 #8  0x8fe14 in ap_child_terminate ()
 #9  0x90014 in ap_child_terminate ()
 #10 0x908f4 in ap_child_terminate ()
 #11 0x914a0 in main ()
 
 Curiously enough, Apache::Registry seems to run ok with a simple
 "Hello world" type of script.  Stay tuned.

if you haven't tried already, this bug has been fixed in cvs for quite a
while:
fix for 'sub handler : method {}' support when method is not found
[Eric Cholet [EMAIL PROTECTED]]





Re: Pages stopping and not loading completely...

2000-08-15 Thread Doug MacEachern

On Mon, 19 Jun 2000, Matt Sergeant wrote:

 On Mon, 19 Jun 2000, Farley, Scott wrote:
 
  I'm running an application Apache + mod_perl that connects to an MySQL
  database and the pages every so often decide not fully load.  You can even
  see the the HTML printed to the screen sometimes because the stream is
  broken in the middle.  Some of the error messages include:
  
  [Mon Jun 19 11:07:33 2000] [info] mod_perl: Apache-print timed out for
  xxx.xxx.xxx.xxx
  [Mon Jun 19 11:07:33 2000] [debug] Apache.xs(1040): mod_perl: rwrite
  returned -1
 
 Its a long fixed bug. Upgrade your mod_perl.

no, the bug that was fixed was the explosion of endless 'mod_perl: rwrite
returned -1' messages.  it is still possible to see that error if LogLevel
is set to debug and ap_rwrite() fails.




Re: Multiple module configuration directive problem

2000-08-15 Thread Doug MacEachern

On Wed, 21 Jun 2000, Rob Tanner wrote:

 Solved my own problem -- read other modules config with:
 
Apache::ModuleConfig-get($r, 'Apache::other_module')
 
 Since that means each module has to figure out whether it's reading it's 
 own directives or it's neighbors, this mechanism in this case is kind of 
 cludgy.  Can I get both modules to actually read the same directives?

two modules can read the same directive if the first returns
Apache::Constants::DECLINE_CMD




Re: Apache::Util problem

2000-08-15 Thread Doug MacEachern

On Wed, 21 Jun 2000, Joel Bremson wrote:

 All of a sudden I'm getting an error when
 I use Apache::Util. It was working fine,
 and then stopped. I've isolated the
 module from my code and still get the error.
 
 Apache is 1.3.6 and perl is 5.00503.

what version of mod_perl?
 
 
 This is the module:
 
 package iSyn::Apache::foo;
 
 use Apache::Util qw(escape_uri);
 
 
 This is the compile result:
 
 pris-517:perl -wc foo.pm
 Can't locate object method "boot" via package "mod_perl" at
 /p/server/perl5.005_03/lib/site_perl/5.005/sun4-solaris/Apache/Util.pm
 line 19.
 BEGIN failed--compilation aborted at foo.pm line 3.  

seems like the wrong mod_perl.pm is picked up, you should be able to
syntax check outside of httpd:
% perl -ce 'use Apache::Util ();'
-e syntax OK

that's part of the reason mod_perl::boot() exists, so bootstrap of the c
symbols are not attempted outside of httpd.




Re: Group authorization information in a downstream chained handler

2000-08-15 Thread Doug MacEachern

On Thu, 22 Jun 2000, Christian Gilmore wrote:

 I'm trying to create a cache for group authorization. I'm wondering if
 there's any way I can alter the requires information during the initial
 authorization so that the cache building code can just pick from that which
 group this person matches instead of re-authorizing during cache creation.
 
 I'd like for the actual authorization handler to not need necessarily to be
 tied to a cache, so doing the entire authorization and caching in one module
 is not optimal, IMO. I'm going for the following (printed below on multiple
 lines just for readability):
 
   PerlAuthzHandler
   Tivoli::Apache::AuthzCache
   Tivoli::Apache::AuthzLDAP
   Tivoli::Apache::AuthzCache::manage_cache
 
 If the require line contains more than one group, I don't believe that I, by
 default, have any way to know, even after AuthzLDAP has completed
 successfully, of which group the client user is a member.
 
 Any ideas? I intend to release all of these cache and LDAP auth modules when
 complete and put through some testing internally.

you can override the 'requires' directive using directive handlers, you'll
just need to manage the structure yourself.




Re: Segfault in perl_handler_ismethod

2000-08-15 Thread Doug MacEachern

On Mon, 26 Jun 2000, Rich Williams wrote:

 
 Hi,
 
 Linux 2.2.14, Apache 1.3.12, Perl 5.6.0, mod_perl 1.24.
 
 On the first request, I get a segfault after perl_handler_ismethod
 is called.
 
 #0  0x40280fdc in mod_perl_register_cleanup (r=0x92ba3fc, sv=0x1) at mod_perl.c:1242
 #1  0x40280fb0 in perl_handler_ismethod (pclass=0x92ba3fc, sub=0x1 Address 0x1 out 
of bounds) at mod_perl.c:1236

this is a strange looking stacktrace, but this might be fixed in cvs with
this change:
fix for 'sub handler : method {}' support when method is not found
[Eric Cholet [EMAIL PROTECTED]]




Re: -DDL_UNLOAD_ALL_AT_EXIT ?

2000-08-15 Thread Doug MacEachern

On Mon, 26 Jun 2000, Mikhail Zabaluev wrote:

 Hello,
 
 I'm interested to know, does the DL_UNLOAD_ALL_AT_EXIT compilation flag
 for Perl 5.6.0 affect mod_perl's behaviour in any way? 'man perldelta'
 says that it might.

no, it was designed to, but mod_perl implements the feature in it's own
way so it'll work with older Perls too.




RE: set_handlers() bug?

2000-08-15 Thread Doug MacEachern

On Mon, 26 Jun 2000, Geoffrey Young wrote:
 
 IIRC, Doug agreed to take a look at get/set handlers issues 'soonish' :)

i guess this is later than 'soonish', sorry ;-/




Re: recursion in Apache::Constants::AUTOLOAD?

2000-08-15 Thread Doug MacEachern

On Mon, 26 Jun 2000, Jim Winstead wrote:

 We were seeing some servers spin out of control (allocating memory
 slowly) in Apace::Constants::AUTOLOAD (which apparently has been
 reported in the mailing list before).
 
 The attached patch fixes the problems for us. Could someone who
 understands what is going on here shed some light?

ouch, how did you trigger this problem?  i don't see how that could
happen Apache::Constants::__AUTOLOAD should always be defined inside
httpd.  does this version of your patch prevent it?

--- Constants/Constants.pm  2000/03/03 20:42:01 1.20
+++ Constants/Constants.pm  2000/08/16 04:05:45
@@ -18,7 +18,7 @@
 #outside of mod_perl this will recurse looking for __AUTOLOAD, grr
 *AUTOLOAD  = sub {
#why must we stringify first???
-   __AUTOLOAD() if "$Apache::Constants::AUTOLOAD"; 
+   __AUTOLOAD() unless $Apache::Constants::AUTOLOAD =~ /__AUTOLOAD$/;
goto $Apache::Constants::AUTOLOAD;
 };
 }





Re: Apache::Config module

2000-08-15 Thread Doug MacEachern

On Tue, 27 Jun 2000, Nathan Wiger wrote:

 Hi all-
 
 I've written a module that can parse the Apache httpd.conf config file
 (and in fact any Apache-like config file). It will take a set of
 directive like:
 
  ServerName www.mydomain.com
  UseCanonicalName   Off
  
 And parse it case-insensitively, returning a ref to a hash:
 
 my $ac = new Apache::Config;
 my $conf = $ac-readconf($configfile);
 print $conf-{servername};   # = "www.mydomain.com";
 print $conf-{usecanonicalname}; # = 0   (not undef so can test
  #for defined() still)

it would be really cool if this module could support dumping of a parsed
config file into the same format that Perl sections understand.  and the
other way around, dumping a Perl section back into a .conf that Apache
can read without Perl sections.

 In any case, I have several questions:
  
 1. Does a module like this exist anywhere?  I saw Doug's
Apache::httpd_conf, but this only takes care of writing
a very minimal config file. I looked thru all the
Apache:: modules but didn't see one.

yeah, Apache::httpd_conf was something that was started and never
finished.  i think ken williams is working on something in this area, for
modules to write test config files.
  
 2. Is the name Apache::Config a good name for this module?
It seems like the obvious choice to me, and doesn't
look like it's taken. I've also played around with
Apache::ConfigFile and Apache::ReadConf, either of
which I'm open to as well (or other suggestions?).

i'd go with Apache::ConfigFile.




Re: CHECK blocks under mod_perl?

2000-08-15 Thread Doug MacEachern

On Wed, 28 Jun 2000, Michael J Schout wrote:

 Hi.
 
 I would like to use a CHECK { } block under mod_perl, but have so far not had
 any luck.  It seems like mod_perl does not know how to deal with CHECK { }
 blocks.  Is this true?  If so, can it be remedied?   I cant use a BEGIN block
 for what I am doing because it must happen after compilation is completed.  I
 know that CHECK blocks are a 5.6.0 feature so this is why I think maybe
 mod_perl doesnt know how to deal with them.

Perl only calls CHECK blocks during perl_parse(), which mod_perl calls
once at startup time.  so CHECK blocks don't work for the same reason this
doesn't:
% perl -e 'eval qq(CHECK { print "ok\n" })'

can you give an example of what you're trying todo?  it might be
reasonable to fit this into Apache::Registry, which already has to special
case END blocks.  i'd rather not add another special case, but if there's
good reason, it shouldn't be difficult to implement.




Re: does __END__ at the end save memory?

2000-08-15 Thread Doug MacEachern

On Thu, 29 Jun 2000, Vladislav Safronov wrote:

 Hi, 
 
 Does __END__ directive at the end of every mod_perl script
 reduce memory used by httpd ?

in a module, no.  in an Apache::Registry script, __END__ blocks are not
supported.  if they were, __END__ would consume more memory to maintain
the *DATA filehandle.




Re: getting data posted to site

2000-08-15 Thread Doug MacEachern

On Thu, 29 Jun 2000, Scott Alexander wrote:

 I'm trying to get the data that is posted from the browser durring a 
 request.
 
 if ($r-method ne 'GET')
 {
   $r-read($buffer,$r-header_in('Content-Length'));
   #proccess data...
 }
 
 The $r-read() hangs the request completely.  I ran an strace on 

that normally happens because somebody already read the POST body.  are
you still having this problem?  the best way to figure out who is doing
this would be to use gdb:

% gdb httpd
(gdb) b ap_get_client_block
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) run -X

now make a request:
(gdb) curinfo

should show the current Perl filename:linenumber

continue:
(gdb) c

and use curinfo the next time the breakpoint is hit.




Re: SIGPIPE errors

2000-08-15 Thread Doug MacEachern

On Thu, 29 Jun 2000, Brent Meshier wrote:

 Occasionaly, during a GET/POST, the request will be
 dropped and netscape/IE returns "Document Contains No
 Data".  The errors logs report:
 
 [modperl] caught SIGPIPE in process 18311 hint: may be a
 client (browser) hit STOP?
 [modperl] process 18311 going to Apache::exit with
 status=-2
 
 When this happens, it will continue on for the next
 three or four sequential requests.
 
 I also will see the webpage load with:
 Error: at
 /usr/lib/perl5/site_perl/5.005/i686-linux/Apache/SIG.pm
 line 31.
 
 but not always during the SIGPIPE problems.
 
 The modperl version is:
 Server Version: Apache/1.3.12 (Unix) PHP/4.0.0
 mod_perl/1.24
 Linux 2.2.5-22smp #1 SMP Wed Jun 2 09:11:51 EDT 1999
 i686 unknown
 PERL version 5.005_03 built for i686-linux

Apache::SIG is no longer enabled by default with apache_1.3.6+, do you
have it configured somewhere?  take it out of your config and things
should be fine.




Re: Cryptic Apache::Registry read() behavior

2000-08-15 Thread Doug MacEachern

On Fri, 30 Jun 2000, Cyrus Rahman wrote:

 Hmm, I was just adapting a large application I wrote some years ago to work
 with mod_perl.  Much to my amazement, despite its complexity and the fact that
 it was largely written before mod_perl, it worked without modification!  Well,
 almost.  There is one problem:
 
 When handling form uploads, it calls read() from perl and expects it to act
 just like the perl version.  But Apache.pm's read() does one notable thing
 differently.  If you do a 'read(STDIN, $buf, $size)', Apache.pm's read
 concatenates the new data to the previous contents of $buf instead of replacing
 it.
 
 Now it is not that hard to clear the buffer before each read, but the unusual
 behavior breaks other things too, like the form uploads in CGI_Lite.  Is the
 concatenation an intentional feature, or is it a bug?

hmm, Apache::read() has not been touched for something like 2-3 years.  i
don't recall if it's a feature (e.g. something CGI.pm needs), so i
hesitate to change it at this point.
 
 Besides this it really is remarkable how perfectly mod_perl reproduces the CGI
 environment!

good news :)




Re: Cryptic Apache::Registry read() behavior

2000-08-15 Thread Doug MacEachern

if anybody wants to confirm that this won't break anything (e.g. CGI.pm),
this patch will clear the buffer before appending to it.

--- Apache/Apache.pm2000/08/15 04:35:13 1.52
+++ Apache/Apache.pm2000/08/16 04:36:30
@@ -65,7 +65,7 @@
 my($nrd, $buf, $total);
 $nrd = $total = 0;
 $buf = "";
-$_[1] ||= "";
+$_[1] = "";
 #$_[1] = " " x $bufsiz unless defined $_[1]; #XXX?
 
 $r-hard_timeout("Apache-read");





Re: Apache 2 opportunity

2000-08-15 Thread Doug MacEachern

On Sun, 2 Jul 2000, Francesco Pasqualini wrote:

 I think in the current version of modperl there is an important feature
 missing.
 At this time is not possible to share resources between apache childs and so
 we can not use "really" persistent DBI coneection.
 What I intend is the possibility to store a DBI connection in the $Session
 hash (Apache::ASP or Apache::Session).
 In this way we can start a DB connection for each user session and we can
 have different application upon differnet DB.
 The connection is started when the user session start, is maintenied in
 memory (in the apache main process ?),it is visible to the apache childs
 (threads) and is destroied at session end.
 
 With the efforts (syntax tree sharing between threads) necessary to port
 modperl to apache 2, will be  possible to implement such a feature ?

it will be possible to share db connections between threads.  but 2.0 is
hybrid, there are still multiple processes, you cannot share db
connections between them, without something like DBD::Proxy.




Re: DIR_MERGE and .htaccess

2000-08-15 Thread Doug MacEachern

On Tue, 4 Jul 2000, Matt Sergeant wrote:

 Shouldn't DIR_MERGE be called when .htaccess files are found at different
 levels, e.g:
 
 /axkit/.htaccess
 and
 /axkit/test/.htaccess
 
 I ask for /axkit/test/test.xsp
 
 I would have expected it to ask for both .htaccess files and try and merge
 the two using DIR_MERGE, but it doesn't. Am I missing something, or is
 this expected functionality?

it's up to apache when dir_merge gets called.  do you see other apache
config getting merged in that scenario?  i'm not sure what's supposed to
happen in that case without testing.




Re: mod per compilation problem

2000-08-15 Thread Doug MacEachern

On Wed, 5 Jul 2000, Kailashnath V Rampure wrote:

 This is with reference to ur mail on mod_perl APXS error w/ apache/raven to
 modperl mailing list.
 I have a problem same problem with mod_perl. I just removed the the -Wl, -E
 option from the flags of Make file for mod_perl but unable to compile
 mod_perl asa DSO.
 
 I would like to know that were you able to compile mod_perl as a DSO on
 HP-UX 11 if so can let me know the steps you used to correct the problem.
 
 
 I have got the following error:
 
 Apache istallation error:
 
 ld -b -L/usr/local/lib -o libperl.so mod_perl.lo perlxsi.lo perl_config.lo
 perl_util.lo perlio.lo mod_perl_opmask.lo  Apache.lo Constants.lo
 ModuleConfig.lo Log.lo URI.lo Util.lo Connection.lo Server.lo File.lo
 Table.lo -Wl,-E -Wl,-B,deferred   -L/usr/local/lib
 /opt/perl5/lib/5.00503/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5/
 lib/5.00503/PA-RISC2.0/CORE -lperl -lnsl -lnm -lndbm -ldld -lm -lc -lndir -l
 crypt
 ld: Unrecognized argument: -Wl,-E
 ld: Usage:  ld flags... files...

it looks like Perl's Config.pm is broken.  -Wl is meant for the compiler
(when used as LD), to pass arguments to the linker.  so, if you change:
-Wl,-E -Wl,-B,deferred

to -E -B deferred

it should work.  if you still have trouble, please post your 'perl -V'





Re: crash in modperl-1.24

2000-08-15 Thread Doug MacEachern

On Mon, 10 Jul 2000, Mark D. Anderson wrote:

 environment: linux redhat 2.2.12-20, modperl 1.24, apache 1.3.12
 
 i've tried it with both perl 5.6 and with 5.005-03.
 in both cases, i get a segv crash almost immediately the first time i issue
 a request for a url using a perl handler (static file handling is fine).
 
 below are the stack traces for the two perl versions, when run with -X .
 any suggestions for fixes or workarounds are very appreciated.
 (maybe building without EVERYTHING=1? who knows)

if you could do this:

% gdb httpd
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) run -X
[make a request that core dumps]
(gdb) curinfo

should print the Perl filename:linenumber, posting a code window around
that area might shed some light.




Re: Why can't I use a package name under Apache::Registry

2000-08-15 Thread Doug MacEachern

On Tue, 11 Jul 2000, bill chmura wrote:

 
 Hello,
 
 I have a problem with using apache::Registry and have not been able 
 find an answer in the eagle book or the mod_perl site, so i am missing 
 something here.  
 
 If I take the following script and run it under apache::registry it 
 runs fine:
 
 #!/opt/perl5/bin/perl
 print "Content-type: text/html\n\n";
 exit;
 
 If I throw a package name in there (like below) it still runs fine as a 
 standalone script and CGI script, but under apache::registry it 
 forwards an unrecognized header to the browser, which I cannot 
 determine what it is.  I have removed the package from the code, but 
 still wonder why I cannot do this?
 
 #!/opt/perl5/bin/perl
 package myscript;
 print "Content-type: text/html\n\n";
 exit;

because Apache::Registry overrides Perl's builtin exit() in the compiled
script (which has it's own unique namespace).  you're calling exit() in a
different namespace, so exit() is now Perl's builtin exit.  the builtin
exit() calls a c-level exiting, killing the process before Apache's output
buffers have been flushed.
if you're using Perl 5.005+, exit() should be overridden everywhere, what
version are you using?




Re: segmentation fault with CGI::Application

2000-08-15 Thread Doug MacEachern

On Wed, 19 Jul 2000, Michael J Schout wrote:

 I have been trying to get CGI::Application to work under mod_perl today.  So
 far with no success.
 
 Finally I removed everything except CGI::Application from the config files, and
 the server dumps core on startup. 
 
 I have a very stripped odwn httpd.conf that basically loads the bare minimum
 apache modules, then does "PerlModule CGI::Appliation".
 
 Starting httpd dumps core when it tries to start up.
 
 Running it through the debugger produces this:

i think this is one of the bugs fixed by the Perl patch (which will be 
in 5.6.1), see:
[EMAIL PROTECTED]">http://forum.swarthmore.edu/epigone/modperl/dilkhumyox/[EMAIL PROTECTED]

the patch below to mod_perl might also fix it.

--- perl_util.c~Tue Jun 13 10:25:38 2000
+++ perl_util.c Tue Jun 13 11:16:45 2000
@@ -547,12 +547,14 @@
 {
 dTHR;
 SV *sv = sv_newmortal();
+COP *old_cop = curcop;
 dTHRCTX;
 
 sv_setpvn(sv, "require ", 8);
 MP_TRACE_d(fprintf(stderr, "loading perl module '%s'...", name)); 
 sv_catpv(sv, name);
 perl_eval_sv(sv, G_DISCARD);
+curcop = old_cop;
 if(s) {
if(perl_eval_ok(s) != OK) {
MP_TRACE_d(fprintf(stderr, "not ok\n"));




Re: Aborting Apache startup during PerlInitHandler

2000-08-15 Thread Doug MacEachern

On Sun, 23 Jul 2000, Thomas Klausner wrote:

 Hi!
 
 I have got a PerlInitHandler that does some config parsing etc.
 
 I would like Apache to stop starting up and to print out some error
 message ("Config Directive blabla missing" or something like that) if
 an error occures during config parsing. (As it is happing when
 something is wrong with the Apache Config (httpd.cfg ...))
 
 How can this be done?

PerlInitHandler?  that happens at request time, not startup time.
assuming you mean PerlRequire or PerlModule, just do something like so:

warn "config failed";
CORE::exit(1);





Re: Unexpected pnotes() behavior

2000-08-15 Thread Doug MacEachern

pnotes() expects a reference, it probably should croak if it's passed
something else.  it just increments the reference count of the sv, it does
not make a copy.  if you don't want to use a reference, you can copy it
yourself:

$r-pnotes(key = "$string")






Re: User directive

2000-08-15 Thread Doug MacEachern

On Tue, 1 Aug 2000, Rob Giseburt wrote:

 I want to modify the User cofiguration directive in a perl handler ... for
 example in a PerlTransHandler. I'm trying to use mod_perl to implement Named
 Virtual Hosting, and I have everything I need done except User and Group
 mapping so that SuEXEC will pick up the correct user and group to setuid the
 non-mod_perl CGI execution to. I cannot find what variable to change. I know
 that in a Perl.../Perl section it's simple $User, but in a
 PerlTransHandler context it seems you can only view it via $r-server-uid.
 Any suggestions?

you want to change the uid at request time?  the patch below will let you
say $r-server-uid($new_uid);

you'll have to maintain changing it back yourself, like so:

my $old_uid = $r-server-uid($new_uid);
$r-register_cleanup(sub { shift-server-uid($old_uid) });

i'm not sure if we should allow this or not, security implications?

--- src/modules/perl/Server.xs  1999/08/20 08:34:43 1.6
+++ src/modules/perl/Server.xs  2000/08/16 05:19:54
@@ -151,11 +151,16 @@
 RETVAL
 
 uid_t
-uid(server)
+uid(server, id=0)
 Apache::Server server
+uid_t id
 
 CODE:
 RETVAL = server-server_uid;
+
+if (items  1) {
+server-server_uid = id;
+}
 
 OUTPUT:
 RETVAL





Re: RRDs::graph and mod_perl

2000-08-15 Thread Doug MacEachern

On Tue, 1 Aug 2000, Todd Caine wrote:

 I have Apache 1.3.12 installed on Solaris 2.7 running with
 mod_perl 1.24.  I have a simple mod_perl script, it actually
 uses Apache::Registry, that uses a Perl module called RRDs
 that can generate images/graphs from a round robin
 database.  If you pass it a '-' as a file name rrd_graph.c
 prints to 'stdout', or file descriptor 1.  Everything works
 just fine if I run the script using mod_cgi as the handler.
 But when using mod_perl I get a 200 response from the server
 but no data sent to the socket the request came in on.
 
 I just install Perl 5.6 with sfio (safe and fast I/O).
 There was no difference in the way the script was handled.

RRDs::graph needs to use PerlIO_* for sfio to help.  if it's just calling
fwrite(..., stdout), then it bypasses the Perl/sfio layer.
i think there is an sfio stdio.h that you can #include in rrd_graph.c so
stdout will become sfio's stdout, but i haven't dealt with sfio in quite
sometime.




Re: (Fwd) Problem with Authen::Krb4 under mod_perl (fwd)

2000-08-15 Thread Doug MacEachern

On Wed, 2 Aug 2000, Jeff Horwitz wrote:

 [forwarded just in case anyone else is having similar problems]
 
 -- Forwarded message --
 Date: Wed, 2 Aug 2000 10:45:35 -0400 (EDT)
 From: Jeff Horwitz [EMAIL PROTECTED]
 To: Dave Edsall - The Tauminator [EMAIL PROTECTED]
 Subject: Re: (Fwd) Problem with Authen::Krb4 under mod_perl 
 
 First, thank you for responding and responding so quickly. The answer to 
  your question is yes, we are using open_ssl so that we can encrypt the 
  password being sent to the web server. But, if there are name clashes, why 
  would the script work under mod_cgi and not mod_perl? We use ssl in both cases.
 
 mod_cgi simply forks off separate processes.  with mod_perl, the scripts
 are interpreted and run in a Perl interpreter within apache.  Krb4.so is
 loaded just like any other shared library, and will conflict with apache
 if duplicate symbols exist.
 
Is there a way around the name clash problem?
 
 yes.  build Authen::Krb4 with KTH Kerberos, available at
 http://www.pdc.kth.se/kth-krb.  it's a bit cleaner wrt the DES library,
 and it's much easier to build as well!  :)

you can also try the -Bsymbolic linker flag, which is supposed to force
Krb5.so so use the symbols in the libraries it linked against, rather than
those in the main program.  or try the approach below to lump the archives
directly into the .so, but change ssl stuff to krb stuff :)

--- Makefile.PL~Sat Jul 31 00:59:12 1999
+++ Makefile.PL Tue Aug  1 20:18:32 2000
@@ -61,12 +61,13 @@
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
 WriteMakefile(
+'OBJECT' = "SSLeay.o $openssl_path/lib/libssl.a $openssl_path/lib/libcrypto.a",
 'NAME'= 'Net::SSLeay',
 'VERSION_FROM' = 'SSLeay.pm', # finds $VERSION
 'DEFINE'   = '', # e.g., '-DHAVE_SOMETHING' 
 'DISTNAME'  = 'Net_SSLeay.pm',
 'dist'  = { COMPRESS = 'gzip', SUFFIX = 'gz', },
-'LIBS' = ["-L$openssl_path -L$openssl_path/lib $libs"],
+#'LIBS'= ["-L$openssl_path -L$openssl_path/lib $libs"],
 
 ### Win32 build: uncommend LIBS above and edit LIBS below according to your
 ### 




Re: does anyone have a fix for this?

2000-08-15 Thread Doug MacEachern

On Wed, 2 Aug 2000, Jamie Krasnoo wrote:

 Hello all,
 
 I'm new to the list and I'm hoping that someone could help me and explain
 what I'm doing wrong or how to fix this
 
 
 I recently compiled mod_perl-1.24 and it can run modules that I program.
 However I get a segmentation fault (11) when I use a :: to describe where
 the module is.

try mod_perl from cvs (see mod_perl_cvs.pod), this might be releated to
the perl_handler_is_method() fix.




RE: Apache children hanging

2000-08-15 Thread Doug MacEachern

On Tue, 13 Jun 2000, Paul G. Weiss wrote:

 Yes, that much I knew, however when you do that you
 can't use curinfo from .gdbinit, because the process
 is not running.

  % gdb httpd core

that's worked with curinfo for me in the past.




Re: cvs commit: modperl/src/modules/perl Apache.xs

2000-08-15 Thread Doug MacEachern

On Mon, 14 Aug 2000, brian moseley wrote:

 On 15 Aug 2000 [EMAIL PROTECTED] wrote:
 
Log:
fix $r-args(undef)
 
 speaking of which... does $r-args handle multiple args with
 the same name correctly? the docs imply that it doesn't. i
 haven't tried it myself to see.

what do you mean?  args in or out?  $r-args($string) just does a blind
copy.  @args = $r-args just splits on ,=, it's up to the caller to deal
with multiple args of the same name.
 
 if i'm using Apache::Request, does setting a param get
 translated back down into $r-args? prolly not huh.

nope.
 
 i recently had the situation in webmail where i had to
 unescape, utf8-encode, and re-escape each param value, and
 then reformulate the query string. would have been cool if i
 could have just stepped through $r-param and set the values
 for each param, and then used $r-args at the very end.

yeah, i think i had to do something like that in webmail/calendar, there
might even be a comment like #should add something like this to libapreq
just haven't got around to it yet ;-/




Re: cvs commit: modperl/src/modules/perl Apache.xs

2000-08-15 Thread Doug MacEachern

On Tue, 15 Aug 2000, brian moseley wrote:
 
 hm. what about %args = $r-args? won't that give me only the
 last arg value? i suppose i should just do @args = $r-args.
 thanks for the reminder.

yeah.




Re: Patch not accepted?

2000-07-28 Thread Doug MacEachern

On Thu, 27 Jul 2000, Ken Williams wrote:

 Hi all,
 
 I sent a patch for Apache::test a week or so ago.  I got no responses,
 so I'm here to advocate again for its incorporation.  The original
 message is here:
 
http://forum.swarthmore.edu/epigone/modperl/swonflefim
 
 Are any of the CVS guardians listening?  Doug seems to be long absent.

i'm still here, just been in read-only mode the past few weeks.  i should
be able to catch up next week, i'll look at your patch then before 1.25 is
released.





Re: Config directives question

2000-06-30 Thread Doug MacEachern

On Fri, 30 Jun 2000, Matt Sergeant wrote:

 Is there any way I can write RAW_ARGS config directives like:
 
 AxMedia screen
 ...
 /AxMedia
 
 And have the bit between the tags passed through to apache for processing?
 The eagle book only seems to detail processing all the directives between
 the tags myself. But I want to be more modular than that. Am I missing
 some documentation somewhere?

nope, that functionality was missing, i was wanting this too for the
Apache::DBIPool module that'll be part of my tutorial mod_perl-2.0
section at oracon:

 DBIPool dbi:mysql:db_name
   DBIPoolStart 10
   DBIPoolMax   20
   DBIPoolMaxSpare 10
   DBIPoolMinSpare 5
   DBIUserName dougm
   DBIPassWord XxXx
 /DBIPool

more on that later :)  anyhow, with the patch below, here's a modified
TrafficCop.pm (from the eagle book):

sub TrafficCopSpeedLimits ($$$;*) {
my($cfg, $parms, $district, $cfg_fh) = @_;
$district =~ s/$//;
my $config = $parms-create_per_dir_config;

my $errmsg = $parms-command_loop($config);
die $errmsg if $errmsg;

$cfg-{district}-{$district} = $config;
}

sub TrafficCopSpeedLimits_END () {}

handles this in httpd.conf:

TrafficCopSpeedLimits charlestown
TrafficCopTicket StreetSweeping Tuesday Friday
/TrafficCopSpeedLimits

and the configuration test dumper:

sub test {
my $r = shift;
$r-send_http_header('text/plain');
require Data::Dumper;
my $cfg = Apache::ModuleConfig-get($r);
print "$Class configuration:\n";
print Data::Dumper::Dumper($cfg) if $cfg;

while (my($key, $val) = each %{ $cfg-{district} }) {
my $tcfg = Apache::ModuleConfig-get($val);
print "$key configuration:\n";
print Data::Dumper::Dumper($tcfg) if $tcfg;
}
}

prints:
Apache::TrafficCop configuration:
$VAR1 = bless( {
 'district' = {
 'charlestown' = 136503732
   }
   }, 'Apache::TrafficCop' );
charlestown configuration:
$VAR1 = bless( {
 'Ticket' = {
   'StreetSweeping' = [
 'Tuesday',
 'Friday'
   ]
 }
   }, 'Apache::TrafficCop' );


Index: src/modules/perl/ModuleConfig.xs
===
RCS file: /home/cvs/modperl/src/modules/perl/ModuleConfig.xs,v
retrieving revision 1.10
diff -u -r1.10 ModuleConfig.xs
--- src/modules/perl/ModuleConfig.xs2000/04/03 04:48:52 1.10
+++ src/modules/perl/ModuleConfig.xs2000/06/30 19:31:44
@@ -75,6 +75,9 @@
*type = MP_TYPE_SRV;
return s-module_config;
 }
+else if(SvIOK(sv)) {
+return (void *)SvIV(sv);
+}
 else {
croak("Argument is not an Apache or Apache::Server object");
 }
@@ -192,6 +195,27 @@
 OUTPUT:
 buff
 RETVAL
+
+void *
+create_per_dir_config(parms)
+Apache::CmdParms parms
+
+CODE:
+RETVAL = ap_create_per_dir_config(parms-pool);
+
+OUTPUT:
+RETVAL
+
+const char *
+command_loop(parms, config)
+Apache::CmdParms parms
+void *config
+
+CODE:
+RETVAL = ap_srm_command_loop(parms, config);
+
+OUTPUT:
+RETVAL
 
 char *
 path(parms)




Re: problem with IO::Select under Apache::Registry (long)

2000-06-09 Thread Doug MacEachern

On Thu, 1 Jun 2000, tim fulcher wrote:

 2000] Msg.pm: Can't call method "new" without a package or object
 reference at /usr/borg/lib/perl5/5.00503/Msg.pm line 11.
...
 mod_perl 1.21

try upgrading to 1.24.  a fix related to the Perl stack pointer in 1.23
might be the cure for this.




Re: Apache children hanging (not exiting)

2000-06-09 Thread Doug MacEachern

On Thu, 1 Jun 2000, Jay Jacobs wrote:

 With that previous thread of Apache children hanging up the server it made
 me think of an issue I see quite frequently in development... When I stop
 the mod_perl server, it won't exit properly (or fast) :
 
 [warn] child process 8530 still did not exit, sending a SIGTERM
 (multiplied by number of processes)
 
 I've seen this on servers running really sloppy code as well as really
 tight code (but a lot of it).  Eventually the children do die off, but it
 takes about 15 seconds...

from mod_perl.pod:
=item PERL_DESTRUCT_LEVEL

With Apache versions 1.3.0 and higher, mod_perl will call the
perl_destruct() Perl API function during the child exit phase.
This will cause proper execution of BEND blocks found during server
startup along with invoking the BDESTROY method on global objects
who are still alive.  It is possible that this operation may take a
long time to finish, causing problems during a restart.  If your code
does not contain and BEND blocks or BDESTROY methods which need to
be run during child server shutdown, this destruction can be avoided by
setting the IPERL_DESTRUCT_LEVEL environment variable to C-1.





Re: err_headers_out Q

2000-06-09 Thread Doug MacEachern

On Fri, 2 Jun 2000, Geoffrey Young wrote:

 hi all...
 
 this simple script:
 
 #!/usr/bin/perl
 
 my $r = shift;
 $r-err_headers_out-add('Set-Cookie' = "name=error");
 warn "pre headers_out: " . $r-headers_out-get('Set-Cookie');
 
 $r-send_http_header('text/plain');
 
 warn "post headers_out: " . $r-headers_out-get('Set-Cookie');
 print "done";
 
 yields:
 pre headers_out:  at /usr/local/apache/perl-bin/err.cgi line 7.
 post headers_out: name=error at /usr/local/apache/perl-bin/err.cgi line 9.
 
 and sets the cookie...
 
 I was initially trying to create a PerlInitHandler to put a cookie in
 err_headers_out, which I would expect to be set only if other handlers down
 the line error out, but it was being set every request.
 
 am I misunderstanding err_headers_out, or is send_http_header misbehaving? 

see http_protocol.c:send_http_header():

if (!ap_is_empty_table(r-err_headers_out))
r-headers_out = ap_overlay_tables(r-pool, r-err_headers_out,
r-headers_out);




Re: use DBI () (and modules in same die) dies in startup.pl

2000-06-09 Thread Doug MacEachern

On Fri, 2 Jun 2000, Michael Todd Glazier wrote:

 Hey all! I'm having a really weird problem with mod_perl where is 
 dies loading modules from a certain dir in startup.pl
 
 I'm running Red Hat Linux 6.2 with: Embedded Perl version 5.00503 for 
 Apache/1.3.12 (Unix) (Red Hat/Linux) mod_perl/1.21

try mod_perl/1.24





Re: Segment fault in Perl_pp_leavetry

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Mike McLagan wrote:

 Hello,
 
I am having the above segfault using mod_perl 1.23 and mod_perl 1.24 on a 
 RedHat 6.2 system with Perl 5.00503.  The Apache daemon was compiled with max 
 DSO and included the mod_ssl patches, etc as shown below.  mod_perl is compiled 
 with -DEAPI per it's request.  If I operate without mod_auth_mysql, the server 
 is fine.  If I operate without mod_perl, the server is fine but my perl 
 programs don't work.
 The code for mod_auth_mysql hasn't changed in over a year or more so I am 
 inclined to believe that it's not the source of the problem.
 
 [root #] gdb httpd
 (gdb) set args -X
 (gdb) run
 [notice] Apache/1.3.12 (Unix) AuthMySQL/2.20 mod_ssl/2.6.2 OpenSSL/0.9.5 
 mod_perl/1.24 configured -- resuming normal operations
 Program received signal SIGSEGV, Segmentation fault.
 0x40286b78 in Perl_pp_leavetry () from /usr/lib/apache/mod_perl.so
 (gdb) bt
 #0  0x40286b78 in Perl_pp_leavetry () from /usr/lib/apache/mod_perl.so
 #1  0x40204238 in ?? () from /usr/lib/apache/mod_perl.so
 #2  0x78756e69 in ?? ()
 Cannot access memory at address 0x6c2e6264
 (gdb)

try this:
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) curinfo

hopefully that will print the filename:line of the code Perl was running
here.   maybe that will shed some light.  do you have these same troubles
if mod_perl is linked static?




Re: $r-register_cleanup limits?

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Jim Woodgate wrote:

 
 In a module I'm using register_cleanup so the client doesn't need to
 wait for me to do a bunch of work.  It basically does this:
 
 foreach (@images) {
   unless (-f $thumb{$_}) {
 create_thumb($_);
 $r-register_cleanup(sub {create_more_sizes($_, ...)});
   }
 }

there's no limit the number of cleanups you can register, but i would
still push the sub {}'s into an array and register a single cleanup to
iterate over them.
 
 create_more_sizes will create various additional sizes to scale down a 
 large picture.
 
 This seems to work really well unless there is a large set of images,
 then the cleanup handler doesn't get all the way through.  I don't see 
 any warnings/errors.  (And unfortunately since the thumbnail is
 created the next time someone visits create_more_sizes won't get
 called unless I do explicit checks, which would cause me to actually
 read the images and I was hoping to avoid that)
 
 Anyway I'm not sure if I'm hitting a limit on the amount of time it
 is taking or if I'm just registering too many cleanups.
 
 I was thinking of $r-reset_timeout() as the first line of
 create_more_size(), but thought I would check with the list first as I 
 don't fully understand the ramifications.

i don't think $r-*_timeout will work properly in a cleanup, but alarm +
eval {} should be fine.  if you want to see where it's stuck, try this:
% gdb httpd pid of spinning process
(gdb) where
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) curinfo





Re: Apache hanging when it reaches limit of process limit

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Tom Lancaster wrote:

 Hi,
 I've got this strange behavior in a production site that until a recent
 upgrade never showed this kind of thing:
 I've set maxclients to 50, maxrequestsperchild 1.
 What happens is that the server runs fine, is fast, etc, but the number
 of apache processes climbs gradually until it reaches ~maxclients, then
 will no longer serve pages.
 I thought this was due to children not exiting, but some of them
 apparently do, as the number of processes rises and falls on its way to
 the top.
 
 What is Apache supposed to do when you set maxrequestsperchild to 1?
 I'd have thought each process would exit immediatley after serving
 something.
 I'm inclined to think there's something in my code that's hanging, but I
 read that the symptom of that is processes consuming large amounts of
 CPU - they're not, and memory usage is normal, too (~10M).
 
 Another symptom: sometimes when the processes are nearing the top,
 they'll start haging, but one by one; if I hit stop on a non-responsive
 request, then re-try, it serves fine.
 
 I'm using the debian package of modperl 1.21 statically linked with
 apache 1.3.9, and HTML::Embperl 1.2.1 ( I think).

i suggest upgrading to 1.24.  i also suggest setting maxrequestsperchild
higher than 1.  if you do have httpds hanging, this might shed some light:

% gdb httpd pid of spinning process
(gdb) where
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) curinfo





Re: Apache hanging when it reaches limit of process limit

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Tom Lancaster wrote:

 Here's the output of gdb: ( now what does this mean?)
...
 Breakpoint 1, 0x400ddd35 in exit () from /lib/libc.so.6
 (gdb) bt
 #0  0x400ddd35 in exit () from /lib/libc.so.6
 #1  0x80851e1 in ap_start_restart ()
 #2  0x8085454 in ap_start_restart ()
 #3  0x80862d7 in ap_child_terminate ()
 #4  0x8086a4d in main ()
 #5  0x400d5a42 in __libc_start_main () from /lib/libc.so.6
 (gdb) 

the exit() makes sense, since you have maxrequestsperchild set to 1, but
the stacktrace should look more like this:

(gdb) where
#0  exit (status=0) at exit.c:40
#1  0x80cf0eb in clean_child_exit (code=0) at http_main.c:493
#2  0x80d1e83 in child_main (child_num_arg=0) at http_main.c:3893
#3  0x80d23dc in make_child (s=0x821dbe4, slot=0, now=960572421)
at http_main.c:4264
#4  0x80d2537 in startup_children (number_to_start=5) at http_main.c:4346
#5  0x80d2b54 in standalone_main (argc=6, argv=0xb624) at
http_main.c:4634
#6  0x80d32d3 in main (argc=6, argv=0xb624) at http_main.c:4961

are you calling $r-child_terminate somewhere?  that's not actually called
anywhere in the apache source, it's just an api for modules.




Re: Apache dumping core in mod_perl's 'make test'

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Stas Bekman wrote:

 Please! Keep the questions on the list!!! thank you!
 
  Thought the aforementioned procedure might be useful explaining my
  current trouble.  Perl 5.5.3, Apache 1.3.12, mod_perl 1.24 -- no other
  add-ons to Apache...  OS is Linux (kernel 2.2.10).
 
  Any hints?
 
 I think I've seen this behavior when I had DProf enabled (the same
 enviroment). Turn it off. 

 I've ported this report myself clueless about the reason, but apparently
 it wasn't answered :(

  #0  0x40175c7f in _IO_fflush (fp=0x4020d480) at iofflush.c:41

what's the output of:
(gdb) print *fp

i'm quite sure _fileno will be 2 (stderr), which something may have
botched, what i don't know.  strace-ing to see fiddlings with fd 2 might
shed some light.





Re: Strange Segfault with Apache::PerlRun

2000-06-09 Thread Doug MacEachern

On Tue, 6 Jun 2000, Damon Buckwalter wrote:

 When using Apache::PerlRun to try and run some CGI-ish scripts I noticed a
 strange phenomenon.  If the shebang line in the script contains '-T', that
 Apache child will segfault on requests to the script.  Combinations of '-w',
 nothing in the shebang line and no shebang line at all work as expected.
 
 Tracing httpd in gdb, it tells me that the segfault is occuring inside
 fgets() in libc.  Perhaps a simple argument parsing problem?

i can't reproduce that.  can you post the complete gdb stacktrace?  what
version of Perl?




Re: Segmentation Fault

2000-06-09 Thread Doug MacEachern

On Wed, 7 Jun 2000, Pierre Laplante wrote:

 
 I am using RH 6.2, mod-perl 1.24, apache 1.3.12 with the following
 program with Apache/registry:
 
 #!/usr/bin/perl -w
 use strict;
 
 my $p = new xyz;
 for(my $i=0; $i  10; ++$i) {
  for(my $j=1;$j100;++$j) {
  my $file = "../xml/$j.xml";
  my $t = $p - loadxml($file);
  }
 }
 print "Content-type: text/html\n\nallo\n";
 
 package xyz;
 use XML::Parser;
 sub new { bless {}; }
 
 sub loadxml {
 my($self, $file)=@_;
 my $p = new XML::Parser(Style = 'Tree');
 my $t = $p - parsefile($file);
 return $t;
 }
 
 After a few run, I got a segmentation fault with apache.
 
 Any idea?

works fine for me.  see the SUPPORT doc for hints on getting a stacktrace.




Re: [performance/benchmark] $|=1 doesn't matter ?!

2000-06-09 Thread Doug MacEachern

On Wed, 7 Jun 2000, Stas Bekman wrote:

 Ok, you'd get surprised on this one. I cannot make benchmark show me
 unbuffered output worse than buffered. Anyone can tell me why? there is
 ap_flash call after each print in the unbuffered case, how comes the
 results are the same?

maybe because both are buffered.
 
 package UnBuffered;
 use Apache::Constants qw(:common);
-- local $|=1;
 sub handler{
-- should be inside here

i don't think your benchmark (lwp requesting script on the same box or
even same network) is going to produce worthwhile results.  not a flame,
but i think there are hardware and network configurations to consider here
that make it difficult to benchmark.




Re: Big pages and gzip

2000-06-09 Thread Doug MacEachern

On Wed, 7 Jun 2000, Ken Williams wrote:

 [EMAIL PROTECTED] (Stas Bekman) wrote:
 
 On Wed, 7 Jun 2000, Mark Hewis wrote:
 
  it would seem to be quite straight forward to implement a handler to gzip
  all output html files depending on the allowed mime-types and/or user_agent.
  This would reduce many pages by up to a factor of 10 in size. 
  
  1) Is anyone already doing?
  2) If not why not?
  3) what borwsers would accept html files in a gzipped format
 
 it's there for a long time:
 Apache::Gzip
 Apache::GzipChain
 
 Actually, as far as I know there's no Apache::Gzip.

close, there is an Apache::GZip in the eagle book and code available
modperl.com




Re: Problems with installing mod_perl

2000-06-09 Thread Doug MacEachern

On Thu, 8 Jun 2000, Wrobel, Thomas wrote:

 Hi,
 
 I have some problems installing mod_perl.
 My system is a Mandrake 7.0 Kernel 2.2.14.
 I have compiled apache 1.3.12 mod_ssl 2.6.4/openssl 0.9.5a
 with DSO. Next, I compiled php4RC2 with apxs and
 apache runs correctly.
 But after installing mod_perl with:
 perl Makefile.PL USE_APXS=1 WITH_APXS=/home/httpd/bin/apxs EVERYTHING=1
 make
 make install
 i become an error: document contains no data ...
 In the error_log i have the warning:
  [warn] x pid child stopped, segmantation fault (11)
 If i deactivate mod_perl the server runs correctly.

what version of Perl?  what version of mod_perl?  if Perl 5.6.0, try
rebuilding Perl with:
% Configure -des -Uuselargefiles




Re: [performance/benchmark] printing techniques

2000-06-09 Thread Doug MacEachern

On Thu, 8 Jun 2000, Stas Bekman wrote:

 Stephen Zander wrote:
  
   "Stas" == Stas Bekman [EMAIL PROTECTED] writes:
  Stas Ouch :( Someone to explain this phenomena? and it's just
  Stas fine under the handler puzzled, what can I say...
  
  Continuous array growth and copying?
 
 Is this a question or a suggestion? but in both cases (mod_perl and perl
 benchmark) the process doesn't exit, so the allocated datastructure is
 reused... anyway it should be the same. But it's not.

only the @array length remains allocated, it's elements are free-d
each time, you're copying the "strings" into a new SV everytime.
push @array, \"string" should make a big difference (remember $r-print
deferences refs to strings)




Re: Can't create custom config directives (long)

2000-06-09 Thread Doug MacEachern

On Thu, 8 Jun 2000, Rob Tanner wrote:
 
 MirrorWiseKeyFile', perhaps mis-spelled or defined by a module not
 included in the server configuration
...
  PerlModule  Apache::MirrorWise

this is becoming a common problem, try this bandaid, instead of that
PerlModule line:

Perl
delete $INC{'Apache/MirrorWise.pm'};
require Apache::MirrorWise;
/Perl





Re: stack dump

2000-06-09 Thread Doug MacEachern

On Thu, 8 Jun 2000, Blue wrote:

 
 Apache 1.3.12, mod_perl 1.24 (USE_EVERYTHING=1), perl 5.6, linux 2.2.12

assuming you built mod_perl as a dso (apxs?), Makefile.PL should have
warned you to choose one of:

Your Perl is uselargefiles enabled, but Apache is not, suggestions:
*) Rebuild Apache with CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
*) Rebuild Perl with Configure -Uuselargefiles
*) Let mod_perl build Apache (USE_DSO=1 instead of USE_APXS=1)




Re: [OT] Re: [performance/benchmark] printing techniques

2000-06-09 Thread Doug MacEachern

 It's not slower in 5.6. "$x and $y" in 5.6 gets turned into $x . ' and '
 . $y (in perl bytecode terms).

that's not new to 5.6.0, variable interpolation in ""'s has always turned
into a concat tree, though 5.005_03 is the oldest version i have handy to
check with.  and, this "$feature" can be quite expensive.




Re: problem with apache-1.3.12, perl-5.6, and mod-perl-1.22 DSO

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Jeff Garner wrote:

 hi folks,
 
 i'm having what i'm sure is a simple problem. when i build mod_perl for use
 with dso, apache will start and then end. a truss doesn't indicate any
 easily identified problems. 

try 1.24




Re: err_headers_out Q

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Drew Taylor wrote:

 Doug MacEachern wrote:
  
  see http_protocol.c:send_http_header():
  
  if (!ap_is_empty_table(r-err_headers_out))
  r-headers_out = ap_overlay_tables(r-pool, r-err_headers_out,
  r-headers_out);
 Basically, what the code above says is that when calling
 send_http_header(), if the headers_out table is not empty, add them to
 the outgoing headers. Am I correct? If so, what is the rational behind
 this? I thought that err_headers_out were only sent if an error occured.
 I would have made the same assumption as Geoff.

yeah, it's explained in httpd.h:

 * The difference between headers_out and err_headers_out is that the
 * latter are printed even on error, and persist across internal redirects
 * (so the headers printed for ErrorDocument handlers will have them).
 *




Re: stack dump

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Blue wrote:

 On Fri, 9 Jun 2000, Doug MacEachern wrote:
 
  On Thu, 8 Jun 2000, Blue wrote:
  
   
   Apache 1.3.12, mod_perl 1.24 (USE_EVERYTHING=1), perl 5.6, linux 2.2.12
  
  assuming you built mod_perl as a dso (apxs?), Makefile.PL should have
  warned you to choose one of:
  
 
 did all that.. compiled perl with large files, rebuilt mod_perl and
 apache, and it got even worse - every file i served crashed apache.

you need to compile Perl _without_ largefiles (Configure -Uuselargefiles)
your stack trace looked exactly like the one triggered by largefile
support, if something new is happening, we'll need to see a new stacktrace
to help.




Re: Apache dumping core in mod_perl's 'make test'

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Rob Fugina wrote:
 
 I'm not sure if it's more or less useful to find out that it's not 2,
 but 1...  

looks like something is trying to redirect stderr to stdout, strace might
give some more clues.




Re: Problems with installing mod_perl

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Steffers wrote:
 
 that shouldnt really matter, since its a signal 11 from a
 process, then its either :

it does matter, there are several discussions you'll find in the archives
on how Perl's largefile support triggers this problem.




Re: Strange Segfault with Apache::PerlRun

2000-06-09 Thread Doug MacEachern

On Fri, 9 Jun 2000, Damon Buckwalter wrote:
 I'm sorry, please excuse my previous laziness...  Here's all the info I can
 gather:

if you compile with PERL_DEGUG=1, the stacktrace will give more info.
looks like the call to Apache::warn, the problem probably goes away with
this bandaid.

--- PerlRun.pm  2000/06/01 21:07:56 1.29
+++ PerlRun.pm  2000/06/09 18:38:00
@@ -226,7 +226,7 @@
 #XXX not good enough yet
 my(%switches) = (
'T' = sub {
-   Apache::warn("Apache::PerlRun: T switch ignored, ".
+   warn("Apache::PerlRun: T switch ignored, ".
"enable with 'PerlTaintCheck On'\n")
   unless $Apache::__T; "";
},




Re: Bugs 5.6.0 modperl use?

2000-06-01 Thread Doug MacEachern

On Thu, 25 May 2000, Jeremy Howard wrote:

  CGI::Carp preloaded.
  DBI preloaded.
  
  [Wed May 24 19:58:28 2000] [error] PerlRun: `Bizarre copy of HASH in aassign
  at /usr5/perl/lib/5.6.0/Carp/Heavy.pm line 79.
  
  ...
  Anyone else seen these?
 
 Oh yes, I've been battling that tonight...
 
 Do the following:
 
 In Carp::Heavy, change 'DB' to 'DB_tmp':
 Line 39: while (do { { package DB_tmp; @a = caller($i++) } } ) {
 Line 79: @a = @{DB_tmp::args}; # must get local copy of args
 
 In CGI::Carp, change Line 257:
 FROM: my $message = shift;
 TO: my ($message) = @_;
 
 Yes, this really does matter--I carefully reproduced a problem that only
 occured when 'shift' was used!

do you have small test case to reproduce this bug?  i wasn't able to, but
poked around a bit and see:

#Carp.pm:
sub longmess {
{ local $@; require Carp::Heavy; }  # XXX fix require to not clear $@?
goto longmess_heavy;
}   

and perl.c:call_sv():
PL_eval_root = PL_op; /* Only needed so that goto works right.*/

which leads me to think goto() + call_sv() (which is how mod_perl
invokes handlers) can lead to trouble, we just need to figure out exactly
what is tripping it up.  it's not clear from the module changes you made
to bandaid the bug, i'd like to be able to reproduce this and step in with
gdb.  i have a feeling it's something to do with AUTOLOAD+eval "" changing
PL_eval_root, but i can only guess at this point.




Re: GET html page - permission denied

2000-06-01 Thread Doug MacEachern

On Thu, 25 May 2000, Prasit P wrote:

 By the way, i can access "http://209.10.98.1/index.html" using internet
 browser, but not the perl socket.

because the browser doesn't include http://x.x.x.x in the http request,
unless you are configured to use an http proxy.

 print $remote "GET http://209.10.98.1/index.html HTTP/1.0\n\n";

change that to "GET /index.html HTTP/1.0\n\n", which is the same as your
browser would send.





Re: global variables and reparsing (short reproducible example)

2000-06-01 Thread Doug MacEachern

On Fri, 26 May 2000, Marc Lehmann wrote:

 On Thu, May 25, 2000 at 12:09:09PM -0700, Doug MacEachern [EMAIL PROTECTED] wrote:
   You can only configure Apache from Perl sections, but you can load all
   your modules, shared data, etc. from a file pulled in with PerlRequire.
  
  actually you can, if a module defines variables in the
  Apache::ReadConfig:: namespace, they are fed to the apache config gears
  just as Perl sections are.
 
 Erhm, I am doing this right now (the functions I call just implant
 Location directives etc.. into the caller's package).
 
 Now it would be interesting to know wether that works only when called from
 perl sections or also form perlrequire? (Hmm, I'll just try it out and assume
 it's supported if it works ;)

yes, it's supported with PerlRequire and PerlModule.




Re: global variables and reparsing question (low priority ;)

2000-06-01 Thread Doug MacEachern

forget about mod_perl for a moment.  yes, true, Perl's built-in require
will not reload a module if it's already in %INC.  but that's doesn't mean
a Perl environment cannot un-cache that entry so it will be reloaded.
consider the code below, pretend that loop is a long-lifetime server,
Tk type application, vi or emacs with Perl embedded:

use Module::Reload ();

do {
Module::Reload-check;
require Foo;
} while (STDIN);

Module::Reload checks the mtime of Foo.pm (and all loaded modules) on
disk, if it has changed since the last time it was require'd, it will be
reloaded.  this is perfectly valid Perl, the language supports this
feature.  i'm quite certain your code be changed to adapt to such an
environment.




Re: does mod_perl with USE_DSO=1 require perl built with -Duseshrplib?

2000-06-01 Thread Doug MacEachern

On Fri, 26 May 2000, Benedict Lofstedt wrote:

 I have a number of apache servers on various hosts, not all of them are to
 be mod_perl enabled.  So, I tried to build apache with mod_perl as a DSO in
 order to enable mod_perl via the httpd.conf file if needed.
 
 I tried building mod_perl-1.24 as a DSO for apache-1.3.14 on my Irix
 platform.  Building went well, I got a libperl.so etc.
 
 However, the resulting httpd failed during make test, with a message about
 not being able to find PL_curpad when loading IO.so - similar to what is
 described in mod_perl_traps.pod.

-Duseshrplib is not required.  maybe you have a libperl.a in a place where
it shouldn't be, like /usr/local/lib/libperl.a?




Re: mod_perl 1.24 testing keeps failing

2000-06-01 Thread Doug MacEachern

On Fri, 26 May 2000, Mark Murphy wrote:
 
 I have one more issue with the "make test" for mod_perl. The documentation 
 indicates that SSL doesn't like /dev/null and that SSLDisable is set. Well, 
 after changing /dev/null and making sure SSLDisable is set in the httpd.conf 
 file, I was still getting an error with mod_ssl

where did you change /dev/null ?
 
 [Thu May 25 19:34:31 2000] [error] mod_ssl: Init: Failed to generate temporary 5
 12 bit RSA private key

no idea on this one, maybe a permission problem?  strace might help:
% make start_httpd
% strace -f -s1024 -o strace.out -p `cat t/logs/httpd.pid`
% make run_tests
% make kill_httpd

there's probably an open() call in strace.out to generate the tmp key.
 
 I had to comment out the LoadModule for libssl in the test httpd.conf file. Once 
 I did that I got results. During the "make test" for mod_perl I received 1 
 failure.

 modules/ssi.FAILED before any test output arrived

no cause for alarm.  the #perl ssi directive is disable when mod_perl is
built as a dso, the test should be skipped too, must be a flaw in the test
suite.




Re: global variables and reparsing question (low priority ;)

2000-06-01 Thread Doug MacEachern

On Fri, 26 May 2000, Marc Lehmann wrote:

 I know this and I have no problems with that (as I made very clear in my
 last mail). But when mod_perl requires special programming techniques this
 does not mean that code not using that techniques is "broken anyway", as
 dougm said, at least not in perl. It might be "broken code", but then the
 language is not perl (where the problematic technique is documented to
 work in perltoot).

when i said 'broken', that is shorthand for, you need to change your code
so it can deal with being reloaded.  which, is valid in the Perl language.
 
 As I explained I was getting defensive simply because _not_ all are
 friends here. I am still defensive because calling somebody else's code
 broken should not be done so lightly.

you shouldn't take offense to what i said, it was not directed at you
alone, i've said it plenty of times before you brought it up.  just as
i've said using 'exit()' is broken, along with any other code that makes
assumptions about it's calling environment.
 
 What happened, if you go back and read the thread, is that I had a question
 and had a very hard time explaining what I actually meant (because my initial
 mails were simply not verbose enough on the problem). Many responses
 (especially the private ones) were very aggressive, so "we are all friends"
 is a myth.

i didn't see any "aggressive" responses on the list, if mine came across
that way, i apoligize, i certainly didn't mean to.  i've spent a great
deal of time trying to help people on this list over the past 4 years and
trying to make mod_perl better at the same time.  my responses tend to be
short and to the point to optimize my time, i'm a really friendly guy in
person :)

 Since this is my first contact with modperl, however, this just means that
 I wasn't able to adjust myself to the tone on (and around) the modperl
 mailinglist.. Next time I will simply ignore most of the responses.

i think the tone in general on this list is *very* positive and friendly,
much more so than the few other lists i subscribe to.  don't let one
misunderstanding discourage you, harsh words are very rare here.




Re: Problem compiling mod_perl 1.24 on Solaris 2.6

2000-06-01 Thread Doug MacEachern

On Fri, 26 May 2000, Fred Miller wrote:
 
 Thank you very much. Sorry for being such a newbie. 

no need to apologize, this sort of problem isn't normal, if anyone should
say sorry, it's sun for their flawed compiler kit.

 I rebuilt Perl with gcc, and then was able to get a build of Apache with
 mod_perl.

great news.




RE: installation of GTop and Scoreboard

2000-06-01 Thread Doug MacEachern

On Tue, 30 May 2000, Alex Algard wrote:

 Thanks, but installing glibtop only solved the GTop.pm issue. We're still
 having the same problem with Scoreboard.pm. Below is the output from the
 Scoreboard.pm installation process.

 Error: 'Apache' not in typemap in DummyScoreboard.xs, line 122

you need to install mod_perl, a version that is built against the Apache
sources, so it installs the apache header files and the mod_perl typemap





Re: Perl 5.6+mod_perl bugs (was Re: Win32 mod_perl binary [update])

2000-06-01 Thread Doug MacEachern

On Tue, 30 May 2000, Jeremy Howard wrote:

 *  Many problems appear running under Apache::DB. In particular,
 Apache::Util::escape_uri causes a segfault under Apache::DB in some
 circumstances, as does Apache::Request::register_cleanup (when called as
 a class rather than an object method)
 *  Slight changes to code can cause a segfault for no apparent reason.
 For instance, under Apache::DB, the following causes a crash (from
 Email::Valid)...
 
 $Resolver = new Net::DNS::Resolver unless $@;
 
 ...while the following works fine...
 
 if (!$@) {
   $Resolver = new Net::DNS::Resolver;
 }

the debugger is often tripped up inside mod_perl (inside perl_call_sv i
should say), i've had problems with 5.005_03 too.  if you can post tiny
examples that trip up the debugger, i can look into them.
the debugger is another case of 'broken' code, it assumes it will only be
run from the command line with the -d switch (which is why the Apache::DB 
wrapper is required).  it's certainly worth doing what we need to so it's
happy inside mod_perl.




Re: CGI.pm's -compile/-autoload methods

2000-06-01 Thread Doug MacEachern

 
 1. regarding -compile, if the tags are imported into the startup.pl's
 package or main:: they aren't inhereted by child processes and therefore
 not adding some memory size to the total child process size, am I right? 
 (well it's shared anyway)

doesn't matter if it's shared, it's shared un-needed bloat!  i would use
CGI::compile() instead of use CGI -compile, as gunther suggested.




Re: Apache::Registry RFE

2000-06-01 Thread Doug MacEachern

On Tue, 30 May 2000, Michael Blakeley wrote:

 Of course there was an error...
 
 At 9:54 PM -0700 5/30/2000, Michael Blakeley wrote:
 
 $r-log_error($errsv) if $Apache::RegistryYA::AutoLog;
 
 s/RegistryYA/Registry
 
 I'm also having second thoughts about the binary nature of this 
 thing... I'd forgotten that $errsv might well be a text message like:
   Can't locate object method foo via package "Apache" at...
 which I'd quite like to see in the log.
 
 So maybe...
 
 $ diff -w Registry.pm.orig Registry.pm
 26a27,28
   $Apache::Registry::AutoLog ||= 32768;
 
 155c157,160
$r-log_error($errsv);
 ---
 {
local $^W = 0;
$r-log_error($errsv) if $Apache::Registry::AutoLog  0+$errsv
 }
 
 This way, setting $Apache::Registry::AutoLog = 300 gives me the 
 behavior I want (no extra log lines for 302, 304, 500) while still 
 letting "true" eval errors through. The default value should come 
 pretty close to the original behavior.

thanks for the patch, but we've stopped adding features to
Apache::Registry.  you can implement this with a subclass of
Apache::RegistryNG, something like so:

package My::Registry;

use Apache::RegistryNG (); 
@ISA = qw(Apache::RegistryNG);

sub log_error {
my($r, $errsv) = @_;
$r-SUPER::log_error($errsv) if $AutoLog  0+$errsv
}

1;
__END__

PerlHandler My::Registry




Re: Perl Section questions

2000-06-01 Thread Doug MacEachern

On Wed, 31 May 2000, Kees Vonk 7249 24549 wrote:

 I have two questions about perl sections:
 
 1) Has setting an entry in the %ENV hash in a perl section 
the same effect as using a SetEnv (or PerlSetEnv) 

no, %ENV is cleared at startup, you need to use the *Env directives for
any you want to stick around.

directive (What btw is the difference between SetEnv and 
PerlSetEnv, both seem to effect %ENV in the same way.)

SetEnv doesn't happen until the fixup phase, PerlSetEnv happens asap, so
those variables are available before then, e.g. in PerlAuthenHandler for
$ENV{ORACLE_HOME} + Apache::AuthenDBI

 2) If the order of directives in a Location section matters 
(see recent discussion on Apache::PerlVINC), does that 
mean I cannot use Perl Sections to configure that because 
the order of hash keys is unreliable.

you can use:

$PerlConfig .= EOF;
EOF

or 

push @PerlConfig, ...;

or

Apache-httpd_conf(...);

to generate config that must have order preserved.





RE: Wierd problem with redirect

2000-06-01 Thread Doug MacEachern

On Wed, 31 May 2000, Jeffrey W. Baker wrote:

 On Tue, 30 May 2000, Jerrad Pierce wrote:
 
  I'm running into an odd redirect ptoblem myself, I'm issuing:
  
  HTTP/1.1 302 Moved Temporarily\n\r
  Date: Tue 30 May 2000 18:18:07 GMT\n\r
  Server: Apache/1.311\n\r
  Set-Cookie: SESSION_ID=4177a0c9ae2b278decd6038901b28a2a; path=/;
  expires=Thu, 1-Jan-70 00:20:00 GMT;\n\r
  Location: /\n\r
 
 If you don't follow the HTTP specification, you can't expect the browser
 to do the right thing.  "/" is not a valid URI for a Location.  According
 to RFC 2616, the Location must be an absolute URI:

but it is valid in apache, for mod_cgi scripts and mod_perl scripts that
have PerlSendHeader On.  apache will do an internal redirect if the url is
not absolute.




RE: elusive, disappearing notes?

2000-06-01 Thread Doug MacEachern

On Wed, 31 May 2000, Geoffrey Young wrote:

 I've seen this before and always thought to attribute it to mod_dir creating
 a new request to properly map / to /index.html
 
 since any notes set are for the lifetime of the request only, the new
 request (representing /index.html) would/should have no notes...

right.  you should be able to always get the same notes table with
something like so:

my $notes = $r-main ? $r-main-notes : $r-notes;





Re: Apache::PerlVINC again

2000-06-01 Thread Doug MacEachern

On Thu, 1 Jun 2000, Kees Vonk 7249 24549 wrote:

 The following works on Apache/1.3.6 (Unix) mod_perl/1.21 
 mod_ssl/2.3.5 OpenSSL/0.9.3a
 
 But when running on Apache/1.3.9 (Unix) mod_perl/1.21 
 mod_ssl/2.4.8 OpenSSL/0.9.4, I get the following problem 
 which _appears_ (I am not 100% sure) to be caused by 
 Apache::PerlVINC. I have the following section in my 
 httpd.conf
... 
 The moment I uncomment the PerlVINC lines (or even just the first one) 
 apache fails to start without any error message (STDOUT or logs (LogLevel 
 debug)) or core file.

you'll need to try this:

Date: Thu, 25 May 2000 12:13:20 -0700 (PDT)
From: Doug MacEachern [EMAIL PROTECTED]
To: Roberto Bourgonjen [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject: Re: httpd exits with apache-1.3.12 and mod_perl-1.21 on Redhat
6.2

On Wed, 24 May 2000, Roberto Bourgonjen wrote:

 Hi all,
 
 I am encountering strange problems on redhat 6.2 installations with
 rpm's apache-1.3.12-2 and mod_perl-1.21-10 (the latest available
 versions from redhat. I _have_ to use rpm's). I've tried two machines.
 
 As soon as load certain modules the server exits immediately, without 
 producing the slightest error message.

try this:

% gdb httpd
(gdb) b exit
(gdb) run -X

whether it core dumps or exit() is called, post the output of:

(gdb) bt






Re: Apache::Registry RFE

2000-06-01 Thread Doug MacEachern

 Thanks - but RegistryNG causes problems elsewhere in my code. 
 Apache::File::mtime() doesn't seem to work with RegistryNG. The code:

whoops!!  Apache::PerlRun/RegistryNG were written before apache introduced
the ap_update_mtime api function.  i've renamed Apache::PerlRun's version
to set_mtime, as it is not supposed to override Apache::update_mtime.

Index: lib/Apache/PerlRun.pm
===
RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v
retrieving revision 1.28
diff -u -r1.28 PerlRun.pm
--- lib/Apache/PerlRun.pm   2000/05/12 07:10:57 1.28
+++ lib/Apache/PerlRun.pm   2000/06/01 21:05:12
@@ -104,7 +104,7 @@
   $Apache::Registry-{$package}{'mtime'} = $mtime);
 }
 
-sub update_mtime {
+sub set_mtime {
 my($pr, $mtime, $package) = @_;
 $mtime   ||= $pr-{'mtime'};
 $package ||= $pr-{'namespace'};
Index: lib/Apache/RegistryNG.pm
===
RCS file: /home/cvs/modperl/lib/Apache/RegistryNG.pm,v
retrieving revision 1.5
diff -u -r1.5 RegistryNG.pm
--- lib/Apache/RegistryNG.pm1999/06/11 02:50:01 1.5
+++ lib/Apache/RegistryNG.pm2000/06/01 21:05:12
@@ -45,7 +45,7 @@
$pr-sub_wrap;
my $rc = $pr-compile;
 return $rc if $rc != OK;
-   $pr-update_mtime;
+   $pr-set_mtime;
 }
 
 $rc = $pr-run(@_);




Re: custom_response/segfaults

2000-06-01 Thread Doug MacEachern

On Thu, 1 Jun 2000, Paul wrote:

 After code verifying that the user hasn't already
 been registered/approved, I changed the code below
 ==
 if ($url !~ /NewReg[.]cgi$/o) {
$r-custom_response(FORBIDDEN,
"/public/NewReg.cgi");
return FORBIDDEN; # trigger custom_response
 }
 ==
 to 
 ==
 return OK 
if $url =~ m{  # (I removed a few patterns here)
 .*NewReg.cgi 
}ixo;
$r-headers_out-add('Location' =
"$serverpath/NewReg.cgi");
return MOVED;
 ==
 and my segfaults seem to have stopped killing my
 server child provcesses.
 Did I use custom_response incorrectly?

you're using it the right way.  which Perl*Handler are you calling it
from?  can you get a stacktrace?  (see SUPPORT doc)




Re: Apache children hanging

2000-06-01 Thread Doug MacEachern

On Thu, 1 Jun 2000, Gustavo Duarte wrote:
 there to see if it stops the problem (the code isn't too clean - lots of
 global variables, not written under strict, etc, but "it works").

looks like a global variable is exactly what your problem is.  somebody is
creating an Apache::SubRequest object (via $r-lookup_{file,uri}, and it's
not going out of scope until the child exits.  in this case, when
Apache::SubRequest::DESTROY is called, it calls destroy_sub_req() on a
pool that's already been cleared.

 #0  0x80a7407 in free_blocks ()
 #1  0x80a7660 in ap_clear_pool ()
 #2  0x80a76a1 in ap_destroy_pool ()
 #3  0x80be71a in ap_destroy_sub_req ()
 #4  0x8070d8a in XS_Apache__SubRequest_DESTROY ()
...
 #12 0x40077fa5 in perl_destruct () at perl.c:1008
 #13 0x80635a3 in perl_shutdown ()
 #14 0x80645c5 in perl_child_exit ()




Re: Apache children hanging

2000-06-01 Thread Doug MacEachern

you can find out which line of Perl code is triggering a spin, by
attaching to the process with gdb;

% gdb httpd $pid_of_spinning_process
% source modperl_x.xx/.gdbinit
% curinfo

should show you the filename:line_number where Perl is stuck.




Re: Apache children hanging

2000-06-01 Thread Doug MacEachern

 % gdb httpd $pid_of_spinning_process
 % source modperl_x.xx/.gdbinit
 % curinfo

oops, that should be:

% gdb httpd $pid_of_spinning_process
(gdb) source modperl_x.xx/.gdbinit
(gdb) curinfo





Re: global variables and reparsing question (low priority ;)

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Marc Lehmann wrote:
 
 You must be kidding here!!! Using lexicals on package level is broken??? If
 it is broken, then _why_ is it recommended programming practise in perl (see
 perltoot for example)?

i'm not kidding.  i don't understand whay you mean by 'using lexicals on
package level is broken'.  i see no problem with that.  maybe you could
post an example, your first one, as you said yourself, was broken.  here's
a tiny example that is not broken:

% cat MyTest.pm
package MyTest;

my $x = 0;

sub inc_x {
$x++;
}

sub print_x {
print "x=$x\n";
}

print "MyTest loaded\n";

1;

% cat test.pl
for (1..2) {

delete $INC{'MyTest.pm'};
require MyTest;

for (1..5) {
MyTest::inc_x();
MyTest::print_x();
}

}

% perl test.pl
MyTest loaded
x=1
x=2
x=3
x=4
x=5
MyTest loaded
x=1
x=2
x=3
x=4
x=5

are you expecting different results?

and, like i said, i realize that certain modules make assumptions that
they will only be loaded once in the same process and that re-parsing them
can uncover subtle problems.  but i still consider such assumptions to be
broken.




Re: Problem compiling mod_perl 1.24 on Solaris 2.6

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Fred Miller wrote:

 Like I said, I'm a bit naive in these matters. I didn't specify using
 gcc or cc. I used the same path to compile Perl, Apache, and Mod_Perl.
 When I aaksed which gcc and which cc, my machine does report gcc
 appearing in my path ahead of cc. Could that be the problem?

i could try re-building Perl like so:

% ./Configure -des -Dcc=gcc  make test  make install

that is, go with all the defaults, but force Perl to use gcc.




Re: CORE::exit and Apache:Registry

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Mark Hewis wrote:

 As far as I have tested under Apache::Registry the following commands have
 the following effect
 
 1) CORE::exit - restart all child processes for that server ( a little too
 drastic for me)

that shouldn't happen.  it should only kill the kid it was called from.

 2) exit - exit code but leave state of all modules the same
 
 What am am really after is an exit which just restarts the child process (it
 is called in) resetting all module globals any suggestions?

exit(-2) will do a graceful exit of the child (unlike CORE::exit), after
logging the transaction is done and connection is closed.

 On a related topic in a given module
 
 BEGIN{} seems to be called only on child initialisation while
 END{} is called at the end of each processed request
 
 This seems a little inconsistant why is this? Can this behaviour be changed?
 
 Because of this
 
 close_everything() in END{} in BerkeleyDB.pm is called after each request
 destroying any ties or environments open which for me is not good.

see mod_perl.pod and chapter 9 of the eagle book for BEGIN/END details.
the solution for you would be to load BerkeleyDB at startup, in which
case, END is not called until the child exits.




Re: global variables and reparsing (short reproducible example)

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Perrin Harkins wrote:

 On Wed, 24 May 2000, Marc Lehmann wrote:
  I was under the impression that you cannot configure Apache from a
  PerlRequire. If that is not the case (and somehow works) I'd really like
  to get away from perlsections.
 
 You can only configure Apache from Perl sections, but you can load all
 your modules, shared data, etc. from a file pulled in with PerlRequire.

actually you can, if a module defines variables in the
Apache::ReadConfig:: namespace, they are fed to the apache config gears
just as Perl sections are.




Re: Apache::Registry script problem

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Drew Taylor wrote:

 Hi all,
 
 I'm having a serious, but intermittent, problem with my Apache::Registry
 scripts. I have 2 (soon to be more!) site running on the same physical
 server. Each site is driven by a set of short perl-script scripts. The
 scripts execute code in OO modules that are shared among all servers.
 The scripts are identical between all sites except for the following:
 
 (index.pl)
 my $SITENAME = 'cloudstock';
 my $SITEID = 1;
 OR
 my $SITENAME = 'wiredstock';
 my $SITEID = 2;
 
 (all others in /cgi-bin)
 my $search = eLogix::Search-new($CGI, 'cloudstock', 1);
 $search-blah
 OR
 my $search = eLogix::Search-new($CGI, 'wiredstock', 2);
 $search-blah
 ETC
 
 The part that changes is the 'cloudstock' and '1'. However, I
 occasionally (and not reliably) get a page from cloudstock.com using the
 wiredstock.com scripts! On some debugging, I can verify that when this
 happens the script has the wrong values. It seems that apache is
 confused and sometimes serves the wrong script for the given domain!

sounds like the 'variable won't stay shared' problem, see
http://perl.apache.org/guide/





Re: difference between ...

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, David Hajoglou wrote:

 Would there ever be any difference between the output of the following:
 
 (looking on the mod_perl quick reference card)
 
 From Apache::URI
   $str = $uri-query()
 
 
 From Request object
   $str = $r-args();
 
 As far as what they hold about the request, would these ever differ, or
 do they access the same data (in different ways)?

they are the same, see http_protocol.c:

r-args = r-parsed_uri.query;




Re: httpd exits with apache-1.3.12 and mod_perl-1.21 on Redhat 6.2

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Roberto Bourgonjen wrote:

 Hi all,
 
 I am encountering strange problems on redhat 6.2 installations with
 rpm's apache-1.3.12-2 and mod_perl-1.21-10 (the latest available
 versions from redhat. I _have_ to use rpm's). I've tried two machines.
 
 As soon as load certain modules the server exits immediately, without 
 producing the slightest error message.

try this:

% gdb httpd
(gdb) b exit
(gdb) run -X

whether it core dumps or exit() is called, post the output of:

(gdb) bt





Re: Need help in compiling the mod-perl

2000-05-25 Thread Doug MacEachern

On Wed, 24 May 2000, Seshagiri Rao Maddirala wrote:

 Hi,
 
 I am tryong to compile modperl with gcc2.8.1 on solaris 7.
 Even before make finishes I get out with error:
 
 mod_perl.c at line 278 'aptestconfigonly' - Unresolved symbol.
 I picked it up today afternoon from ftp site of perl.apache.org.

 similar to that) and log file shows up that apache 1.3.6 with

try apache 1.3.12




Re: PerlTransHandler

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Sergey Ivanyuk wrote:

 Hi All. 
 
 I'm having problems with the PerlTransHandler handler.  I would like
 to only translate some requests, but keep Aliases working.  However, I
 just can't get that done.  If I use a simple 'return DECLINED;', all
 my cgi scripts and aliases directories return 'Not found'.  I know the
 handler is executed, and if I remove it from httpd.conf, everything
 works fine.  What am I doing wrong?  Should a simple 'return
 DECLINED;' run default handlers, or am I missing something?  Thanks in
 advance.

return DECLINED; should work fine.  can you post a tiny example config and
handler?  Apache::ShowRequest (part of the Apache::Module package on CPAN)
can also help debug this sort of problem. 




Re: CGI.pm broken with Apache/mod_perl/warnings? (was Re: XHTML_DTDredefined?)

2000-05-25 Thread Doug MacEachern

On 25 May 2000, Randal L. Schwartz wrote:
 
 Yeah, it's CGI.pm alright.  So do I complain to Lincoln to fix it, or
 is it just a synergy thing between mod_perl, Apache, and CGI.pm that I'll
 have to live with?

are you re-loading CGI.pm?  that's the only way this warning can be
triggered, from what i can see.  in which case, this wouldn't be a bug in
CGI.pm, the re-loader simply needs:
{
no warnings;
}




Re: GET html page - permission denied

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Prasit P wrote:

 Hi guys,
 
 I've built Apache 1.3.12 with mod_perl 1.21.

try upgrading mod_perl, 1.22 has this change:

=item 1.22 - March 22, 2000

proxy support fixed wrt RFC2068, thanks to Benjamin Elijah
Griffin for the spot





Re: Search for Apache::Safe

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Alexander Lazic wrote:

 hi,
 
 i search for the Apache::Safe Module which isnĀ“t in mod_perl-1.24
 included.

it doesn't exist.  i had written a version once, but wasn't happy with it.
there is an experimental PerlOpmask directive that was added to mod_perl
in 1.15_01 (see Changes 9/98), but i haven't looked at since.  this
directive is intended to mask op codes (e.g. system, backticks) and skips
the namespace protection that Safe.pm attempts to provide, that simply
cause too much trouble when trying to implement Apache::Safe.




Re: REPOST: Limiting Resources

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Suresh wrote:

 I am trying to limit the execution of a mod_perl script by setting the 
 limit of RLimitCPU. But
 this does not seem to work. I am using apache 1.3.12 , mod_perl. I 
 tired using the module
 Apache::Resource but even that did not work.
 
 Does any body know why this is or am i missing something.

no clue.  you don't mention what os or what Apache::Resource config you
are using.




Re: REPOST: Limiting Resources

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Vivek Khera wrote:
  limit of RLimitCPU. But
 
 No; you are wrong.

wrt RLimitCPU and friends, he is right.  the built-in apache RLimit
directives only work for mod_cgi processes, which are set in
ap_call_exec().  hmm, i bet the RLimit* directives could be moved to a
child_init handler, in which case, they should work for mod_perl processes
and we wouldn't need Apache::Resource.




Re: mod_perl 1.24 testing keeps failing

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Mark Murphy wrote:
 
   sh Configure -Dcc=gcc -Ubincompat5005

hmm, i've seen a similar report related to largefile support, try once
more with:

sh Configure -Dcc=gcc -Ubincompat5005 -Uuselargefiles





Re: Apache::Registry script problem

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Drew Taylor wrote:

 I have tried many things to solve this problem. Many thanks go to
 Geoffrey Young who helped me privately (and clued me into a great
 solution to another future maintenance problem as well!).

i glad your problem is solved, but can we keep all help on the list to
prevent duplication of efforts?  i get the feeling this is happening
alot.  it's a pity for folks to take time trying to help solve a problem
that's already been solved :)




Re: PerlTransHandler

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Sergey Ivanyuk wrote:

 package handler;
 
 use Apache;
 
 sub handler {
 return DECLINED;
 }

where does DECLINED come from?  watch what happens if you add 'print
handler()' and run it from the command line, and watch what happens when
you add 'use strict;'.  adding 'use Apache::Constants qw(DECLINED)' will
fix your problem.




Re: mod_perl 1.24 testing keeps failing

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Mark Murphy wrote:

 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'

those are the flags added when largefile support is enabled.

try with a fresh source tree and run:

sh Configure -des -Dcc=gcc -Ubincompat5005 -Uuselargefiles

-des will use all defaults except those you override and you don't have to
answer all those darn questions.




Re: httpd exits with apache-1.3.12 and mod_perl-1.21 on Redhat 6.2

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Roberto Bourgonjen wrote:

   rpm's apache-1.3.12-2 and mod_perl-1.21-10 (the latest available

whoops, i missed your version.  if you're trying to use mod_perl as a
dso, upgrade to 1.24.




Re: GET html page - permission denied

2000-05-25 Thread Doug MacEachern

On Thu, 25 May 2000, Prasit P wrote:

 Thank guys for your answer.  I've just tried using Apache 1.3.12, and mod_perl
 1.24, all downloaded today, but it's the same problem.

seems that only works when you use http://hostname, both mod_proxy and
mod_perl use logic like so:

!(r-parsed_uri.hostname
   strEQ(r-parsed_uri.scheme, ap_http_method(r))
   ap_matches_request_vhost(r, r-parsed_uri.hostname,
  r-parsed_uri.port_str ? 
  r-parsed_uri.port : 
  ap_default_port(r)));

logic could probably be added to compare the ip addresses, but why do you
need to do that anyhow?  what's wrong with using 
'GET /index.html http/1.0' ?




<    1   2   3   4   5   6   7   8   9   >