RE: Proxy example in eagle book does not work

2000-01-19 Thread Doug MacEachern

On Wed, 19 Jan 2000, Jonas Nordström wrote:

 I had the same problem. What does the "1" mean? That the sub returns with a
 true value?

yes, from ch9:

=item do()

This method provides a way to iterate through an entire table item by
item.  Pass it a reference to a code subroutine to be called once for
each table entry.  The subroutine should accept two arguments
corresponding to the key and value respectively, and should return a
true value.  The routine can return a false value to terminate the
iteration prematurely.

This example dumps the contents of the Iheaders_in field to the
browser:

  $r-headers_in-do(sub {
 my($key, $value) = @_;
 $r-print("$key = $value\n");
 1;
  });

For another example of Ido(), see listing 7.12 from the previous
chapter, where we use it to transfer the incoming headers from
the incoming Apache request to an outgoing LWP IHTTP::Request
object.

---

which means, ch7's example is broken, or that $request-header returned a
true value when the example was written.  I suppose the ch7 example should
explictly return 1 regardless.



Re: a possible bug with Apache::Server::ReStarting

2000-01-19 Thread Stas Bekman

On Tue, 18 Jan 2000, Doug MacEachern wrote:

 On Wed, 19 Jan 2000, Stas Bekman wrote:
  
  Why? Some users need a control of what gets reloaded and what not on
  server start (Yes I know if you put in startup.pl file it loads only once) 
  For example parsing and loading some heavy xml files...
  
  Why do you want to take it away?
 
 I think PerlRestartHandler is a better solution in most cases.  and inside
 Perl sections you can always do it on your own:
 
 Perl
 do_something() unless $My::Init++
 /Perl

Sure

 I'm cringing at global variables in general looking forwared to threaded
 2.0.  do you have a concrete example that requires
 $Apache::Server::{Starting,ReStarting} ?

You can get away with internal tracking like you did above with $My::Init,
but IMHO it's not a clean approach. How about adding a new method that
will return the server status. No global variables needed.

do {} if Apache::server_status() == Apache::Constant::Starting;

So you can add other modes like,
Starting|Restarting|Running|HavingLunch|Stopping|Dyeing.

The examples are:
* Start/Restart - when some heavy startup operation should be performed
(e.g. a heavy XML parsing and preloading like someone posted awhile ago)

* Stopping - I wrote this runaway watchdog and had to make it a standalone
program which has no idea whether the server is running. I wanted the code
to be aware of the server status and spawn from the startup file, and kill
it when the server is stopping... I guess I can provide more cleanup
scenarios too. 


___
Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com



RE: A fix in sight: Apache::ASP: crash when placed in startup.pl

2000-01-19 Thread Gerald Richter


 perl_destruct/perl_free are not called at restart, only during child_exit.
 it looks like that might need to change to finish the dso puzzle.  I
 experienced some problems there, but that was a few years ago, looks
 like it's time to revisit.


But it is called when Apache unloads the modules during startup. Therefore
my Apache on NT starts cleanly without the PERL_STARTUP_DONE_CHECK
workaround :-) and Embperl works the first time on Unix when it's loaded at
startup time and mod_perl is dynamicly linked. Really great!

Doug, I have the patch (with dlclose replaced with ap_os_dso_unload, as I
posted some hours ago) here in the CVS working directory, should I commit
it?

Gerald


-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-



Re: how come httpd doesn't start even though startup.pl is fine? (fwd)

2000-01-19 Thread Matt Sergeant

On Fri, 14 Jan 2000, Ricardo Kleemann wrote:
 Hmmm :-(
 
 On 14 Jan 2000, Frank D. Cringle wrote:
 
  
  Without having checked your list, I'll wager that the "good" modules
  are all pure perl and the "bad" ones use machine-language XS
  extensions.
 
 So typical modules like MD5 and MIME::Body are "bad" modules?

DBI, XML::Parser, mod_perl... :)

-- 
Matt/

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.



Re: A fix in sight: Apache::ASP: crash when placed in startup.pl

2000-01-19 Thread Alan Burlison

Doug MacEachern wrote:

 wow, *nice* catch!!  Daniel, I can't thank you and Alan enough for your
 efforts here.  it's such a thorny problem to debug, the closest I came was
 trying to prevent the dlclose of modperl's libperl.so, but had no idea why
 that bandaid prevented the bleeding.  I hadn't heard of ltrace, what a
 spectacular looking tool.
 I'd really like to get the workaround in 1.22, even if Apache and/or
 DynaLoader is the "right" place, we don't have any control over the
 release schedules of either and modperl-1.22 is already long overdue.

You are welcome - it has always bugged me that I could never get APXS to
work.  Both Perl and Apache are included with Solaris 8
(http://www.sun.com/software/solaris/ea/linux.html), and the only way to
add mod_perl to the preinstalled Apache/Perl is to use APXS.

I've posted a bug against DynaLoader to P5P.  I think the fix is
probably to put an END handler in DynaLoader to unload the XS modules,
but I'm not familiar enough with the perl interpreter cleanup processing
to know if this is the best way.

It might add some weight if you could add your comments to the bug
preport in P5P - after all, the know who you are ;-)

Alan Burlison



RE: A fix in sight: Apache::ASP: crash when placed in startup.pl (2)

2000-01-19 Thread Gerald Richter

 Seems correct to me, although as I said before the patch should really
 go in DynaLoader - after all it is conceivable that perl embedders other
 than Apache could be hit by this problem.

Yes, I agree, but this will not before perl 5.006 and much people are still
using perl 5.004...

Gerald



RE: A fix in sight: Apache::ASP: crash when placed in startup.pl

2000-01-19 Thread Gerald Richter


  
   perl_destruct/perl_free are not called at restart, only
 during child_exit.
   it looks like that might need to change to finish the dso puzzle.  I
   experienced some problems there, but that was a few years ago, looks
   like it's time to revisit.
  
 
  But it is called when Apache unloads the modules during
 startup. Therefore

 not perl_destruct()/perl_free(), they are only called in mod_perl by
 perl_shutdown(), during child_exit().

Aah, now I understand. I didn't get it the right way from your first mail.
Yes, perl_destruct()/perl_free() should also be called before the XS
libraries are unloaded, to give perl a chance to cleanup.

Gerald



Re: A fix in sight: Apache::ASP: crash when placed in startup.pl (2)

2000-01-19 Thread Alan Burlison

Gerald Richter wrote:
 
  Seems correct to me, although as I said before the patch should really
  go in DynaLoader - after all it is conceivable that perl embedders other
  than Apache could be hit by this problem.
 
 Yes, I agree, but this will not before perl 5.006 and much people are still
 using perl 5.004...

This is unfortunately true.  However, the next version of perl is
imminent (ish) so it would be nice if the fix could be in it.

Alan Burlison



Transaction handler weirdness

2000-01-19 Thread Kevin Glass



Hi,

We have recently installed a new machine with Apache/1.3.9 mod_perl/1.21 mod_ssl/2.4.10 OpenSSL/0.9.4 perl 
5.004_04 configured 

A perl transaction handler that works fine on Apache/1.3.6 
mod_perl/1.21 5.00503 is now intermittantly dyingon the new box 

with the following error;

Can't call method "register_cleanup" on an undefined value at 
/usr/lib/perl5/5.00503/CGI.pm at line 263

The transaction handler is trying to parse cookies into a hash 
asfollows

 my %cookies = 
CGI::Cookie-parse($r-header_in('Cookie'));

Line 263of CGI.pm is 

 
Apache-request-register_cleanup(\CGI::_reset_globals);

in the following sub routine

sub new { my($class,$initializer) = 
@_; my $self = {}; bless $self,ref 
$class || $class || $DefaultClass; if ($MOD_PERL) 
{
 
Apache-request-register_cleanup(\CGI::_reset_globals);
 undef 
$NPH; } $self-_reset_globals if 
$PERLEX; 
$self-init($initializer); return 
$self;}


Any ideas as to where theproblem lies? 


Thanks
Kevin






What is a transaction handler?

2000-01-19 Thread Keith Kwiatek



What is a transaction handler?

Keith


  - Original Message - 
  From: 
  Kevin Glass 
  
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, January 19, 2000 5:03 
  AM
  Subject: Transaction handler 
  weirdness
  
  Hi,
  
  We have recently installed a new machine with Apache/1.3.9 mod_perl/1.21 mod_ssl/2.4.10 OpenSSL/0.9.4 perl 
  5.004_04 configured 
  
  A perl transaction handler that works fine on Apache/1.3.6 
  mod_perl/1.21 5.00503 is now intermittantly dyingon the new box 
  
  with the following error;
  
  Can't call method "register_cleanup" on an undefined value 
  at /usr/lib/perl5/5.00503/CGI.pm at line 263
  
  The transaction handler is trying to parse cookies into a 
  hash asfollows
  
   my %cookies = 
  CGI::Cookie-parse($r-header_in('Cookie'));
  
  Line 263of CGI.pm is 
  
   
  Apache-request-register_cleanup(\CGI::_reset_globals);
  
  in the following sub routine
  
  sub new { my($class,$initializer) = 
  @_; my $self = {}; bless $self,ref 
  $class || $class || $DefaultClass; if ($MOD_PERL) 
  {
   
  Apache-request-register_cleanup(\CGI::_reset_globals);
   undef 
  $NPH; } $self-_reset_globals 
  if $PERLEX; 
  $self-init($initializer); return 
  $self;}
  
  
  Any ideas as to where theproblem lies? 
  
  
  Thanks
  Kevin
  
  
  
  


Suggested improvements to RegistryLoader.pm - stuff for virtual hosts

2000-01-19 Thread John Hughes

It would be nice if RegistryLoader.pm let me load a script for
a virtual host in such a way that I didn't have to worry about
how they were represented.

Something like:

  my $r = Apache::RegistryLoader-new;

  $r-handler($uri, $filename, $virthost);


How about this.

-- 
John Hughes [EMAIL PROTECTED], 
CalvaEDI SA.Tel: +33-1-4313-3131
66 rue du Moulin de la Pointe,  Fax: +33-1-4313-3139
75013 PARIS.

--- mod_perl-1.21/lib/Apache/RegistryLoader.pm.orig Tue Mar 16 09:55:06 1999
+++ mod_perl-1.21/lib/Apache/RegistryLoader.pm  Wed Jan 19 14:15:38 2000
@@ -13,7 +13,7 @@
 }
 
 sub handler {
-my($self, $uri, $filename) = @_;
+my($self, $uri, $filename, $virthost) = @_;
 
 unless($filename) {
if(my $func = $self-{trans}) {
@@ -41,6 +41,8 @@
filename = Apache-server_root_relative($filename || $guess),
 } = ref($self) || $self;
 
+$r-{virthost} = $virthost if defined $virthost;
+
 $r-SUPER::handler;
 }
 
@@ -56,7 +58,7 @@
 return \$code;
 }
 
-sub get_server_name {}
+sub get_server_name { shift-{virthost} }
 sub filename { shift-{filename} }
 sub uri { shift-{uri} }
 sub status {200}
@@ -69,7 +71,7 @@
 sub request {}
 sub seqno {0} 
 sub server { shift }
-sub is_virtual {0}
+sub is_virtual { exists shift-{virthost} }
 sub header_out {""}
 sub chdir_file {
 my($r, $file) = @_;



mod_rewrite and Apache::Cookie

2000-01-19 Thread Geoffrey Young

hi all..

I've noticed that using mod_rewrite with Apache::Cookie exhibits odd
behavior...

scenario:
foo.cgi uses Apache::Cookie to set a cookie
mod_rewite writes all requests for index.html to /perl-bin/foo.cgi

problem:
access to /perl-bin/foo.cgi sets the cookie properly
access to /  or index.html runs foo.cgi, and attempts to set the
cookie, but $cookie-bake issues the generic:
Warning: something's wrong at /usr/local/apache/perl-bin/foo.cgi line 34.

While I know I can use a PerlTransHandler here (and probably will now), does
anyone have any ideas about this behavior?

In the meanwhile, if I find out anything more while investigating, I'll post
it...

--Geoff



Re: A fix in sight: Apache::ASP: crash when placed in startup.pl

2000-01-19 Thread Daniel Jacobowitz

On Tue, Jan 18, 2000 at 11:02:27PM -0800, Doug MacEachern wrote:
 On Sat, 15 Jan 2000, Daniel Jacobowitz wrote:
 ... 
  Notice that DBI is never dlclose()'d.  But mod_perl is, when apache
  unloads its modules.  The linker is not clever enough to realize that
  DBI depends on symbols in mod_perl.so.  When mod_perl is reloaded at a
  DIFFERENT address, DBI has no reason to be rebound; its symbols are
  already resolved!
 
 wow, *nice* catch!!  Daniel, I can't thank you and Alan enough for your
 efforts here.  it's such a thorny problem to debug, the closest I came was
 trying to prevent the dlclose of modperl's libperl.so, but had no idea why
 that bandaid prevented the bleeding.  I hadn't heard of ltrace, what a
 spectacular looking tool.
 I'd really like to get the workaround in 1.22, even if Apache and/or
 DynaLoader is the "right" place, we don't have any control over the
 release schedules of either and modperl-1.22 is already long overdue.
 
 perl_destruct/perl_free are not called at restart, only during child_exit.
 it looks like that might need to change to finish the dso puzzle.  I
 experienced some problems there, but that was a few years ago, looks
 like it's time to revisit.

*blink*

Oh, you're right, of course.  They weren't getting called at all.

I think that's a problem, and I have a good idea of how to go about
fixing it - I'll get back to you on that in a few hours.

Dan

/\  /\
|   Daniel Jacobowitz|__|SCS Class of 2002   |
|   Debian GNU/Linux Developer__Carnegie Mellon University   |
| [EMAIL PROTECTED] |  |   [EMAIL PROTECTED]  |
\/  \/



Re: Can't exec programs ?

2000-01-19 Thread Hein Roehrig

Doug MacEachern wrote:
 [...]  in any case, you should avoid any code that's forking a
 process, since it's throwing performance out the window.

Date::Manip is only doing a few forks on initialization, which should
be ok in most cases.

 On Thu, 6 Jan 2000, Pierre-Yves BONNETAIN wrote:
 
  [Wed Jan  5 17:46:49 2000] null: Can't exec "pwd": Permission denied at
  /usr/lib/perl5/5.00503/Cwd.pm line 82.

This is most likely due to a corruption of the PATH environment
variable. In my case, Daniel Jacobowitz fixed this problem on Debian,
I think by upgrading to the latest mod_perl snapshot.

-Hein



RE: OS Independend Patch for XS Extentions unload

2000-01-19 Thread Gerald Richter

 Well, one problem.

 I deleted the old code instead of #if'ing it for a reason - it does NOT
 work.  Apache will try to dlclose() the modules anyway, and dlclose(0)
 causes a segfault, on Linux at least.


I just don't wanted to delete the code, before Doug has reviewed it. Anyway
because of the if it will never be used so the result is the same.

Gerald



Re: Problems w/ CGI under mod_perl

2000-01-19 Thread Ken Y. Clark

On Wed, 19 Jan 2000, Richard L. Goerwitz wrote:

 Before I turn everything inside out, let me ask a quick question:  Has
 anyone encountered problems using CGI and CGI::Cookie with mod_perl?  The
 Problem I am noticing emanates from CGI-new().  Here's the section of
 code:
 
 if ($MOD_PERL) {
 Apache-request-register_cleanup(\CGI::_reset_globals);
 undef $NPH;
 }
 
 The error I'm seeing is (taken from my Apache log files):
 
 Wed Jan 19 11:33:45 2000] [error] Can't call method "register_cleanup" on an
 undefined value at /usr/lib/perl5/5.00503/CGI.pm line 263.
 


perhaps you should call 

Apache-request-new($r)-register_cleanup(\CGI::_reset_globals);
 
??

just a thought.

ky



Re: Problems w/ CGI under mod_perl

2000-01-19 Thread James G Smith

"Richard L. Goerwitz" [EMAIL PROTECTED] wrote:
Before I turn everything inside out, let me ask a quick question:  Has
anyone encountered problems using CGI and CGI::Cookie with mod_perl?  The
Problem I am noticing emanates from CGI-new().  Here's the section of
code:

if ($MOD_PERL) {
Apache-request-register_cleanup(\CGI::_reset_globals);
undef $NPH;
}

The error I'm seeing is (taken from my Apache log files):

Wed Jan 19 11:33:45 2000] [error] Can't call method "register_cleanup" on an
undefined value at /usr/lib/perl5/5.00503/CGI.pm line 263.

Platform:  RedHat Linux 6.1 + from-scratch build of Apache 1.3.9, mod_perl
1.21

I have seen this with a build from .tar.gz on OpenBSD 2.5 also with 
Apache/1.3.6 (Unix) mod_perl/1.21.  Slightly older Apache, but I don't think 
that's the problem.

I have never seen a good pattern to this, but there are times when the Apache-
request object is undefined in a mod_perl handler.  Sometimes, calling Apache-
request($r) immediately upon entering a handler will fix it, sometimes even 
that won't work ($r is sometimes underfined when entering a handler).
-- 
James Smith [EMAIL PROTECTED], 409-862-3725
Texas AM CIS Operating Systems Group, Unix




Re: [Mason] Re: Well, I'm dumb...

2000-01-19 Thread Jonathan Swartz

Alex -- you've definitely cut it down a lot, but have you tried cutting out 
the Mason stuff and just making it a regular mod_perl handler that prints a 
few lines?  I'm fairly sure the problem is independent of Mason (although it 
may be related to the structure of handler.pl). Try it and see if you can 
still reproduce the problem. Every minimization step helps towards
pinpointing the bug.
Jon

At 12:00 PM 1/19/00 +0300, [EMAIL PROTECTED] wrote:

I've cut down handler.pl to bare minimum.

=== cut handler.pl ==
#!/usr/bin/perl
# $Id: handler.pl,v 1.3 2000/01/14 19:42:16 tarkhil Exp $
#
$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/
  or die "GATEWAY_INTERFACE not Perl!";
use Apache::Registry;
use Apache::Status;
use Socket;
use Carp qw(cluck confess);

package HTML::Mason;
use HTML::Mason;
use strict;
{
  package HTML::Mason::Commands;
  use Apache::Registry;
  use Apache::Status;
}

my $parser = new HTML::Mason::Parser
  (
#   allow_globals = [qw($dbh)]
  );
my $interp = new HTML::Mason::Interp 
  (parser=$parser,
   data_dir = "/usr/local/www/tmp",
   comp_root = "/usr/local/www");

#$interp-set_global(dbh=DBI-connect
#  ("DBI:mysql:mail2pager",
#   "tarkhil", "",
#   { RaiseError = 1, PrintError = 1, 
# AutoCommit = 1, }
#));
my $ah = new HTML::Mason::ApacheHandler (interp=$interp,
output_mode='batch');
chown ( 60001, 60001, $interp-files_written );
use Apache::Cookie;
use Apache::Session::File;
sub handler {
  my ($r) = @_;
  return -1 
if defined($r-content_type)  $r-content_type !~ m|^text/|io;
  my $cook = Apache::Cookie-new($r);
  my $cookie = $cook-get('SESSION_ID');
  my %session;
  tie %session, 'Apache::Session::File', $cookie; 
  $cook-set(-name = "SESSION_ID", -value = $session{_session_id}) 
  if ( !$cookie );
  
  my $res = $ah-handle_request($r);
  untie %session;
  return $res;
}

1;
...





Apache::Session::DBI problems

2000-01-19 Thread Mark Jewiss

Hello,

I'm trying to run a simple script using Apache::Session for the first
time, and am having a few problems. Can't see anything relating to this in
the documentation or the archives, so here goes...

Whenever I run a script, everything works until I try to create a new
session id, where I get the following error:

No space left on device at
/usr/local/libdata/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm
line 46.

This happens whether I use DBIStore or FileStore. I thought that this was
just down to my scripts, so I've gone back to the example script included
in the distribution. I get the same error when trying to run this.

I'm sure this is a simple issue, but I just can't see the solution - any
help would be greatly appreciated!

Setup is as follows:

OpenBSD 2.5
Apache 1.3.6
Latest version of mod_perl and Apache::Session

Regards,

Mark.
-- 
Mark Jewiss
Knowledge Matters Limited
http://www.knowledge.com



RE: Why does Apache do this braindamaged dlclose/dlopen stuff?

2000-01-19 Thread Stephen Anderson

 -Original Message-
 From: Gerald Richter [mailto:[EMAIL PROTECTED]]
 Sent: 19 January 2000 04:36
 To: Alan Burlison; [EMAIL PROTECTED]
 Subject: RE: Why does Apache do this braindamaged 
 dlclose/dlopen stuff?


 So I would agree to your last sentences that Dynloader is responsible for
unloading, because that's 
 the only module, which knows what it had loaded. 

Agreed. It's a relatively small change to DynaLoader, with great benefits
for embedded Perl.

Also I am not so sure if  unloading all the libraries can be really
successfully done, because the Perl 
 XS libraries don't assume that they will ever unloaded (because they are
actualy only unloaded when the program exits).   This may be the reason
for memory leaks Daniel metioned earlier, because the XS libraries don't
have a chance to
 free there resources (or not aware of that they actually should do so).

Yes and no. If XS libraries are written with OO-style wrappers (which, IMHO,
they always should be), then surely you can catch the unloading in a DESTROY
sub and use that to do the deallocation of resources? Perl can only manage
Perl resources, and extension resources should be the responsibility of the
the programmer.

Stephen.



RE: mod_perl bug (mod_perl 1.21; Apache 1.3.9).

2000-01-19 Thread John Hughes

 what happens if you preload Apache::Registry in httpd.conf:

 PerlModule Apache::Registry

Didn't try that.  But code examination seems to imply that it would have
no effect.

1. Apache::Registry gets run, so:

unless (defined $Apache::Registry::NameWithVirtualHost) {
$Apache::Registry::NameWithVirtualHost = 1;
}

   Now NameWithVirtualHost is 1.

2. a non-virtualhost request is received so perl_handler in mod_perl.c does:

if((nwvh = ApachePerlRun_name_with_virtualhost())) {
if(!r-server-is_virtual) {
SAVESPTR(nwvh);
sv_setiv(nwvh, 0);
}
}

   now NameWithVirtualHost is 0.

   and it stays zero forever.

On reflection my fix is over the top - it has the effect of overriding
the value of NameWithVirtualHost set by the user.

I don't think perl_handler should be changing NameWithVirtualHost *AT ALL*,
that should be left up to the user, with a default in Registry.pm.

I attach patches to do that.  They work for me.

One last query, what about ApachePerlRun_namespace in PerlRunXS.xs, that
seems to think that the mere existence of the variable NameWithVirtualHost
implies that names should be modified with the virtualhost.  It doesn't
check the *VALUE* of the variable:

#ifndef ApachePerlRun_name_with_virtualhost
#define ApachePerlRun_name_with_virtualhost() \
perl_get_sv("Apache::Registry::NameWithVirtualHost", FALSE)
#endif

SV *ApachePerlRun_namespace(request_rec *r, char *root)
{
...
if(r-server-is_virtual  ApachePerlRun_name_with_virtualhost()) {
uri = pstrcat(r-pool, r-server-server_hostname, uri, NULL);
uri_len += strlen(r-server-server_hostname);
}

--
John Hughes [EMAIL PROTECTED],
CalvaEDI SA.Tel: +33-1-4313-3131
66 rue du Moulin de la Pointe,  Fax: +33-1-4313-3139
75013 PARIS.


--- mod_perl-1.21/src/modules/perl/mod_perl.c.orig  Thu Jul  1 20:17:38 1999
+++ mod_perl-1.21/src/modules/perl/mod_perl.c   Wed Jan 19 11:35:12 2000
@@ -751,7 +751,6 @@
 dPPDIR;
 dPPREQ;
 dTHR;
-SV *nwvh = Nullsv;
 
 (void)acquire_mutex(mod_perl_mutex);
 
@@ -772,13 +771,6 @@
 (int)sv_count, (int)sv_objcount));
 ENTER;
 SAVETMPS;
-
-if((nwvh = ApachePerlRun_name_with_virtualhost())) {
-   if(!r-server-is_virtual) {
-   SAVESPTR(nwvh);
-   sv_setiv(nwvh, 0);
-   }
-}
 
 if (siggv) {
save_hptr(GvHV(siggv)); 
--- mod_perl-1.21/lib/Apache/Registry.pm.orig   Wed Jan 13 03:56:34 1999
+++ mod_perl-1.21/lib/Apache/Registry.pmWed Jan 19 11:38:05 2000
@@ -62,7 +62,7 @@
substr($uri, 0, length($uri)-length($r-path_info)) :
$uri;
 
-   if($Apache::Registry::NameWithVirtualHost) {
+   if($Apache::Registry::NameWithVirtualHost  $r-server-is_virtual) {
my $name = $r-get_server_name;
$script_name = join "", $name, $script_name if $name;
}



RE: How to make EmbPerl stuff new content into a existing frame?

2000-01-19 Thread Scott Chapman

On 19 Jan 00, at 7:41, Gerald Richter wrote:

 
  Here's the situation:
  The user loads this page with the two frames.  The left frame is the
  navigation frame.  The user clicks on the left frame the link to log in.
  The right frame changes to the login screen and they login.  When
  they are done, I want the server to populate the frame "index" with
  the required data.  I don't know how to do this.
 
  It seems a redirection in EmbPerl would do it but I don't know
  how to make a
  redirection with a TARGET.  Any clues?
 
 A redirect with a TARGET other then the frame that send the redirect isn't
 possible as far as I know. 

This link is in frame indxcont and updates frame index.  It works:
A 
HREF="/login/indxnav1.epl?session_id=[+$session_ID+]digest=[+$
digest+]"  TARGET="index"

 You could either use some JavaScript to update
 the other index, or that's what I prefer, reload the whole frame (when the
 user hit's the login button -  form action=" ..." target="..."), with
 different frame pages. Then the frame parentpage has also to be an Embperl
 page an passes the parameters along the the actual content pages.

When the user hits the login button, I am calling a CGI script that 
validates the login against a database.  I can't make it have a action 
that loads a HTML page before the script is executed.  Therefore the 
script has to reload the frame with frame pages.  I also need to pass 
values to the frame, as in the example link above.

Can you make a redirection have a "target=frame" and 
"?parameter=value" to do this?

--
Scott Chapman
Technical Support Specialist
Lund Performance Solutions
[EMAIL PROTECTED] or [EMAIL PROTECTED]
Phone: 541-926-3800 www.lund.com



How do you turn logging off completely in Embperl?

2000-01-19 Thread Jason Bodnar

How do you turn logging off completely in Embperl? Is it even possible? I set
EMBPERL_DEBUG to 0 but it still tries to open a log file. I didn't see anything
in EMBPERL_OPTIONS.

---
Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems

In Jail Rock house Rock, he was everything Rockabilly's about.
No, I mean he is Rockabilly. Mean, Surly, Nasty, Brute.
I mean in that movie he couldn't give a  about nothin'.
Just rockin' and rollin', livin' fast, dying young, leavin' a good lookin'
corpse.

--Clarence Worley, True Romance



Re: Why does Apache do this braindamaged dlclose/dlopen stuff?

2000-01-19 Thread Jens-Uwe Mager

On Tue, Jan 18, 2000 at 08:03:42PM +, Alan Burlison wrote:

 I think the correct fix is for the Apache core to avoid dlclosing
 anything it has dlopened in the first place.  If new modules have been
 added to the config files, they should be dlopened, but any old ones
 should *not* be dlclosed, EVEN IF THEY ARE NO LONGER IN THE CONFIG
 FILE!!!

I believe they did that on purpose, akin to the line let's see if we
survive a complete restart as via apachectl restart.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:  +49 5131 709320
FAX:+49 5131 709325
Internet:   [EMAIL PROTECTED]



RE: How do you turn logging off completely in Embperl?

2000-01-19 Thread Christian Gilmore

Jason,

Using both 'EMBPERL_LOG /dev/null' and 'EMBPERL_DEBUG 0' will do the trick.
Without redirecting EMBPERL_LOG, embperl will always try to open
/tmp/embperl.log on its first use. I consider this a bug and a security hazard
(writing anything blindly to /tmp can have potentially lethal side effects,
eg: user foo puts in a symlink from /tmp/embperl.log to anything owned by the
user running the server and that file gets embperl logs appended to it!).

The log file is tied to at a few different spots within the code. None of
these check the setting of EMBPERL_DEBUG before tying to the log. They should
only tie to the log if the debug setting is not zero.

Regards,
Christian

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
 Behalf Of Jason Bodnar
 Sent: Wednesday, January 19, 2000 4:12 PM
 To: mod_perl list
 Subject: How do you turn logging off completely in Embperl?


 How do you turn logging off completely in Embperl? Is it even
 possible? I set
 EMBPERL_DEBUG to 0 but it still tries to open a log file. I
 didn't see anything
 in EMBPERL_OPTIONS.

 ---
 Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems

 In Jail Rock house Rock, he was everything Rockabilly's about.
 No, I mean he is Rockabilly. Mean, Surly, Nasty, Brute.
 I mean in that movie he couldn't give a  about nothin'.
 Just rockin' and rollin', livin' fast, dying young, leavin' a
 good lookin'
 corpse.

 --Clarence Worley, True Romance





RE: How do you turn logging off completely in Embperl?

2000-01-19 Thread Jason Bodnar

That's what I thought. Setting 'EMBPERL_DEBUG 0' should really turn off any
kind of logging including even trying to open the log file.

On 19-Jan-00 Christian Gilmore wrote:
 Jason,
 
 Using both 'EMBPERL_LOG /dev/null' and 'EMBPERL_DEBUG 0' will do the trick.
 Without redirecting EMBPERL_LOG, embperl will always try to open
 /tmp/embperl.log on its first use. I consider this a bug and a security
 hazard
 (writing anything blindly to /tmp can have potentially lethal side effects,
 eg: user foo puts in a symlink from /tmp/embperl.log to anything owned by the
 user running the server and that file gets embperl logs appended to it!).
 
 The log file is tied to at a few different spots within the code. None of
 these check the setting of EMBPERL_DEBUG before tying to the log. They should
 only tie to the log if the debug setting is not zero.
 
 Regards,
 Christian
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
 Behalf Of Jason Bodnar
 Sent: Wednesday, January 19, 2000 4:12 PM
 To: mod_perl list
 Subject: How do you turn logging off completely in Embperl?


 How do you turn logging off completely in Embperl? Is it even
 possible? I set
 EMBPERL_DEBUG to 0 but it still tries to open a log file. I
 didn't see anything
 in EMBPERL_OPTIONS.

 ---
 Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems

 In Jail Rock house Rock, he was everything Rockabilly's about.
 No, I mean he is Rockabilly. Mean, Surly, Nasty, Brute.
 I mean in that movie he couldn't give a  about nothin'.
 Just rockin' and rollin', livin' fast, dying young, leavin' a
 good lookin'
 corpse.

 --Clarence Worley, True Romance



---
Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems

That boy wouldn't know the difference between the Internet and a hair net. --
Jason Bodnar



horrible memory consumption

2000-01-19 Thread Jason Terry

Is there a way I can tell where my memory usage is going in an Apache child?

I have a server that starts with acceptable numbers, but after a while it
turns into this

Server Version: Apache/1.3.9 (Unix) mod_perl/1.21 PHP/3.0.12 mod_ssl/2.4.4
OpenSSL/0.9.4
Redhat Linux: 2.2.13

PID   USER PRI  NI   SIZE   RSS SHARE LC STAT %CPU %MEM   TIME  COMMAND
9666 nobody-1-1   38900  37M  67681S0.07.5
6:57/usr/local/apache/bin/httpd
9665 nobody-1-1   35728  34M  62401S0.06.9
5:57/usr/local/apache/bin/httpd
9663 nobody-1-1   35312  34M  64121S0.06.8
6:11/usr/local/apache/bin/httpd

Now I examined these children using /server-status and they had all recieved
more than 7000 accesses for each child.

Is there a way I can find out where all this RAM is being used.  Or does
anyone have any suggestions (besides limiting the MaxRequestsPerChild)



Re: horrible memory consumption

2000-01-19 Thread Cliff Rayman

check out the following sections in the guide:

http://perl.apache.org/guide/performance.html#Memory_leakage
http://perl.apache.org/guide/debug.html#How_can_I_find_if_my_mod_perl_sc
http://perl.apache.org/guide/performance.html#Limiting_the_resources_used_by_h
http://perl.apache.org/guide/performance.html#Tuning_the_Apache_s_configuratio

this ought to get you off to a good start.

cliff rayman
genwax.com



Jason Terry wrote:

 Is there a way I can tell where my memory usage is going in an Apache child?

 I have a server that starts with acceptable numbers, but after a while it
 turns into this

 Server Version: Apache/1.3.9 (Unix) mod_perl/1.21 PHP/3.0.12 mod_ssl/2.4.4
 OpenSSL/0.9.4
 Redhat Linux: 2.2.13

 PID   USER PRI  NI   SIZE   RSS SHARE LC STAT %CPU %MEM   TIME  COMMAND
 9666 nobody-1-1   38900  37M  67681S0.07.5
 6:57/usr/local/apache/bin/httpd
 9665 nobody-1-1   35728  34M  62401S0.06.9
 5:57/usr/local/apache/bin/httpd
 9663 nobody-1-1   35312  34M  64121S0.06.8
 6:11/usr/local/apache/bin/httpd

 Now I examined these children using /server-status and they had all recieved
 more than 7000 accesses for each child.

 Is there a way I can find out where all this RAM is being used.  Or does
 anyone have any suggestions (besides limiting the MaxRequestsPerChild)



Re: redhat apache and modperl oh my! just so anyone else knows

2000-01-19 Thread Clayton Cottingham

Michael wrote:

  so i guess this is the only way to do it with dso
 
  for apache 1.3.9
   ./configure --enable-rule=shared_core --with-perl=/usr/bin/perl
  --enable-module=so --enable-module=rewrite
 
  for modperl-1.21
   perl Makefile.PL USE_APXS=1 USE_DSO=1 WITH_APXS=/usr/sbin/apxs
  EVERYTHING=1
 
 This does not appear to work all the time. My build looks like this:
 openssl-0.9.4
 apache-1.3.9
 modperl=1.21

 ./configure --prefix=/usr/local/apache \
 --enable-rule=SHARED_CORE \
 --with-layout=Apache \
 --enable-module=so
 make
 make install

 then.

 perl Makefile.PL \
  USE_APXS=1 \
  USE_DSO=1 \
  WITH_APXS=/usr/local/apache/bin/apxs \
  EVERYTHING=1

 make

 gives ..

 In file included from /usr/local/apache/include/httpd.h:78,
  from mod_perl.h:114,
  from mod_perl.c:60:
 /usr/local/apache/include/buff.h:74: openssl/ssl.h: No such file or
 directory /usr/local/apache/include/buff.h:77: #error "Don't use
 OpenSSL/SSLeay versions less than 0.9.2b, they have a serious security
 problem!" make[1]: *** [mod_perl.lo] Error 1 make[1]: Leaving
 directory `/usr/src/mod_perl-1.21/apaci' make: *** [apxs_libperl]
 Error 2

 Any ideas -- I've tried every conceivable build possibility with and
 without DSO and still can't get ssl + modperl to coexist. I know it
 is possible as I have earlier versions running in production, but
 don't seem to be able to upgrade to this set of pieces.
 [EMAIL PROTECTED]

well it seems you dont have that openssl/ included .add it to you
toplevel Makefile:

includedir  = /usr/local/apache/include:$plusyouopenssldir

replacing $plusyouropenssldir with the opensslsource/include dir

that usually works for me


i've put up tarballs at ftp.stampede.org/incoming/

there is
ftp://ftp.stampede.org/incoming/apachecompd.tgz
ftp://ftp.stampede.org/incoming/modperlcompd.tgz
ftp://ftp.stampede.org/incoming/readme_4_apache_and_modperl

tell me if that works , cuz i need to do openssl soon anyways

ttfn





Using mod_backhand for load balancing and failover.

2000-01-19 Thread Jeffrey W. Baker

Hi.

Is anyone using mod_backhand (http://www.backhand.org/) for load
balancing?  I've been trying to get it to work but it is really flaky. 
For example, it doesn't seem to distribute requests for static content. 
Bah.

Anyway, mail me and we can chat.

Jeffrey



Re: mod_perl flashback

2000-01-19 Thread Ken Williams

[EMAIL PROTECTED] (Bill) wrote:
Hi,

I'm scratching my head on a mod_perl problem, and I found out you guided other
programmers in my situation...

here's the context:

[ 1999-09-30 4:20:30 ]
 Is there a way too, to have output of NON PERL cgi scripts to be SSI parsed?

Not that I know of, without going through some serious hoops.

[ 1999-06-28 14:16:28 ]
One thing on my to-do list is to let Apache::SSI take a run-time directive
that
would let you do exactly as you say - use LWP to fetch the contents of the
page, then filter its output.  This would be considerably slower, but it would
get the job done.



now, i have the exact same problem: i need my SSI to filter thru everithing:
HTML, CGIs, PHP, etc.

my idea (still unclear) was to:
1- steal STDOUT, by redirecting it, from fixup stage
2- let the request be handled normally
3- filter the buffered output and send it

if filtering can be done in on-the-fly, this wouldn't degrade performance too
much and avoid the initial delay.


this being said, here's what i'm wondering:

have the problem been solved already?

if not, does the STDOUT filter sound possible?


thanks for your time and interest,

Billy Nadeau


I'm forwarding your message to the list also, since it seems like something of
general interest.  Hope that's okay.

I don't know of any solution that will take care of all files at once.  I think
you'll have to either invent one, or deal with the seperate types of content
individually.  I think both could be done.

If you have enough scripts  pages that you don't want to spend time putting a
small modification into all of them, then I don't know of any way to do what
you want to do except to actually re-request the document using LWP, and then
parse its output with Apache::SSI.  

I don't think there's any way to catch the output of an actual CGI script
(mod_cgi) by redirecting STDOUT.  You'd have to modify the script to parse its
own output, which could be a very small modification if you abstracted the code
into a module.

Come to think of it, it might be handy if a programmer could type

  use Apache::SSI qw(parse_my_output);

at the top of a CGI script and the output would magically be parsed for SSI. 
Hmmm...

I'm not promising anything right now though - the main obstacle is that
Apache::SSI is meant to run under mod_perl, and getting full functionality
under mod_cgi is no trivial task.


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum




Re: mod_perl flashback

2000-01-19 Thread Perrin Harkins

 now, i have the exact same problem: i need my SSI to filter thru everithing:
 HTML, CGIs, PHP, etc.

You get HTML filtering already.  For CGIs, why not write a minimal
PerlHandler to emulate CGI (i.e. set up the environment and execute the
CGI script) and then run the output through SSI?  For parsing the output
of actual apache modules like PHP, I have no idea, but PHP does have a
CGI mode.

- Perrin



Re: [ID 20000118.004] DynaLoader doesn't dlclose XS code on interpreter

2000-01-19 Thread Doug MacEachern

 Unfortunately I can't actually get mod_perl + a load of other stuff to
 build on 5.005_63, so I can't see if it cures the mod_perl problem.

you need modperl from cvs to use 5.005_62+
http://perl.apache.org/from-cvs/
 
 Could a DynaLoader guru have a quick look at the patch and let me know
 if it is complete garbage?
 
 I have backported the patch to 5.005_03, and it appears that mod_perl
 doesn't actually destroy the perl interpreter correctly when Apache does
 a restart.

this wasn't a mistake at the time.  there was no Apache dso and
perl_destruct() was buggy, so mod_perl chose to only boot the interpreter
once at startup and restarts became a noop for mod_perl, with the
exception of "PerlFreshRestart", which just reloads %INC and flushes the
Apache::Registry cache.

I plan to revisit that along with the patches sometime within the next few
days.



question?

2000-01-19 Thread Jingtao Yun

Hi,
   I installed Apache Server for NT on my machine. But
I don't know how to get perl to work not using module perl.
Any message will be appreciated.
   




Re: oracle : The lowdown

2000-01-19 Thread Greg Stark


Matt Sergeant [EMAIL PROTECTED] writes:

 Depends what the business is. If it is a serious business looking for VC I
 would actually suspect the inverse is true: MySQL is underkill (I think I
 just made that word up) due to its lack of transactions and other advanced
 features (yes, these things do mean something in the real world).

Actually for web sites the lack of transactions is more of a boon than a
problem. Carefully written web pages rarely need complex multiple query
transactions anyways. I'm using Oracle now and the single biggest complaint is
the unnecessary overhead transactions put in everything even when they're not
needed or wanted.

For example, it makes it very hard to mix any kind of long running query with
OLTP transactions against the same data, since rollback data accumulates very
quickly. I would give some appendage for a while to tell Oracle to just use
the most recent data for a long running query without attempting to rollback
to a consistent view.

That said other Oracle features are absolutely essential to web sites:
partitioned tables, warm standby databases, hot backups, etc. 

-- 
greg