Re: make problem - mod_perl.h not found by Apache::modules
On Sat, 27 Jan 2001, Lynn Winebarger wrote: Hi. I'm having problems getting mod_perl (1.24_01) to compile. I'm using perl 5.6.0, apache 1.3.14, RH Linux 6.2/Intel (with upgrades). This is odd since I've previously built mod_perl successfully as a DSO (and the problem appears to be in the configure - I don't get far enough in the make to be worried about run-time incompatibilies with 1.3.14). Of course, I don't have the options used in the previous mod_perl build. WITH_APXS=/usr/local/apache/bin/apxs USE_APXS=1 DYNAMIC=1 skip the DYNAMIC=1 option, i don't think it works in combonation with USE_APXS=1
Re: Makefile.PL bug (?) - USE_APXS/DYNAMIC incompatible
On Sun, 28 Jan 2001, Lynn Winebarger wrote: Ok, I resolved this. It appears USE_APXS is incompatible with DYNAMIC, whoops, guess you already figured that out. ToDo
Re: Hard times with apache config
On Tue, 30 Jan 2001, Fritz Heinrichmeyer wrote: perl Makefile.PL seem not to honor the APACHE_SRC=.../... switch. I was asked again and again ... well, what value did you give APACHE_SRC= exactly? and where is your mod_perl and apache trees? I used the FreeBSD-Layout, but somewhere somehow there came a duplication of the apache path into existence. The httpd server wanted to read /usr/local/etc/apache/etc/apache/httpd.conf. When configuring with --show-layout it looked like it should. My solution was to edit the apaci script by hand? you should be able to pass any options via APACI_ARGS=, e.g. --prefix
Re: Cannot make mod_perl on *@!* RH Linux :(
On Wed, 31 Jan 2001, Nick Tonkin wrote: Thanks for the suggestion, Doug, but no go. simply looks like you need to install openssl-0.9.6. was not included in the rh7.0 distro that i installed.
Re: Runaways
On Wed, 31 Jan 2001, Robert Landrum wrote: Has anyone else had problems with the Carp module and mod_perl? there were bugs related to Carp in 5.6.0, fixed in 5.6.1-trial1,2
Re: Cannot make mod_perl on *@!* RH Linux :(
On Wed, 31 Jan 2001, Nick Tonkin wrote: [root@wm mod_perl-1.25]# make make test yeah, i think 'make test' as root has permissions problems. if you were to 'make make test' as yourself and 'make install' as root, should work fine.
Re: Cannot make mod_perl on *@!* RH Linux :(
On Tue, 30 Jan 2001, Nick Tonkin wrote: I read in the INSTALL docs that the first error should not occur if openssl is already built and SSL_BASE is set to SYSTEM ... but there it is ... ? if openssl is installed in the default location, don't bother with SSL_BASE. if not, that needs to be a path, e.g. SSL_BASE=/usr/local/ssl mod_perl's notion of SSL_BASE is not n'sync with mod_ssl's, so i don't think `SYSTEM' will work. i just built mod_perl-1.25+apache_1.3.17+mod_ssl-2.8.0-1.3.17+openssl-0.9.6 rh-7.0 (w/ gcc/glibc upgrades) and perl-current: % perl Makefile.PL USE_APACI=1 EVERYTHING=1 DO_HTTPD=1 \ APACI_ARGS='--enable-module=ssl,--enable-module=expires,--enable-module=rewrite' all tests pass. And I read on this list's archives that the second error (about lgdbm) may be caused by using Linux' RPM Perl, so I just built a new Perl from source ... that's not an error, just a warning that some dbm feature of mod_rewrite is disabled.
RE: Prototype mismatch in Apache::PerlRun line 343
On Fri, 26 Jan 2001, Wenzhong Tang wrote: Unfortunately the following line doesn't work: eval "*{\$fullname}($p) = sub {}"; It probably should be: eval "*{\$fullname} = sub ($p) {}"; The latter works on my Linux and Solaris tests. right. thanks, applied.
Re: missing docs
On Thu, 4 Jan 2001, Vivek Khera wrote: In answering another question today, I noticed that the variable $Apache::Registry::NameWithVirtualHost is not documented in the perldoc for Apache::Registry. While scanning the Registry.pm file, I further noticed that there is a call to $r-get_server_name for the virtual host name. This too is not documented in perldoc Apache. The only documented way I see to get this from the $r object is to use $r-server-server_hostname. i think you'll find plenty more that is not documented in the pods. when i started working on the eagle book with lincoln, i focused all documention effort there. i had hoped at some point the mod_perl docs would get a major overhaul, just hasn't happened yet. but patches have been coming in to fill holes, more are always welcome. Should $r-get_server_name() be documented, or is it a "private" method? It seems wasteful to create an Apache::Server object just to fetch the virtual host name. $r-get_server_name is public, and is already used in Registry/PerlRun, but $r-server-is_virtual is still used.
Re: Apache::SIG kills the process
On Tue, 9 Jan 2001, Stas Bekman wrote: I was rewriting the detecting 'STOP' button pressed section in the guide, to notice that Apache::SIG kills the process under Apache::Registry. httpd.conf: PerlFixupHandler Apache::SIG why are you using Apache::SIG at all? its no longer required as of 1.3.6-ish. if the client goes away writes are noops, you can test $r-connection-aborted if you want to know the client has gone away.
Re: PerlTaintMode and PERL5LIB/PERL5OPT env vars.
On Tue, 9 Jan 2001, Stas Bekman wrote: I've lost the original email, but this is reply from Doug to my email. I've asked to confirm that PERL5LIB is ignored with PerlTaintMode is on. Apparently the Perl docs say a different thing... Anybody has any insights about this situation? Does it has anything to do with Perl versions? ... But according to perlrun manpage (dist 5.00503): PERL5LIBA colon-separated list of directories in which mod_perl special cases this one, from mod_perl.c: char *path = (char *)table_get(r-subprocess_env, "PERL5LIB"); if (path) { perl_incpush(path); MP_INCPUSH_on(cld); } PERL5OPTCommand-line options (switches). Switches in there is not special case for this, it was ignored last time i checked. 5.6.0 has some taint related bugs so it could be related to that. where/how do you set PERL5OPT ?
Re: difficulties compiling 1.24_01
On Fri, 26 Jan 2001, Mark A. Downing wrote: and it appears that there is NO perlxsi.c in /apache_1.3.14/src/modules/perl hmm, i don't see how that's possible, mod_perl will not compile without it. i just tried with the same Makefile.PL options and Perl version, no problems. what does this print: % nm /apache_1.3.14/src/httpd | grep boot_ and % nm /apache_1.3.14/src/httpd | grep xs_init
Re: applicationontent-Type?
On Thu, 25 Jan 2001 [EMAIL PROTECTED] wrote: I've been getting these occassional errors from libapreq, 1 every couple days: [Thu Jan 25 15:54:33 2001] [error] [client 64.12.102.22] [libapreq] unknown content-type: `applicationontent-Type: application/x-www-form-urlencoded\' It's always an AOL user agent, but not always the same one. I added Apache::DumpHeaders today and caught one after a couple hours: POST /poll/iIDEre/results HTTP/1.0 Accept: */* Accept-Encoding: gzip, deflate Accept-Language: en-us Content-Length: 20 Content-Type: applicationontent-Type: application/x-www-form-urlencoded yikes. you could work around this like so (untested): sub AOL::fixup { my $r = shift; my $ct = $r-header_in('content-type'); if ($ct =~ s/^\S+:\s*//) { $r-header_in('content-type', $ct); } 0; } PerlFixupHandler AOL::fixup libapreq could probably deal with this internally, maybe by assuming content-type is DEFAULT_ENCTYPE if it is unable to find an exact match.
Re: detecting Apache::Log et al
On Thu, 25 Jan 2001, Matt Sergeant wrote: with current cvs: use Apache::MyConfig (); if ($Apache::MyConfig::Setup{PERL_LOG_API}) { ... } Is that going to be in mod_perl 1.25? yep. anything that's in the Changes file will be in the next release, in this case that is: include mod_perl hook/feature config and pod in Apache::MyConfig [Geoffrey Young [EMAIL PROTECTED]] (and whither 1.25 anyhow?) echo | mail [EMAIL PROTECTED] \ perl -e 'eval { require patience }'
Re: STDIN, STDOUT, Socket::PassAccessRights problem
On Tue, 9 Jan 2001, Paul Buder wrote: I am using a CPAN module called Socket::PassAccessRights that uses the recvmsg and sendmsg system calls to pass file descriptors over a socket. More specifically, I have a long living program (not modperl) that needs to communicate with the Apache descriptors for STDIN and STDOUT given to a CGI or modperl script. The following works as an ordinary CGI but not under modperl. use IO::Socket; use Socket::PassAccessRights; $client=IO::Socket::UNIX-new(Type = SOCK_STREAM, Peer = '/tmp/socket') or die $!; Socket::PassAccessRights::sendfd(fileno($client), fileno(STDIN)) or die; Socket::PassAccessRights::sendfd(fileno($client), fileno(STDOUT)) or die; # The only info my server needs from Apache other than # the descriptors, this is POST'ed data. print $client $ENV{CONTENT_LENGTH}, "\n"; # end of script This doesn't work under modperl. I suspect that is because STDIN and STDOUT are not normal in some sense under modperl but I don't know enough to get any handle on it. right, apache i/o is not stdio. this might help, please let us know if it does or not. you might also need to $r-rflush before your socket thingy writes to the fd. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.119 diff -u -r1.119 Apache.xs --- src/modules/perl/Apache.xs 2000/12/29 17:10:08 1.119 +++ src/modules/perl/Apache.xs 2001/01/26 06:19:30 @@ -603,7 +603,7 @@ Apache r CODE: -RETVAL = fileno(stdout); +RETVAL = r-connection-client-fd; OUTPUT: RETVAL
RE: Prototype mismatch in Apache::PerlRun line 343
On Wed, 17 Jan 2001, Wenzhong Tang wrote: Since nobody seems care about this problem, I have to find a solution myself. Fortunately perl has a "prototype" function that returns the prototype of a function. Here is the difference between the original PerlRun.pm in mod_perl 1.24_01 and the updated one: thanks for you patch, however this is not valid Perl syntax: eval "\$mysub = sub {$proto} {}"; below is a different version, does it still quiet the warnings? Index: lib/Apache/PerlRun.pm === RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v retrieving revision 1.34 diff -u -r1.34 PerlRun.pm --- lib/Apache/PerlRun.pm 2001/01/12 15:45:12 1.34 +++ lib/Apache/PerlRun.pm 2001/01/26 06:58:39 @@ -340,7 +340,12 @@ if (defined $fullname) { no warnings; local $^W = 0; -*{$fullname} = sub {}; +if (my $p = prototype $fullname) { +eval "*{\$fullname}($p) = sub {}"; +} +else { +*{$fullname} = sub {}; +} undef $fullname; } if (*{$fullname}{IO}) {
Re: make test failed - can't locate loadable object...
On Tue, 23 Jan 2001, Rodney Tamblyn wrote: After setting up my system via CPAN, I've just compiled mod_perl-1.24_01 and Apache 1.3.14 on Mklinux DR3. Make concludes happily without any errors. When I run make test I get the following errors: Syntax error on line 62 of /../t/conf/httpd.conf: can't locate loadable object for module Apache::Constants in @INC (@INC contains ) at /usr/downloads/mod_perl-1.24_01/blib/lib/mod_perl.pm line 16 Compileation failed in require at .../lib/Apache.pm line 6 ...(more stuff here) server failed to start! (please examine t/logs/error_log) at t/TEST line 95 Interestingly, no file is created in /logs. So it seems I need to include some other paths in @INC. no, there is no 'loadable object file' for Apache::Constants, its linked static by default (changed only if you pass DYNAMIC=1 to Makefile.PL). what does src/modules/perl/perlxsi.c look like in your apache-x.xx tree? your Makefile.PL options and perl -V would be useful too.
Re: difficulties compiling 1.24_01
On Tue, 23 Jan 2001, Mark A. Downing wrote: I'm having great difficulty getting 1.24_01 to compile... Make test reports: ...make[1]: Leaving directory `/fs1/src/apache_1.3.14/src' kill `cat t/logs/httpd.pid` cat: t/logs/httpd.pid: No such file or directory rm -f t/logs/httpd.pid rm -f t/logs/error_log ../apache_1.3.14/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...\c [Tue Jan 23 13:17:17 2001] [error] Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /fs1/src/mod_perl-1.24_01/blib/lib /fs1/src/mod_perl-1.24_01/blib/arch /fs1/src/mod_perl-1.24_01/t/docs /fs1/src/mod_perl-1.24_01/blib/lib /fs1/src/mod_perl-1.24_01/blib/arch blib/arch blib/lib /usr/local/lib/perl5/5.00503/i686-linux /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/i686-linux /usr/local/lib/perl5/site_perl/5.005 /fs1/src/mod_perl-1.24_01/t/ /fs1/src/mod_perl-1.24_01/t/lib/perl) at /fs1/src/mod_perl-1.24_01/blib/lib/mod_perl.pm line 16 hmm, seems to be a couple of these. there is no 'loadable object file' for Apache::Constants, its linked static by default (changed only if you pass DYNAMIC=1 to Makefile.PL). what does src/modules/perl/perlxsi.c look like in your apache-x.xx tree? your Makefile.PL options and perl -V would be useful too.
Re: checking available modules in test
On Tue, 23 Jan 2001, Robin Berjon wrote: Hi, I just did an install of modperl 1.24_01/apache 1.3.14 and I got a few failed tests. The tests that fail are actions, cgi, and include (in fact, I had to delete the line in the test conf that contained the Action directive in order to get the tests to run). And indeed, they should fail because I compiled without those respective mods. I think those tests should be skipped if those mods are not there. It should be fairly easy to do (I'd say just a matter of looking at what's been compiled in and adding IfModule directives). I'd be happy to submit a patch if that is seen as a sensible thing to do. patch would be great. Apache::test has some new-ish stuff for checking what modules are enabled, etc.
Re: [OT] gdb and httpd (mod_perl, PHP)
make install ... I know that PHP is not compiled in yet... I wanted to try executing "httpd -X" step by step first - just to see if it works. What am I doing wrong? Doesn't PERL_DEBUG=1 add the debugging symbols? yes, but 'make install' probably stripped them. just re-run make, without the 'make install', httpd is always re-build.
Re: Bug (easily fixable) in Apache::Server
On Fri, 12 Jan 2001, Richard L. Goerwitz wrote: The mod_perl-1.24_01 ./src/modules/perl/Server.xs file is using a short int, which leads to ports between 32768 and 65535 (inclusive) turning up in Perl as negative numbers - thanks, this should fix the problem.. Index: src/modules/perl/Server.xs === RCS file: /home/cvs/modperl/src/modules/perl/Server.xs,v retrieving revision 1.7 diff -u -r1.7 Server.xs --- src/modules/perl/Server.xs 2000/09/26 17:34:32 1.7 +++ src/modules/perl/Server.xs 2001/01/25 07:04:56 @@ -96,7 +96,7 @@ OUTPUT: RETVAL -short +unsigned short port(server, ...) Apache::Server server @@ -104,7 +104,7 @@ RETVAL = server-port; if(items 1) -server-port = (short)SvIV(ST(1)); +server-port = (unsigned short)SvIV(ST(1)); OUTPUT: RETVAL Index: t/net/perl/api.pl === RCS file: /home/cvs/modperl/t/net/perl/api.pl,v retrieving revision 1.42 diff -u -r1.42 api.pl --- t/net/perl/api.pl 2000/04/03 21:41:53 1.42 +++ t/net/perl/api.pl 2001/01/25 07:05:19 @@ -16,7 +16,7 @@ my $is_xs = ($r-uri =~ /_xs/); -my $tests = 68; +my $tests = 71; my $is_win32 = WIN32; $tests += 2 unless $is_win32; my $test_get_set = Apache-can('set_handlers') ($tests += 4); @@ -177,6 +177,14 @@ test ++$i, $s-server_admin; test ++$i, $s-server_hostname; test ++$i, $s-port; +my $port = $s-port; +for (32768, 65535) { +$s-port($_); +test ++$i, $s-port == $_; +} +$s-port($port); +test ++$i, $s-port == $port; + test ++$i, $s-timeout; for (my $srv = $r-server; $srv; $srv = $srv-next) {
Re: Redirecting a multipart/form-data POST request
On Tue, 16 Jan 2001, Darren Stuart Embry wrote: On 2001-01-15, Ask Bjoern Hansen [EMAIL PROTECTED] wrote: When I do neither, i.e., leave the POST request as is and use the standard redirect mechanism, the browser hangs and the server actually does not send the redirect until I hit the Stop button (I'm using ngrep to determine this). This also happens if I use the $r-print($header) method and still return REDIRECT. Try adding $r-method('GET'); $r-headers_in-unset('Content-length'); to your code before doing the return REDIRECT. Ask Bjoern, I privately replied to you on this as well. I should have been more clear and said I was doing exactly this, as per [1], when I mentioned I was converting POST requests to GET requests. This is so that I could get redirects to work in response to a urlencoded POST request using the standard redirection technique of setting the Location header and mime type and returning REDIRECT instead of manually constructing and $r-print()ing a header. In any case, [1] does me no good with multipart/form-data which is what I was asking about in the first place. you need 1.24_01 which contains this fix: fix $r-read() so it will not block if all data has already been read and so that Apache will not hang during ap_discard_request_body() on error or redirect after all data has been read
Re: cannot execute my cgi perls
On Wed, 17 Jan 2001, G.W. Haywood wrote: Hi G, On Wed, 17 Jan 2001, Gustavo Vieira Goncalves Coelho Rios wrote: [Wed Jan 17 18:04:41 2001] [error] [client 192.168.1.11] Premature end of script headers: /home/grios/.public_html/cgi-bin/bench3.cgi Who knows? Something isn't finishing what it started. Post the script. 'Premature end of script headers' is an error from mod_cgi, so this script is not even running under mod_perl.
Re: detecting Apache::Log et al
On Thu, 18 Jan 2001, Matt Sergeant wrote: I know we've been over this before, but I think I've forgotten! How do I detect if Apache::Log got compiled in a module's Makefile.PL ? I can't do eval("use Apache::Log;") because Apache/Log.pm gets installed regardless, its just that the Log.so doesn't get compiled. So, how do I do it? with current cvs: use Apache::MyConfig (); if ($Apache::MyConfig::Setup{PERL_LOG_API}) { ... }
Re: mod_perl confusion.
this is supposed to be fixed (again) in 1.23. an alternative is to switch Apache::Registry to Apache::RegistryNG which uses $r-filename rather than $r-uri for the namespace. On Thu, 4 Jan 2001, Tom Karlsson wrote: Hello All, I've recently looked through the mod_perl mail archives in order to find someone who has/had the same problem as me. It seems that a lot of people have had problems with virtualhost IP and location in situations where both virtualhost sections has a similar URI and scriptname. This problem causes random execution of either of the scripts no matter what virtualhost you're accessing. Like exampleA.com/cgi-bin/script exampleB.com/cgi-bin/script (content of script is different for each host) Accessing exampleB.com/cgi-bin/script might provide you with the output of script you'd get accessing exampleA.com/cgi-bin/script. According to documentation this was a bug in mod_perl versions 1.15_01, however I still experience the very same problems with version 1.24. It seems others has experienced it aswell. Anyway, I haven't been able to find any actual solutions to this. Could someone please clarify whether mod_perl works in a virtualhost environment under the conditions describe above (with same URI and scriptname)?. if yes, would this person be kind enough to provide an example configuration?. Thanks. Friendly Regards /TK
Re: dir_config at startup: I know what doesn't work, so what does?
On Mon, 22 Jan 2001, Christopher L. Everett wrote: variable at server startup, using my startup.pl: ... $config{DBI_DSN} = Apache-server-dir_config('DBI_DSN'); ... PerlSetVar DBI_DSN "DBI:mysql:exchange_db" is your PerlSetVar before or after PerlRequire for startup.pl? it must come before for your code to work, which it should, works just fine for me.
Re: header_out/AUTH_REQUIRE
On Mon, 22 Jan 2001, Thomas Plathe wrote: Hello, In my PerlAuthenHandler I need to send back the WWW-Authenticate-line. I use $r-headers_out("WWW-Authenticate" = 'basic realm = "MyName"'). But if i returned from the Handler with "return AUTH_REQUIRED" , Apache doesn't send this line in the header. Do I need something else ? you shouldn't need to set the WWW-Authenticate header yourself, apache has an api for that. see modperl.com chapter 6.
Re: Problem with Apache::LogFile
i think you need to compile with perl Makefile.PL PERL_DIRECTIVE_HANDLERS=1 or EVERYTHING=1 On Tue, 23 Jan 2001, Liddick, Scott wrote: I am currently writing a PerlLogHandler that will (hopefully) write request info to a rolling logfile in a pipe delimeted format for hourly loading via Oracle SQL*Load into a database (I know about Apache::LogDBI, but my DBA group will not let me do this). I wish to use Apache::LogFile to utilize the Apache logging mechanisms to allow all httpd children to write to a common file w/o having to worry about flocking or other methods to allow write access by many processes. The environment is Apache 1.3.12/mod_perl 1.21. Apache::LogFile seems to compile ok, but when I try to initialize the log handle in a startup.pl script, I get this error: Can't load '/opt/merc/perl/5.005_03/lib/site_perl/5.005/i686-linux/auto/Apache/LogFile/ Config/Config.so' for module Apache::LogFile::Config: /opt/merc/perl/5.005_03/lib/site_perl/5.005/i686-Linux/auto/Apache/LogFile/C onfig/Config.so: undefined symbol: perl_cmd_perl_TAKE2 at /opt/merc/perl/5.005_03/lib/5.00503/i686-linux/DynaLoader.pm line 169. I read about the args_how directive parsing stuff, and found this symbol in mod_perl.h and a few other places but really don't know what I am doing. Can anyone point me in the right direction for getting this module properly installed? Is there a special way that I need to build Apache/mod_perl? Help. Thanks, Scott
Re: cvs commit: modperl-2.0/pod modperl_style.pod
On Wed, 17 Jan 2001, Ask Bjoern Hansen wrote: On 2 Jan 2001 [EMAIL PROTECTED] wrote: =item Avoid inherting from certain modules Exporter To void inherting BAutoLoader::AUTOLOAD instead of this: @MyClass::ISA = qw(Exporter); use this: *import = \Exporter::import; Why? To get less obscure error messages for methods that can't be found or are you being really absurd^Wenthusiastic with the memory savings? :) why both, of course!
Re: mod_perl 1.25 please!
On Fri, 19 Jan 2001, Matt Sergeant wrote: Do we have anything holding us up from releasing 1.25 ? same stuff i mentioned last week when vivek asked. but more likely to be ready next week.
Re: How to recognize server shutdown?
On Thu, 11 Jan 2001, Perrin Harkins wrote: but it's a bummer that the parent doesn't run END blocks. Will it run cleanup handlers? Cleanup handlers are run by child processes. What it has to do with parent? Or do I miss something? cleanup handlers are run when a pool is cleared. the request lifetime pool is one pool, the server lifetime pool is another, etc. I meant "is there a way to run a cleanup handler in the parent after it's work is done?", but I don't see one. Dave says the END block trick worked for him, so maybe it only fails under certain circumstances. of course, there is such a "trick" [EMAIL PROTECTED]">http://forum.swarthmore.edu/epigone/modperl/thandflunjimp/[EMAIL PROTECTED]
Re: How to recognize server shutdown?
On Wed, 10 Jan 2001, Stas Bekman wrote: All we need is to add a $Apache::Server::Quitting or alike, in addition to the existing $Apache::Server::Starting and $Apache::Server::ReStarting, should be an easy patch in XS. nooo, as i've mentioned before Starting,ReStarting variables were mistakes, and they will be either deprecated or more likely non-existent in 2.0
Re: PerlChildInitHandler not being called
On Tue, 2 Jan 2001, Paul J. Lucas wrote: I looked in the archives for this problem and, while mentioned, not definitive solution was apparantly found. I did notice the handler get called once, but only once: total server shutowns and restarts don't make it get called. I'm using Apache 1.3.12, mod_perl 1.24_01, Perl 5.6 under Linux. the distribution test suite has a ChildInitHandler that does this: $s-warn("[notice] child_init for process $$, report any problems to $sa\n"); % make start_httpd_fork % grep 'child_init for process' t/logs/error_log | wc -l 5 % echo t/logs/error_log % kill -HUP `cat t/logs/httpd.pid ` % grep 'child_init for process' t/logs/error_log | wc -l 5 % echo t/logs/error_log % kill -USR1 `cat t/logs/httpd.pid ` % grep 'child_init for process' t/logs/error_log | wc -l 5 % make kill_httpd looks like it works fine. also using 5.6.0, linux, apache 1.3.15-dev, mod_perl-1.24_02-dev. if you could try the above and/or provide a small test case that breaks, i'll have a look.
RE: security suggestion
On Fri, 17 Nov 2000, mgraham wrote: Maybe another approach would be to explicitly list the handlers that are allowed to be used in any given context. Kind of like 'Options', but for perl handlers. Something like 'PerlOptions', perhaps? Location /users PerlOptions "My::AuthHandler My::ContentHandler My::TransHandler" /Location something like that is already implemented in mod_perl-2.0: http://perl.apache.org/~dougm/modperl_2.0.html probably will not happen for 1.xx
Re: An idea on END_REQUEST handler
On Wed, 22 Nov 2000, Andrei A. Voropaev wrote: Hi! Everyone knows that END handlers in packages under mod_perl are executed only when apache terminates. But from time to time there might be a need to execute something when the Request is finished. In practice what I do in these cases is install PerlCleanupHandler which checks all loaded packages and if they define 'END_REQUEST' function then execute that function. Maybe it's worth making it standart feature of mod_perl? considering you can do this: package My::Module; $Apache::ReadConfig::Location{'/'}-{PerlCleanupHandler} = join '::', __PACKAGE__, 'cleanup'; sub cleanup { my $r = shift; warn "cleanup in $$\n"; } cleanup() will be called without touching httpd.conf. a small module to cut down the noise should do the trick for you. checking all packages by default would be far too expensive to be a standard feature.
Re: perl's memory leak
On Fri, 8 Dec 2000, Perrin Harkins wrote: Unfortunately, GTop is kind of a pain to compile. It seems to depend on some Gnome stuff. We use Apache::SizeLimit for this reason, and it works well. there's a configure --disable-gnome switch for libgtop. can still be a pain though.
Re: vars vs fqdn vs our benchmark
On Tue, 26 Dec 2000, Ken Williams wrote: [EMAIL PROTECTED] (Stas Bekman) wrote: A combination of Cstrict and Cvars pragmas keeps modules clean and reduces a bit of noise. However, the Cvars pragma also creates aliases, as does CExporter, which eat up more memory. When possible, try to use fully qualified names instead of Cuse vars. I have to disagree with this benchmark. The aliases take up only the tiniest bit of memory, much less than your benchmark seems to indicate. they can add up quick: % perlbloat 'use POSIX ()' use POSIX () added 316k % perlbloat 'use POSIX' use POSIX added 696k that's 380k worth of aliases. now let's say 6 different registry scripts 'use POSIX;' for strftime or whatever, 6 * 380k = 2.3Mb they could save 2.3Mb with 'use POSIX ();' and fully qualifying POSIX:: function calls. so a few 'use vars ()' here and there doesn't eat that much, your call.
Re: getting rid of nested sub lexical problem
On Sat, 30 Dec 2000, Chris Nokleberg wrote: oooh, cool. I've added this to Apache::DB.xs: int stop_debugger() nice, i'll add that for the next version. It appears that setting PL_perldb to zero is all that's required to turn off the debugger! I thought I might have to fiddle with the symbol tables but this seems to work. yeah, that should do it. I've attached the latest version of Apache::NiceRegistry (suggestions welcome) below. Not sure this is the right thing to do , but I call Apache::DB::init_debugger directly because I need the return value (don't want to stop_debugger if it was turned on outside of this handler), and I don't want the warning that Apache::DB-init produces. calling init_debugger is fine. Also, why does Apache::DB unset $Apache::Registry::MarkLine? it was breaking Apache::SmallProf i think. it should local-ize that change at least.
Re: mod_perl large scalar cache
On Wed, 3 Jan 2001, George Sanderson wrote: I have a mod_perl hash scalar that can store up to 4 MB of string data. I was wondering what happens to the memory usage after a "delete $myhash{large}"? depends on your os and perl -V:usemymalloc e.g. linux will "give it back to the os", but i think that depends on the size. most others will "give it back to the process", but perl malloc will only "give it back to Perl". I was thinking (I know this can be dangerous:-), it would be nice if I could tell mod_perl to cache scalars that become larger than some specified value, so that they do not chew up too large chunks of memory. you mean to not cache? that idea has/is-being considered for 2.0, a thread that combs interpreters not in use for things like this. and/or looking into implementing 'use less memory' in Perl itself.
Re: PerlRun bug
On Thu, 4 Jan 2001, Alexander Solovey wrote: Hi all, There is a bug in PerlRun.pm that causes internal server error if PerlRun handler is called for inexistent file. I think that problem was introduced by this change =item 1.24_01 - October 10, 2000 . change Apache::PerlRun's Apache class relationship from is-a to has-a There are a couple of places left where $pr-{r}-_some_method_() should be called instead of $pr-_some_method_(). One of them is already noted -- call to uri() in sub error_check. Here is the patch: applied, thanks.
Re: PerlRun problem: can't find method uri
On Thu, 4 Jan 2001, Jie Gao wrote: Another problem with PerlRun is that it seems to interfere with mod_perl handlers. I have an authentication/authorisation handler, which reads in from a file for someinformation. After a script under PerlRun is run, the handler fails to read anything from that file anymore. i can't see what's happening from this, too much missing. can you provide a small, but complete drop-in test case?
Re: Strange log entry, Apache child messed up afterwards
On Fri, 5 Jan 2001, Gerd Kortemeyer wrote: Hi, Did anybody ever see a message like this in the error log after an "internal server error"? [error] Undefined subroutine Apache::lonhomework::handler called at /dev/null line 65535. No further entries. lonhomework is the mod_perl handler attached to a URL, and is called directly. This happens intermittently and seemingly at random; however, after this happened once, that Apache child is messed up and will do this again and again when hit - so depending on which child happens to answer, you get the correct reply or another 500. i think it's possible that the fix for this is in 1.24_01-dev: switch usage of hard_timeout() to soft_timeout(), so if SIGALRM happens during Apache::{print,read}, the script will continue run, allowing proper cleanup (e.g. DESTROY) do you see anything in the error_log related to timeouts?
Re: mod_perl segfault
On Sun, 10 Dec 2000, Alex Vandiver wrote: Heya -- Please 'scuse in advance the long post -- it had to be to fit in all of the information asked for (better too much than too little, I hope). Anyways, I've run into an intermittent segfault problem with mod_perl (Version 1.24). It causes the Apache (version 1.3.12) process to die: [Sun Dec 10 03:12:10 2000] [notice] child pid 18227 exit signal Segmentation fault (11) your stacktrace looks like one triggered by a 5.6.0 bug(s) that we've seen here a number of times. it would probably be worth your while to try 5.6.1-trial1.
Re: mod_perl-1.24 / apache-1.3.14 problem
On Mon, 8 Jan 2001, Vivek Khera wrote: Are there any showstoppers in 1.24_02-dev that need addressing or should we just roll this out as 1.25? I have no problems with it. well, there are some hpux-dso issues i am going to fix before 1.25. i would also like to catch up on what's left in my modperl mail folder to see if anything else obvious needs fixing. i'm hoping to have 1.25 ready this week.
directive handlers + LoadModule foo_module
this was reported a few times, with php as the suspect, but it happens with any LoadModule config. problem was that the xs module structure was only added to the Apache module list once at startup. it needs to be removed/added each time apache is restarted, patch below does that. Index: lib/Apache/ExtUtils.pm === RCS file: /home/cvs/modperl/lib/Apache/ExtUtils.pm,v retrieving revision 1.21 diff -u -r1.21 ExtUtils.pm --- lib/Apache/ExtUtils.pm 2000/12/23 02:23:09 1.21 +++ lib/Apache/ExtUtils.pm 2000/12/30 05:00:48 @@ -122,6 +122,9 @@ sub xs_cmd_table { my($self, $class, $cmds) = @_; (my $modname = $class) =~ s/::/__/g; +(my $pmname = $class) =~ s,::,/,g; +$pmname .= '.pm'; + my $cmdtab = ""; my $infos = ""; @@ -252,6 +255,25 @@ NULL, /* [1] post read_request handling */ }; +#define this_module "$pmname" + +static void remove_module_cleanup(void *data) +{ +if (find_linked_module("$class")) { +/* need to remove the module so module index is reset */ +remove_module(XS_${modname}); +} +if (data) { +/* make sure BOOT section is re-run on restarts */ +(void)hv_delete(GvHV(incgv), this_module, +strlen(this_module), G_DISCARD); + if (dowarn) { + /* avoid subroutine redefined warnings */ + perl_clear_symtab(gv_stashpv("$class", FALSE)); + } +} +} + MODULE = $classPACKAGE = $class PROTOTYPES: DISABLE @@ -260,14 +282,14 @@ XS_${modname}.name = "$class"; add_module(XS_${modname}); stash_mod_pointer("$class", XS_${modname}); +register_cleanup(perl_get_startup_pool(), (void *)1, + remove_module_cleanup, null_cleanup); void END() CODE: -if (find_linked_module("$class")) { -remove_module(XS_${modname}); -} +remove_module_cleanup(NULL); EOF } Index: src/modules/perl/mod_perl.h === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v retrieving revision 1.106 diff -u -r1.106 mod_perl.h --- src/modules/perl/mod_perl.h 2000/12/20 07:24:43 1.106 +++ src/modules/perl/mod_perl.h 2000/12/30 05:00:52 @@ -1210,6 +1210,7 @@ void perl_perl_cmd_cleanup(void *data); void perl_section_self_boot(cmd_parms *parms, void *dummy, const char *arg); +void perl_clear_symtab(HV *symtab); CHAR_P perl_section (cmd_parms *cmd, void *dummy, CHAR_P arg); CHAR_P perl_end_section (cmd_parms *cmd, void *dummy); CHAR_P perl_pod_section (cmd_parms *cmd, void *dummy, CHAR_P arg); Index: src/modules/perl/perl_config.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v retrieving revision 1.107 diff -u -r1.107 perl_config.c --- src/modules/perl/perl_config.c 2000/09/28 03:53:01 1.107 +++ src/modules/perl/perl_config.c 2000/12/30 05:00:52 @@ -1675,7 +1675,7 @@ } } -static void clear_symtab(HV *symtab) +void perl_clear_symtab(HV *symtab) { SV *val; char *key; @@ -1686,6 +1686,7 @@ SV *sv; HV *hv; AV *av; + CV *cv; dTHR; if((SvTYPE(val) != SVt_PVGV) || GvIMPORTED((GV*)val)) @@ -1696,6 +1697,8 @@ hv_clear(hv); if((av = GvAV((GV*)val))) av_clear(av); + if((cv = GvCV((GV*)val))) + cv_undef(cv); } } @@ -1830,7 +1833,7 @@ if(usv SvTRUE(usv)) ; /* keep it around */ else - clear_symtab(symtab); + perl_clear_symtab(symtab); } return NULL; }
Re: segmentation fault when using custom config module
On Wed, 29 Nov 2000, Dave Rolsky wrote: I created a module that contains custom configs with the following code: i cannot reproduce this with or without the patch just posted. i did have to change this line for it to run: $AH = HTML::Mason::ApacheHandler( interp = $interp ); to: $AH = HTML::Mason::ApacheHandler-new( interp = $interp ); but it only caused a server error, no core dump. give the patch a shot anyhow, if you're still having this problem, we'll need a stack trace (see SUPPORT).
Re: Modifying the reported size in a directory index
On Tue, 22 Aug 2000, Jens-Uwe Mager wrote: I am looking for a way to update the reported size of a file in a plain directory index generated by Apache. I have installed a perl fixup handler that does check if a Macintosh resource fork is available additionally to the plain data fork and it replaces the default content handler with a custom one that combines both the data and resource fork on the fly in the MacBinary archive format. This all runs fine and well. The problem I have now that I need to modify the displayed size in the directory index. For example if the file in question is a Mac resource file with no data area the directory index displays 0k as the plain data file really has a zero length. I would believe that I need to delve into the C innards of the request record and add the size of the resource fork to the st_size field of the stat record to fix this, or does anybody have any better idea how to do this in plain perl? i probably shouldn't be 'working' on xmas, but have some time to kill before the airport and have had this in mind since you first posted (4 months ago!). with the patch below and this package: http://perl.apache.org/~dougm/Sys-Stat-0.01.tar.gz a fixup handler can modify the reported size like so: sub MyFixup::handler { my $r = shift; my $stat = Sys::Stat-stat($r-filename); $stat-size(10_000); #whatever size $r-finfo($stat); #changed size will be reflected in dirindex output 0; } Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.118 diff -u -r1.118 Apache.xs --- src/modules/perl/Apache.xs 2000/12/22 20:56:24 1.118 +++ src/modules/perl/Apache.xs 2000/12/26 02:02:13 @@ -1906,10 +1906,26 @@ # struct stat finfo; /* ST_MODE set to zero if no such file */ SV * -finfo(r) +finfo(r, sv_statbuf=Nullsv) Apache r +SV *sv_statbuf CODE: +if (sv_statbuf) { +if (SvROK(sv_statbuf) SvOBJECT(SvRV(sv_statbuf))) { +STRLEN sz; +char *buf = SvPV((SV*)SvRV(sv_statbuf), sz); +if (sz != sizeof(r-finfo)) { +croak("statbuf size mismatch, got %d, wanted %d", + sz, sizeof(r-finfo)); +} +memcpy(r-finfo, buf, sz); +} +else { +croak("statbuf is not an object"); +} +} + statcache = r-finfo; if (r-finfo.st_mode) { laststatval = 0;
Re: Why double requests?
On Wed, 11 Oct 2000, Bill Moseley wrote: ... Here's the request: --- GET /test/abc/123 http/1.0 HTTP/1.1 200 OK Date: Wed, 11 Oct 2000 17:17:16 GMT Server: Apache/1.3.12 (Unix) mod_perl/1.24 Connection: close Content-Type: text/plain hello Here's the error_log [Wed Oct 11 10:17:16 2000] [error] initial:/test/abc/123 [Wed Oct 11 10:17:16 2000] [error] not initial:/abc/123 [Wed Oct 11 10:17:16 2000] [error] [client 192.168.0.98] client denied by server configuration: /usr/local/apache/htdocs/abc Why the second request with the extra path? because in this case you have path_info data, when %ENV is populated, ap_add_cgi_vars() calls ap_sub_req_lookup_uri() to resolve PATH_TRANSLATED. notice you won't see it with: PerlSetupEnv Off
Re: [repost]garbled redirects
On Tue, 7 Nov 2000, Paul wrote: Hi all. A while back I posted a similar problem. My error logs have frequent entries showing erroneous redirect strings, like this: [Tue Nov 7 08:57:45 2000] [error] [client 90.14.50.41] Invalid error redirection directive: üØ@ Sometimes *most* of the redirect is fine; I found one where nothing was garbled but the protocol -- instead of "https" it had several binary characters, but from the :// on the address was fine. Here's one: [Tue Nov 7 09:05:56 2000] [error] [client 96.80.9.46] Invalid error redirection »xs://buda.bst.bls.com/dres/dres.cgi What would cause that? the problem is with $r-custom_response(). if there are no ErrorDocuments configured, it would allocate the table from r-pool, but the table needs to live longer than r-pool, eek! patch below will fix. seems apache.org sshd is down, so i can't commit yet. --- src/modules/perl/Apache.xs~ Thu Dec 21 22:44:52 2000 +++ src/modules/perl/Apache.xs Thu Dec 21 22:45:30 2000 @@ -247,7 +247,7 @@ if(conf-response_code_strings == NULL) { conf-response_code_strings = (char **) - pcalloc(r-pool, + pcalloc(perl_get_startup_pool(), sizeof(*conf-response_code_strings) * RESPONSE_CODES); }
Re: Microperl
On Wed, 15 Nov 2000, Bill Moseley wrote: This is probably more of a Friday topic: Simon Cozens discusses "Microperl" in the current The Perl Journal. I don't build mod_rewrite into a mod_perl Apache as I like rewriting with mod_perl much better. But it doesn't make much sense to go that route for a light-weight front-end to heavy mod_perl backend servers, of course. I don't have any experience embedding perl in things like Apache other that typing "perl Makefile.PL make", but Simon's article did make me wonder. So I'm curious from you that understand this stuff better: Could a microperl/miniperl be embedded in Apache and end up with a reasonably light-weight perl enabled Apache? I understand you would not have Dynaloader support, but it might be nice for simple rewriting. it would not make much difference. the major source of bloat is Perl's bytecode/data structures, microperl does not make these any smaller. still might be worth looking into as an option, but somebody would need to tweak Makefile.micro to build a libmicroperl.a to link against. at the moment it only builds the microperl program.
Re: Strangeness with Carp under mod_perl
On Tue, 10 Oct 2000, darren chamberlain wrote: Hi All. This is a curiosity question, mostly. I have a simple method of sending debugging messages to the error log: use constant DEBUG = 1; # Set to 0 to turn off debugging throughout sub debug ($) { if (DEBUG) { return carp sprintf "[%s] [%s] %s", scalar caller, scalar localtime, shift; } return 1; } which gets called as: debug("Entering handler"); and in scripts, I get nicely formatted output (I split the lines here): [BGEP::Utils] [Tue Oct 10 13:24:33 2000] Getting date list at /usr/local/bin/foo.pl line 22 But under mod_perl, I'm getting: [BGEP::TestPkg] [Tue Oct 10 13:17:00 2000] Sending message to '[EMAIL PROTECTED]' at /dev/null line 0 i cannot reproduce this. using the mod_perl-1.24_02-dev build, i put your code into a Foo.pm, along with: sub test { print Foo::debug("test"); } and called it like so from t/net/perl/test.pl: use Foo (); my $r = shift; $r-send_http_header('text/plain'); Foo::test(); [Foo] [Thu Dec 21 20:20:29 2000] test at /home/dougm/ap/build/mod_perl-1.24_02-dev/t/net/perl/test.pl line 6 i'm using Perl-5.7.0-dev. you might want to try 5.6.1-trial1. there are some 5.6.0 bugs that clobber the Perl structure than maintains filename:linenumber (PL_curcop), not sure if they're related to your case or not.
Re: Handler is preventing redirects on missing trailing / ?
On Wed, 11 Oct 2000, Clayton Mitchell wrote: I then noticed that URI's of directories lacking a trailing '/' were not being redirected in the browser and so relative links started to break. since your PerlHandler is handling the directory, you need to manage that. mod_autoindex and mod_dir both do it themselves, in different ways, here's mod_dir: if (r-uri[0] == '\0' || r-uri[strlen(r-uri) - 1] != '/') { char *ifile; if (r-args != NULL) ifile = ap_pstrcat(r-pool, ap_escape_uri(r-pool, r-uri), "/", "?", r-args, NULL); else ifile = ap_pstrcat(r-pool, ap_escape_uri(r-pool, r-uri), "/", NULL); ap_table_setn(r-headers_out, "Location", ap_construct_url(r-pool, ifile, r)); return HTTP_MOVED_PERMANENTLY; }
Re: Recognizing server config, like Aliases, from modules
On Thu, 12 Oct 2000, Rodney Broom wrote: Hi all, I've got a set of new modules that do things like session handling, URI rewriting, authentication, etc. I've got a set of tests to prevent some rewrite problems that look like this: if ($uri =~ m|^/cgi-bin/|) { return DECLINED; if ($uri =~ m|^/icons/|) { return DECLINED; etc. This is done to allow access to /cgi-bin and /icons and the like without rewriting the URI. UserDir is the same way. The problem is the fact that now folks can't ajust the conf file without ajusting the module, too. I guess I could slurp up the config file on load and figure it out for myself, but that doesn't seem very healthy or very efficient. What I'd like is a method: $r-get_aliases But I don't guess that exists, huh? Any thoughts? no, because those structures are private do mod_alias. you can actually call the mod_alias translate handler directly to see if there is an Alias configured for the uri: use Apache::Module (); my $rr = $r-lookup_uri($r-uri); my $mod_alias = Apache::Module-top_module-find("mod_alias"); my $rc = $mod_alias-translate_handler-($rr); if ($rc == OK) { #an Alias matched } or, if you configure your Alias' with Perl config, you can save it to match against yourself.
Re: END block aborted during httpd shutdown
On Wed, 18 Oct 2000, Ernest Lergon wrote: Dear list members, dear Doug, it seems to me, that my initial mail of this thread was to long to read and to be answered - especially because the questions are in the last paragraph far down below and need scrolling of the message text ;-)) Ok, I'll try to split it up in bite-sized pieces: 1) Our apache is running 20 childs. A perl module is loaded via startup.pl. On shutdown of apache the END block of this module is called 20 times and not only 1 time as I expected. Why? because perl_destruct() runs the END blocks, and each child calls perl_destruct() at exit. if you only want something to run once in the parent on shutdown or restart, use a registered cleanup: #PerlRequire startup.pl warn "parent pid is $$\n"; Apache-server-register_cleanup(sub { warn "server cleanup in $$\n"});
Re: getting rid of nested sub lexical problem
On Thu, 19 Oct 2000, Chris Nokleberg wrote: Following up on my post on this subject a couple of months ago, here is a proof-of-concept drop-in replacement for Apache::Registry that eliminates the "my() Scoped Variable in Nested Subroutine" problem. nice hack! It requires PERL5OPT = "-d" and PERL5DB = "sub DB::DB {}" environment variables set when starting the mod_perl-enabled httpd. This enables the %DB::sub hash table that holds subroutine start and end line info. I presume that this has some negative (marginal?) impact on performance. If someone knows of a better way to reliably figure out where a subroutine starts and ends, please let me know. there is quite a bit of overhead when -d is enabled. have a look at Apache::DB.xs, there's in init_debugger() function todo what -d does. if another method was added to turn it off, after the registry script was compiled, the overhead would be reduced a great deal.
Re: Replacing Authen Authz handlers
On Thu, 26 Oct 2000, Bill Moseley wrote: I've got Authen and Authz protecting an entire site: location / PerlAuthenHandler My::Authen PerlAuthzHandler My::Authz AuthType Basic AuthName Test require valid-user /location I'd like to have one directory that uses Apache's built-in Basic Authentication, but I'm having a hard time making it happen. I've tried using a "PerlSetVar DisableAuthen 1" and then returning DECLINED in my handlers, but that's causing this error: configuration error: couldn't check user. No user file?: /test Can someone fill me in, please. Also, what's Apache seeing that's triggering the above error message. mod_auth.c is not seeing an AuthUserFile
Re: POST results in HTTP/1.0 (null) ??
On Fri, 3 Nov 2000, Paul J. Lucas wrote: So from within a function, I'm doing my $r = Apache::Request-new( Apache-request() ); warn "request=", $r-as_string(), "\n"; and, when I to a POST request, I get: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Content-Length: 6978 Content-Type: multipart/form-data; boundary=curl3cwvW7Ge8lVBtEGuDRCENOMeIVO Host: www.abacus-new.com:80 Pragma: no-cache User-Agent: Mozilla/4.0 HTTP/1.0 (null) Why is the content merely "HTTP/1.0 (null)"? What happened to the other 6900 bytes or so? that's the expected result if you haven't called $r-send_http_header yet. example: warn $r-as_string; $r-send_http_header('text/plain'); print $r-as_string; the error_log $r-warn output is: GET /perl/test.pl HTTP/1.0 ... HTTP/1.0 (null) now that $r-status_line and $r-headers_out have been set by $r-send_http_header, the $r-print output is: HTTP/1.0 200 OK Connection: close Content-Type: text/plain
Re: lookup_uri and Environment Variables?
On Sun, 5 Nov 2000, Hadmut Danisch wrote: Hi, sorry if this was discussed before or if it is a dull question, but I couldn't find any other help than subscribing to this list: I have a Perl Handler Module (PerlAuthenHandler) and want to lookup environment variables set by other modules, e.g. the variables set by apache-ssl for the DN,... To do so, I have the folling piece of code: $subr = $r-lookup_uri($r-uri); $envs = $subr-subprocess_env; foreach $i ( sort keys %$envs ) { $r-log_error("SE $i ",$envs-{$i}); } This code finds only UNIQUE_ID and variables set by the SetEnv directive. Could anyone give me a hint how to access the other variables? the table has not been initialzed at that stage, you need to force that yourself, from ch9 of the eagle book: Finally, if you call Isubprocess_env() in a void context with no arguments, it will reinitialize the table to contain the standard variables that Apache adds to the environment before invoking CGI scripts and server-side include files: $r-subprocess_env;
RE: Clarification of PERL_STASH_POST_DATA
On Wed, 8 Nov 2000, Paul J. Lucas wrote: On Wed, 8 Nov 2000, Geoffrey Young wrote: ... Apache::RequestNotes may be able to help - it basically does cookie/get/post/upload parsing during request init and then stashes references to the data in pnotes. The result is a consistent interface to the data across all handlers (which is the exact reason this module came about) This is /exactly/ right. The only caveat is that its API is different from Apache::Request. It Would Be Nice(TM) if the module subclassed itself off of Apache::Request so that the Apache::Request API would Do The Right Thing(TM). it requires Doug's libapreq and probably a few code changes, but it may be somewhat helpful... Such functionality should imply be absorbed into Apache::Request. matt has submitted a patch for Apache::Request-instance, you can drop this in and use it until the next release. sub Apache::Request::instance { my $class = shift; my $r = shift; if (my $apreq = $r-pnotes('apreq')) { return $apreq; } my $new_req = $class-new($r); $r-pnotes('apreq', $new_req); return $new_req; } the POST_DATA hack isn't even worth talking about. and shouldn't be documented, where did you find that, the guide?
Re: cybersource generating lots of zombies
On Fri, 10 Nov 2000, Peter J. Schoenster wrote: Hi, Anyone use cybersource? yep, but not using their client. (plug time) i actually had the somewhat recent pleasure of rewriting their client library from scratch. that was mostly done because the original is tied to RSA Tipem, which RSA no longer supports, hence their short/old list of supported platforms. plenty of other improvements were made too. it's for a product i'm working on at covalent called 'Credator', and is due to ship at the end of this month. the core is written in C, and has thin Perl, PHP, Java and Python layers ontop. part of what the product offers is a DBI-spirit interface to credit card clearing houses. i.e., the interface is the same no matter what clearing house you use. httpd.conf is configured like so: Credator cybersource CredatorUserName ICS2Test CredatorPassWord ICS2Test CredatorTest On #On points the test server, e.g. ics2test.ic3.com /Credator api looks like so: my $crd = Apache::Credator-new($r); $crd-field(name = "john doe"); $crd-field(amount = '27.01'); $crd-field(expiration = "1209"); $crd-field(card_number = "400700027"); if ($crd-submit) { printf "success! authorization=%s\n", $crd-authorization; } else { printf "failure! error=%s\n", $crd-error_message; } to switch to another clearing house, just change httpd.conf, the app is untouched: Credator verisign CredatorUserName Test CredatorPassWord Test CredatorTest On #test.signio.com /Credator I'm using it in a mod_perl environement (registry) and whenever I call the cybersource stuff it creates zombies on my system: look at this (498 zombie): 1:36pm up 10 days, 19:09, 2 users, load average: 0.51, 0.53 570 processes: 70 sleeping, 2 running, 498 zombie, 0 stopped PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 14112 nobody16 0 00 0 Z 0 15.3 0.0 0:00 do_enc2 defunct It seems do_enc2 might be invovled (lots of it everywhere). Credator does not fork any programs, hence no zombies, might what to try that when it's released :)
Re: make fails on perlio.c
On Mon, 13 Nov 2000, Bob Foster wrote: Hello Folks, I'm trying to compile mod_perl-1.24_01with apache_1.3.14 on Solaris 2.6. Everything works OK until it hits src/modules/perl/perlio.c and then it fails with the following: perlio.c:90: parse error before `Sfdisc_t' perlio.c:90: warning: no semicolon at end of struct or union perlio.c:92: parse error before `}' perlio.c:92: warning: data definition has no type or storage class your 'perl -V' would help. it looks like you're using a botched sfio enabled Perl.
Re: trouble compiling mod_perl-1.24_01
On Wed, 15 Nov 2000, Jere C. Julian, Jr. wrote: I'm on a FreeBSD 3.4-RELEASE box and I've just built and tested apache 1.3.14 from source. Then I try to build mod_perl with the following commands and get the errors below. ... Symbol.xs:106: `na' undeclared (first use this function) Symbol.xs:106: (Each undeclared identifier is reported only once Symbol.xs:106: for each function it appears in.) this is supposed to be taken care of in Symbol.xs: #include "patchlevel.h" #if ((PATCHLEVEL = 4) (SUBVERSION = 76)) || (PATCHLEVEL = 5) #define na PL_na #endif which probably means you have a bogus patchlevel.h (from an old tcl install) in /usr/local/include either delete that or move it aside. the right thing for Symbol.xs todo is not to use na at all, patch below. Index: Symbol/Symbol.xs === RCS file: /home/cvs/modperl/Symbol/Symbol.xs,v retrieving revision 1.4 diff -u -r1.4 Symbol.xs --- Symbol/Symbol.xs1998/11/24 19:10:56 1.4 +++ Symbol/Symbol.xs2000/12/22 06:01:06 @@ -2,11 +2,6 @@ #include "perl.h" #include "XSUB.h" -#include "patchlevel.h" -#if ((PATCHLEVEL = 4) (SUBVERSION = 76)) || (PATCHLEVEL = 5) -#define na PL_na -#endif - #ifdef PERL_OBJECT #define sv_name(svp) svp #define undef(ref) @@ -102,8 +97,10 @@ mg_get(sv); sym = SvPOKp(sv) ? SvPVX(sv) : Nullch; } - else - sym = SvPV(sv, na); + else { +STRLEN n_a; +sym = SvPV(sv, n_a); +} if(sym) cv = perl_get_cv(sym, TRUE); break;
Re: return DONE;
On Wed, 15 Nov 2000, Todd Finney wrote: Is returning DONE a Bad Thing? no. might not be what you want in certain cases, but difficult to guess what you're doing.
Re: Uri modification at translation phase ...
On Thu, 16 Nov 2000, Antonio Pascual wrote: Hi Everybody. I'm making a module that modifies the uri at the translation phase, but I have a doubt. The way I do it is modifying the uri and returning DECLINED as I read in the book "Writing Apache Modules with Perl And C". But working like this, the environment variable QUERY_STRING is well modified but the uri at the browser is not changed. I have test return REDIRECT but then POST calls don't work. try 1.24_01, it fixes a bug that will unclog the REDIRECT+POST problem.
Re: Apache-server_root_relative not found?
On Mon, 27 Nov 2000, The BOFH wrote: BEGIN { use Apache (); use lib Apache-server_root_relative('libperl'); ## /usr/local/apache/libperl created } ... perl -cw modperl_startup.pl returns: Can't locate object method "server_root_relative" via package "Apache" at conf/modperl_startup.pl line 5. mod_perl was built with EVERYTHING=1. Apache- methods are only available inside the server, not on the command line. perl -c will pass if you remove the BEGIN block, which is not required in either case.
Re: 1.24 to 1.24_01 spinning httpds on startup (solved)
On Tue, 28 Nov 2000, Michael J Schout wrote: About a month or 2 ago, I had posted a problem where I tried to upgrade from: ... And reported that after doing this, my httpds would spin on startup. When I turned on MOD_PERL_TRACE=all, it was showing that it was stuck in an infinite loop processing configuration stuff. I posted the mod_perl trace for it as well. I have finally gotten a chance to revisit this and it turns out that what was causing problems was that I had in my httpd.conf: Perl $PerlRequire = '/some/path/file.pl'; /Perl this has been fixed in the cvs tree.
Re: Upgraded to perl 5.6.0, ImageMagick now gives boot_libapreqerror
On Mon, 11 Dec 2000, Chris Allen wrote: I have just done a complete install of RedHat v7.0 which includes Perl 5.6.0. Image Magick was running fine on my old system, but now when I attempt to install it, it gives the following error message when attempting to do the PerlMagick install: ./perlmain.o: In function: 'xs_init' : ./perlmain.o(.text+0xc1): undefined reference to 'boot_libapreq' collect2: ld returned 1 exit status just delete this file: perl -MConfig -le 'print "$Config{installsitearch}/auto/libapreq/libapreq.a"' since you're building static, MakeMaker tries to link *.a, but that's not an XS .a, it's meant for pure C apps to link against. it shouldn't be installed there, esp. now that libapreq has autoconf support for pure C apps.
Re: segmentation faults
On Wed, 13 Dec 2000, Dr. Fredo Sartori wrote: Apache produces segmentation faults when receiving arbirary requests. I am running apache-1.3.14 with php-4.0.3pl1, mod_ssl-2.7.1 and mod_perl-1.24_02 (from the CVS tree) on solaris 2.7. The perl version installed is 5.6.0. According to the backtrace of gdb the problem seems to be located in mod_perl: #0 0x71170 in perl_header_parser (r=0x449040) at mod_perl.c:1021 this is the uselargefiles bug. Makefile.PL should have told you: 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) #2 is probably the best route, since php+mod_ssl would probably also need the #1 flags.
RE: help with custom Error documents/redirection
On Wed, 13 Dec 2000, Geoffrey Young wrote: BTW, it's always good (at least I've found) to call my $prev_uri = $r-prev ? $r-prev-uri : $r-uri; or with one less method call :) my $prev_uri = ($r-prev || $r)-uri;
Re: slight mod_perl problem
On Thu, 21 Dec 2000, Vivek Khera wrote: "SB" == Stas Bekman [EMAIL PROTECTED] writes: startup.pl does not get repeated on a restart. However it will when started with ./apachectl start. I have never encountered this with Apache 1.3.12 or 13. SB I've just tested it -- it's not. I just tested it also, and the startup script is run exactly once. could be he has PerlFreshRestart On, in which case it would be called twice.
Re: Loading modules in Parent??
On Thu, 28 Sep 2000, Bill Moseley wrote: Hi, I'm seeing the opposite results from pre-loading modules in the parent process than I would expect. It looks like pre-loading modules ends up using more non-shared ("private") memory. ... Here's the pre-loaded module list. When running as non-pre-loaded I'm commenting out Search, SWISH::Fork, and CGI-compile lines below. That's the only difference. that's a BIG difference. % perlbloat 'require CGI' require CGI added 784k % perlbloat 'require CGI; CGI-compile(":all")' require CGI; CGI-compile(":all") added 2.0M try without preloading CGI.pm/CGI-compile in either. p.s. this is the perlbloat script: use GTop (); my $gtop = GTop-new; my $before = $gtop-proc_mem($$)-size; for (@ARGV) { if (eval "require $_") { eval { $_-import; }; } else { eval $_; die $@ if $@; } } my $after = $gtop-proc_mem($$)-size; printf "@ARGV added %s\n", GTop::size_string($after - $before);
Re: Apache::test patch
On Sat, 2 Dec 2000, Ken Williams wrote: Meta-question: should I be sending patches to modperl-cvs, or modperl? here or to [EMAIL PROTECTED] This patch does three things. applied, thanks!
Re: [PATCH] stop win32 crash when bringing down service
applied, nice find!
Re: ApacheCon Sunday Pub Meet
On Thu, 19 Oct 2000, Matt Sergeant wrote: How about Harvey Floorbangers, from 7 till late. (erm, I think late might still be 11pm for england *sigh*)... "With a name like Harvey Floorbangers you'd expect this to be a cheesy theme bar with singing bar staff and signed guitars on the wall. Thankfully, this is actually a traditional English pub frequented by locals and visitors to the Olympia Exhibition Building across the road." Sound OK to everyone? (Stas, I'm sure they serve tomato juice too...:) count me in! p.s. stas' drink of choice is cranberry juice.
Re: Resurrection of startup SIGSEGV with latest CVS snapshot?
On Tue, 3 Oct 2000, Bruce W. Hoylman wrote: Hello, Doug -- Thanks for the reply. I have already applied this patch. The backtrace I provided was producted by an httpd executable with the perl_util.c patch already applied. The perl 5.6 patch from p5p was also in effect. bruce, maybe this patch will cure? From [EMAIL PROTECTED] Fri Oct 13 10:21:16 2000 Date: Sat, 07 Oct 2000 21:32:25 -0700 From: Gurusamy Sarathy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: CGI::Carp, use X, die in X.pm causes 0xc005 (APR#330) On Fri, 21 Apr 2000 18:12:45 PDT, [EMAIL PROTECTED] wrote: Full_Name: UENO Kojun Version: ActivePerl 613 OS: Windows NT 4.0 SP 6 Submission from: (NULL) (210.141.46.3) Following scripts cause the application error "c005 at address 78002f3e (strlen)". % perl x.pl ---x.pl--- #! perl use CGI::Carp; use lib '.'; use X; ---X.pm--- package X; die; 1; FYI, I just checked in the following fix for this problem. I'm afraid it is somewhat in the nature of a hack. A proper fix would entail eliminating save_re_context() and making the regular expression engine reentrancy-safe, but I chickened out. Sarathy [EMAIL PROTECTED] ---8--- Change 7165 by gsar@onru on 2000/10/08 04:15:29 save_re_context() could reset PL_curcop to freed memory, causing core dumps in code such as Cuse CGI::Carp; use something_that_calls_die; Affected files ... ... //depot/perl/pp_ctl.c#227 edit Differences ... //depot/perl/pp_ctl.c#227 (text) Index: perl/pp_ctl.c --- perl/pp_ctl.c.~1~ Sat Oct 7 21:14:39 2000 +++ perl/pp_ctl.c Sat Oct 7 21:14:39 2000 @@ -1417,6 +1417,12 @@ LEAVE; + /* LEAVE could clobber PL_curcop (see save_re_context()) +* XXX it might be better to find a way to avoid messing with +* PL_curcop in save_re_context() instead, but this is a more +* minimal fix --GSAR */ + PL_curcop = cx-blk_oldcop; + if (optype == OP_REQUIRE) { char* msg = SvPVx(ERRSV, n_a); DIE(aTHX_ "%sCompilation failed in require", End of Patch.
Re: Patch for easy testing of Apache::* modules (resend)
On Tue, 10 Oct 2000, Ken Williams wrote: [EMAIL PROTECTED] (Doug MacEachern) wrote: ken, i have a feature request too :) i would like to be able to test if mod_include is linked static with httpd, otherwise Makefile.PL will disable PERL_SSI. a hash of parsed `httpd -l`, something like: my $static_modules = Apache::test-http_static_modules; if ($static_modules-{mod_include}) { ... } Okey dokey Doug, here's a patch. I cleaned up _read_existing_conf() too because it was pretty hard to understand. applied, thanks ken!
Re: Bugs database?
On Tue, 10 Oct 2000, Todd Chapman wrote: Is there a mod_perl bugs database? I am having a problem and I want to make sure it isn't a bug in mod_perl that's fixed in a recent release. known bugs are listed in the ToDo file. P.S. The bug is that $r-connection-user() is not set when I return OK from my PerlAuthenHandler. I have to set it manually. Why would that be? it's not a bug, it's because you're not calling $r-get_basic_auth_pw(), which you should do instead of this: my $authen = new HTTPD::Authen::Basic(); my @info = $authen-parse($r-header_in('Authorization')); otherwise, you need to set $r-connection-user yourself.
Re: Managing to kill httpd (why?)
On Sat, 30 Sep 2000, Yann Ramin wrote: #0 0x80a2605 in ap_table_get () #1 0x808961e in XS_Apache__Table_FETCH () package Magrathea::WebAPI; ... my $driver; you cannot cache data that is tied to $r (e.g., notes table), because the $r-pool is cleared after each request. string values are ok, but not objects such as Apache::Table objects which are tied to the r-pool.
Re: Bug in mod_perl
On Mon, 9 Oct 2000, Dave Rolsky wrote: I'm using mod_perl 1.24/Apache 1.3.12/Perl 5.00503 and find that I receive no output after the \0. Is this a mod_perl or Apache bug? Or is it a client bug (using Netscape 4.75) or is it the expected behavior. looks ok to me: % telnet localhost 8529 Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape character is '^]'. GET /foo http/1.0 HTTP/1.1 200 OK Date: Fri, 13 Oct 2000 17:35:52 GMT Server: Apache/1.3.15-dev (Unix) mod_perl/1.24_02-dev Perl/v5.7.0 Connection: close Content-Type: text/plain abc abcdef def Connection closed by foreign host. strace shows the \0 coming across: 5406 read(4, "HTTP/1.1 200 OK\r\nDate: Fri, 13 Oct 2000 17:38:47 GMT\r\nServer: Apache/1.3.15-dev (Unix) mod_perl/1.24_02-dev Perl/v5.7.0\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nabc\nabc\0def\ndef\n", 4096) = 184
Re: Managing to kill httpd (why?)
On Fri, 13 Oct 2000, Doug MacEachern wrote: On Sat, 30 Sep 2000, Yann Ramin wrote: #0 0x80a2605 in ap_table_get () #1 0x808961e in XS_Apache__Table_FETCH () package Magrathea::WebAPI; ... my $driver; you cannot cache data that is tied to $r (e.g., notes table), because the $r-pool is cleared after each request. string values are ok, but not objects such as Apache::Table objects which are tied to the r-pool. just to be clear on this: it's ok to cache things such as Apache::Table for the lifetime of a request (example, between request phases), but once the request is over (and r-pool is cleared), such a cache needs to be flushed.
Re: Resurrection of startup SIGSEGV with latest CVS snapshot?
On Tue, 3 Oct 2000, Bruce W. Hoylman wrote: Ciao! With the latest modperl from CVS, all tests pass during build/test phase. However it coredumps when used with my http.conf/startup.pl files. An earlier CVS release of modperl (modperl_2911162240) functions as expected. Both modperl revisions have the perl_util.c patch applied and perl 5.6 has been patched based on information from p5p regarding cop.h and threads. These patches solved an earlier SIGSEGV problem (similiar to this one?). this looks exactly like the problem that should be solved by the patch i sent you originally, can you try this? --- 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: Patch for easy testing of Apache::* modules (resend)
On Mon, 2 Oct 2000, Ken Williams wrote: In looking over the changes, I found that I've done a little more work since the last patch I sent. I didn't send it on because I wasn't sure whether the first patch would be accepted or not. Anyway, I beefed up the fetch() method and documented it. It's fully backward compatible, so no changes are necessary to existing code that calls fetch(). I also added/fixed tiny pieces in my previous work here and there. thanks ken, i applied this patch, but it broke modules/cgi 3-4,7, because it calls fetch() in an array context. i applied the bandaid below to get by for now. maybe it would be better for your more robust version of fetch() to be called get(), and the old fetch() becomes a wrapper around that? Index: lib/Apache/test.pm === RCS file: /home/cvs/modperl/lib/Apache/test.pm,v retrieving revision 1.18 diff -u -r1.18 test.pm --- lib/Apache/test.pm 2000/10/02 20:25:13 1.18 +++ lib/Apache/test.pm 2000/10/02 21:05:29 @@ -210,7 +210,8 @@ sub fetch { # Old code calls fetch() as a function, new code as a method -shift() if UNIVERSAL::isa($_[0], __PACKAGE__); +my $want_response; +$want_response = shift() if UNIVERSAL::isa($_[0], __PACKAGE__); my ($ua, $url) = (@_ == 1 ? ($UA, shift()) : @_); my $request = ref $url ? $url : {uri=$url}; @@ -228,7 +229,7 @@ my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'}); my $response = $ua-request($req); -return wantarray ? ($response-content, $response) : $response-content; +return $want_response ? $response : $response-content; } sub simple_fetch {
Re: Update: Re: PerlSendHeader Off socket persistence (was Re:question: usingApache for non-HTML messages)
On Mon, 2 Oct 2000, B. Burke wrote: Why would the lack of a $r-send_http_header call cause socket persistence to go away? I was under the impression that $r-send_http_header only affected what was sent to the client, but appearantly it affects Apache's socket handling as well. because send_http_header calls set_keepalive underneath, set_keepalive sets the flags so apache will keep the connection open. try the patch below and add $r-set_keepalive to your code. 2) how can I make apache stop printing the outbound message size on each response what headers exactly is your client sending? you must be somehow triggering chunked encoding. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.114 diff -u -r1.114 Apache.xs --- src/modules/perl/Apache.xs 2000/09/28 19:28:33 1.114 +++ src/modules/perl/Apache.xs 2000/10/02 21:23:28 @@ -937,6 +937,10 @@ send_http_header(r); mod_perl_sent_header(r, 1); +void +set_keepalive(r) +Apache r + #ifndef PERL_OBJECT int
Re: Patch for easy testing of Apache::* modules (resend)
On Mon, 2 Oct 2000, Ken Williams wrote: ken, i have a feature request too :) i would like to be able to test if mod_include is linked static with httpd, otherwise Makefile.PL will disable PERL_SSI. a hash of parsed `httpd -l`, something like: my $static_modules = Apache::test-http_static_modules; if ($static_modules-{mod_include}) { ... } thanks!
Re: $r-header_only question (feeling a newbie!)
On Mon, 2 Oct 2000, martin langhoff wrote: Now shouldn't it be an 'if' instead of an 'unless'? yes, it should be an `if'. your script works fine for me with that change.
Re: Problem with Apache::SIG
On Thu, 28 Sep 2000, Bill Moseley wrote: Nope. I just downloaded a fresh 1.24, and 1.3.12 and built with ah, it happens for non-Registry handlers. patch below fixes. you can also change your handler to: sub handler { my $r = shift; $r-exit(HTTP_NOT_MODIFIED); } BTW --disable-module=include causes: modules/ssi.FAILED before any test output arrived Any way to detect that SSI is disabled and not run the test? yeah, i'll fix that. Index: src/modules/perl/mod_perl.c === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v retrieving revision 1.129 diff -u -r1.129 mod_perl.c --- src/modules/perl/mod_perl.c 2000/09/27 16:13:28 1.129 +++ src/modules/perl/mod_perl.c 2000/09/29 16:24:42 @@ -1654,14 +1654,17 @@ SPAGAIN; -if(perl_eval_ok(r-server) != OK) { - dTHRCTX; - MP_STORE_ERROR(r-uri, ERRSV); -if (r-notes) { -ap_table_set(r-notes, "error-notes", SvPVX(ERRSV)); +if ((status = perl_eval_ok(r-server)) != OK) { +dTHRCTX; +if (status == SERVER_ERROR) { +MP_STORE_ERROR(r-uri, ERRSV); +if (r-notes) { +ap_table_set(r-notes, "error-notes", SvPVX(ERRSV)); +} } - if(!perl_sv_is_http_code(ERRSV, status)) - status = SERVER_ERROR; +else if (status == DECLINED) { +status = r-status == 200 ? OK : r-status; +} } else if(count != 1) { mod_perl_error(r-server, Index: src/modules/perl/perl_util.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v retrieving revision 1.42 diff -u -r1.42 perl_util.c --- src/modules/perl/perl_util.c2000/09/28 21:00:47 1.42 +++ src/modules/perl/perl_util.c2000/09/29 16:24:48 @@ -677,17 +677,27 @@ int perl_eval_ok(server_rec *s) { +int status; SV *sv; dTHR; dTHRCTX; sv = ERRSV; -if(SvTRUE(sv)) { - MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na))); - mod_perl_error(s, SvPV(sv, na)); - return -1; +if (SvTRUE(sv)) { +/* Apache::exit was called */ +if (SvMAGICAL(sv) (SvCUR(sv) 4) +strnEQ(SvPVX(sv), " at ", 4)) +{ +return DECLINED; +} +if (perl_sv_is_http_code(ERRSV, status)) { +return status; +} +MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na))); +mod_perl_error(s, SvPV(sv, na)); +return SERVER_ERROR; } -return 0; +return OK; } int perl_sv_is_http_code(SV *errsv, int *status)
Re: mod-perl as DSO (solaris)
On Fri, 29 Sep 2000, Ricardo Stella wrote: *) Rebuild Perl with Configure -Uuselargefiles if you do this and re-build Apache without the extra CFLAGS, that problem will go away.
Re: Problems with proxying POST?
On Thu, 28 Sep 2000, Chris Lewis wrote: It works to proxy the HTTP to the system fine, however, POST parameters seem to get mangled and/or truncated. they should get passed through by mod_proxy, provided nobody else has read the POST data first. When I try to reference $r-content the thing appears to hang. that means something else has already read the POST data. btw, in the cvs version, multiple calls to $r-content will not block, but anything after the first call returns undef.
Re: Why isn't PerlSetEnv working for me?
On Fri, 29 Sep 2000, Stas Bekman wrote: Hmm, I didn't take it out of my head, I cannot remember now when it was added. Was it different before and I've missed the patch? according to changes, it's been there 1.00_02. Anyway, that means that I should fix the guide, to remove the note about PERL5LIB and PerlTaintMode, right? right.
Re: (possible bug) PerlAccessHandler called twice?
On Thu, 28 Sep 2000, Adi wrote: As it turns out, the second call to My::ProxyAccessOnly is an internal redirect ... Is there a logical reason why PerlAccessHandler should be called twice, the because internal_redirects are implemented with subrequests and subrequests run all phases (except post_read_request, content handler and logging)
Re: open - does not work
On Fri, 29 Sep 2000, Vsevolod Ilyushchenko wrote: I am not sure why, but the command line Perl script with open (AAA, "|some_program"); accepts input via "print AAA" AND prints the output of the program on stdout. because C-level stdout is not hooked up to the client under mod_perl. Or you could just slurp in a string with $_ = `normal_open`; Yes, I know. I just want to see how far I can go with the "open". Besides, according to the author of the script (it's for the analog web log analyzer), using open is more secure. i've never heard that before, how is it more secure? more efficient maybe, but doubt that its more secure.
Re: Update: Re: PerlSendHeader Off socket persistence (was Re:question: usingApache for non-HTML messages)
On Thu, 28 Sep 2000, B. Burke wrote: Once I changed how I was printing the header from the script, the socket persistence worked with PerlSendHeader Off. So I guess I solved my problem although I don't really know why. because CGI.pm will trigger a call to $r-send_http_header, regardless of PerlSendHeader settings. whereas: "print Content-type: text/html\n\n"; will not, unless PerlSendHeader is On.
Re: PerlAuthenHandler advice needed.
On Wed, 27 Sep 2000, Todd Chapman wrote: Problems with your suggestion: 1. The realm will not be known until I get path_info so Location/Location directives will not work. you can use $r-auth_name($realm) to set it at request time. 2. How can I get Perl to do the password lookup in the dynamically selected AuthUserFile? since mod_auth.c's structure defs are private to mod_auth.c, there's no $r-api for this. what you can do use .htaccess like so: Perl my $r = Apache-request; my $testing = $r-path_info =~ /test/; $AuthType = "Basic"; $AuthName = $testing ? "Testing" : "Whatever"; $Require = "user dougm"; $AuthUserFile = $testing ? "/tmp/htpasswd" : "/whatever/htpasswd"; /Perl also, i just committed this patch that makes $r-auth_type writable, the same way $r-auth_name is. and, defaults auth_type to Basic when unset and $r-get_basic_auth_pw is called. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.110 diff -u -r1.110 Apache.xs --- src/modules/perl/Apache.xs 2000/09/27 19:44:23 1.110 +++ src/modules/perl/Apache.xs 2000/09/27 23:43:33 @@ -824,8 +824,9 @@ char *val const char * -auth_type(r) +mod_perl_auth_type(r, val=NULL) Apacher +char *val const char * document_root(r, ...) @@ -887,6 +888,9 @@ int ret; PPCODE: +if (!auth_type(r)) { +(void)mod_perl_auth_type(r, "Basic"); +} ret = get_basic_auth_pw(r, sent_pw); XPUSHs(sv_2mortal((SV*)newSViv(ret))); if(ret == OK) Index: src/modules/perl/mod_perl.h === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v retrieving revision 1.103 diff -u -r1.103 mod_perl.h --- src/modules/perl/mod_perl.h 2000/09/22 18:51:59 1.103 +++ src/modules/perl/mod_perl.h 2000/09/27 23:43:46 @@ -1185,6 +1185,7 @@ perl_require_module("Apache", s) char *mod_perl_auth_name(request_rec *r, char *val); +char *mod_perl_auth_type(request_rec *r, char *val); module *perl_get_module_ptr(char *name, int len); void *perl_merge_server_config(pool *p, void *basev, void *addv); Index: src/modules/perl/perl_config.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v retrieving revision 1.105 diff -u -r1.105 perl_config.c --- src/modules/perl/perl_config.c 2000/09/27 15:37:33 1.105 +++ src/modules/perl/perl_config.c 2000/09/27 23:44:03 @@ -158,6 +158,24 @@ #endif } +char *mod_perl_auth_type(request_rec *r, char *val) +{ +#ifndef WIN32 +core_dir_config *conf = + (core_dir_config *)get_module_config(r-per_dir_config, core_module); + +if(val) { + conf-auth_type = pstrdup(r-pool, val); + set_module_config(r-per_dir_config, core_module, (void*)conf); + MP_TRACE_g(fprintf(stderr, "mod_perl: setting auth_type to %s\n", +conf-auth_name)); +} + +return conf-auth_type; +#else +return (char *) auth_type(r); +#endif +} + void mod_perl_dir_env(request_rec *r, perl_dir_config *cld) { if(MP_HASENV(cld)) {
Re: PerlAuthenHandler advice needed.
On Wed, 27 Sep 2000, Carlos Ramirez wrote: my $authheader = 'Basic realm="'.$realm.'"'; $r-header_out("WWW-Authenticate" ,$authheader); there's a cleaner way for that: $r-auth_name($realm); $r-note_basic_auth_failure; $r-status(AUTH_REQUIRED); no need for that. $r-send_http_header("text/html"); or this because.. return AUTH_REQUIRED; ..apache will send the headers when you return an error return OK if $r-sub_request; there's no Apache::sub_request method my ($res,$password) = $r-get_basic_auth_pw; this will core dump if AuthName is not set in the configuration file. not with the current cvs though, see previous message. $r-note_basic_auth_failure; this won't work right unless you've set $r-auth_name($val)
Re: recursion in Apache::Constants::AUTOLOAD?
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? i still don't understand how __AUTOLOAD can be undefined inside the server. this patch adds an extra check that will prevent recursion if __AUTOLOAD is somehow undefined and print a stacktrace to give some idea where the problem is. Index: Constants/Constants.pm === RCS file: /home/cvs/modperl/Constants/Constants.pm,v retrieving revision 1.20 diff -u -r1.20 Constants.pm --- Constants/Constants.pm 2000/03/03 20:42:01 1.20 +++ Constants/Constants.pm 2000/09/28 15:12:36 @@ -17,9 +17,16 @@ if ($ENV{MOD_PERL}) { #outside of mod_perl this will recurse looking for __AUTOLOAD, grr *AUTOLOAD = sub { - #why must we stringify first??? - __AUTOLOAD() if "$Apache::Constants::AUTOLOAD"; - goto $Apache::Constants::AUTOLOAD; +if (defined __AUTOLOAD) { #make extra sure we don't recurse +#why must we stringify first??? +__AUTOLOAD() if "$Apache::Constants::AUTOLOAD"; +goto $Apache::Constants::AUTOLOAD; +} +else { +require Carp; +Carp::confess("__AUTOLOAD is undefined, ", + "trying to AUTOLOAD $Apache::Constants::AUTOLOAD"); +} }; }
Re: Logging real HTTP status
On Wed, 13 Sep 2000, brian d foy wrote: let's suppose that i want to change the HTTP status to be something other than i'm going to return from the handler(). is there a way to get the logging phase to log the status that the user-agent got rather than the return value of the handler()? here's my small script which illustrates what i'm trying to do: sub mod_perl_error { # a request object is the first argument # in handler, return mod_perl_error($r); $_[0]-status( SERVER_ERROR ); $_[0]-content_type('text/html'); $_[0]-send_http_header; $_[0]-print("There was an oopsie."); return DONE; # the log ends up with status 200 } argh, because Apache.xs:send_http_header does this: r-status = 200; /* XXX, why??? */ i think this was to deal with Apache::cgi_header_out() (used by CGI.pm). if it modified $r-status, then Apache::send_cgi_header() would call $r-send_http_header and Apache would also call send_http_header() because mod_perl returned that status, indicating error or redirect. with this patch, you don't need to touch $r-status and a 500 will be properly logged. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.111 diff -u -r1.111 Apache.xs --- src/modules/perl/Apache.xs 2000/09/27 23:51:33 1.111 +++ src/modules/perl/Apache.xs 2000/09/28 16:11:02 @@ -929,7 +929,6 @@ r-content_type = pstrdup(r-pool, type); send_http_header(r); mod_perl_sent_header(r, 1); -r-status = 200; /* XXX, why??? */ #ifndef PERL_OBJECT Index: Apache/Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.53 diff -u -r1.53 Apache.pm --- Apache/Apache.pm2000/08/31 05:49:05 1.53 +++ Apache/Apache.pm2000/09/28 16:11:12 @@ -180,7 +180,8 @@ else { $not_sent = 1; } - $r-send_http_header if $not_sent; + $r-send_http_header if + $not_sent and $r-status == 200; $r-print($headers); #send rest of buffer, without stripping newlines!!! last; }
Re: Apache::Registry error_log quirk
On Fri, 22 Sep 2000, Martin Wood wrote: We have a collection of CGIs in a single directory handled by Apache::Registry, however if we enter the name of a resource under that location that doesn't exist, say www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in the error_log, just the access log, yet the correct 404 "File not found" response is displayed to the client. For locations managed by default handlers, attempts to access non-existent files is logged in both the access and error logs. Is is possible to activate this behaviour for the Apache::Registry handled location? i guess that's because Apache::Registry doesn't log an error, whoopsie. this patch fixes that. Index: lib/Apache//PerlRun.pm === RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v retrieving revision 1.29 diff -u -r1.29 PerlRun.pm --- lib/Apache//PerlRun.pm 2000/06/01 21:07:56 1.29 +++ lib/Apache//PerlRun.pm 2000/09/28 16:31:12 @@ -60,6 +60,7 @@ $pr-{'mtime'} = -M _; return wantarray ? (OK, $pr-{'mtime'}) : OK; } +$pr-log_error("$filename not found or unable to stat"); return NOT_FOUND; } Index: lib/Apache//Registry.pm === RCS file: /home/cvs/modperl/lib/Apache/Registry.pm,v retrieving revision 1.32 diff -u -r1.32 Registry.pm --- lib/Apache//Registry.pm 2000/08/02 15:53:15 1.32 +++ lib/Apache//Registry.pm 2000/09/28 16:31:15 @@ -165,6 +165,7 @@ # } return $r-status($old_status); } else { +$r-log_error("$filename not found or unable to stat"); return NOT_FOUND unless $Debug $Debug 2; return Apache::Debug::dump($r, NOT_FOUND); }
Re: Seg Fault with Apache::Include
On Wed, 27 Sep 2000, Magnus Erixzon wrote: I am having some problems with Apache::Include. When I include more than one file with it, the httpd seg faults. The script can be as simple as this: #!/usr/bin/perl use Apache::Include (); print "Content-type: text/html\n\n"; Apache::Include-virtual('/perl-bin/helloworld'); Apache::Include-virtual('/perl-bin/helloworld'); it's been in the ToDo list for a while. in the meantime you can fix by changing to: #!/usr/bin/perl use Apache::Include (); my $r = shift; print "Content-type: text/html\n\n"; Apache::Include-virtual('/perl-bin/helloworld', $r); Apache::Include-virtual('/perl-bin/helloworld', $r);
Re: PerlAuthenHandler advice needed.
On Thu, 28 Sep 2000, Todd Chapman wrote: Thanks for the help Doug. This is what I have now but all I get is a segementation fault in the log. $r-note_basic_auth_failure; if AuthType is not set, this will core dump. i just expanded the change that defaults AuthType to Basic for get_basic_auth_pw to include note_basic_auth_failure, in the cvs tree.
RE: does notes() work with custom_response()?
On Thu, 14 Sep 2000, brian d foy wrote: okay - i got that to work. i was getting confused because notes from the handler() were showing up in the current request's notes for the custom_response() handler *and* (as i've discovered) in the previous notes. should that happen? it shouldn't, i don't see that happening with this test: sub MyThrow::handler { my $r = shift; $r-notes("Throw" = "whoopsie"); $r-custom_response(500, "/catch"); 500; } sub MyCatch::handler { my $r = shift; $r-send_http_header; print "notes:\n"; $r-notes-do(sub { print " @_\n"; 1 }); print "prev-notes:\n"; $r-prev-notes-do(sub { print " @_\n"; 1 }); 0; } Location /throw SetHandler perl-script PerlHandler MyThrow::handler /Location Location /catch SetHandler perl-script PerlHandler MyCatch::handler /Location % telnet localhost 8529 Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape character is '^]'. GET /throw http/1.0 HTTP/1.1 500 Internal Server Error Date: Thu, 28 Sep 2000 18:08:31 GMT Server: Apache/1.3.13-dev (Unix) mod_perl/1.24_01-dev Perl/v5.7.0 Connection: close Content-Type: text/plain notes: PERL_CUR_HOOK PerlHandler setenvif-phase-flag post-read done prev-notes: PERL_CUR_HOOK PerlHandler setenvif-phase-flag post-read done Throw whoopsie Connection closed by foreign host.