Re: Advanced daemon allocation

2001-06-18 Thread Trevor Phillips

Gunther Birznieks wrote:
 
 Yeah, just use the mod_proxy model and then proxy to different mod_perl
 backend servers based on the URL itself.

Isn't this pretty much what I said is *a* solution?

 I suppose I could do this now by having a front-end proxy, and mini-Apache
 configs for each group I want, but that seems to be going too far (at this
 stage), especially if the functionality already exists to do this within the
 one server.

To me, this isn't very ideal. Even sharing most of an apache configuration
file, what is the overhead of running a separate server? And can multiple
Apache servers share writing to the same log files?

It also doesn't help if I have dozens of possible groupings - running dozens of
slightly different Apache's doesn't seem a clean solution. Hence me asking if
it was possible within the one Apache server to prioritise the allocation to
specific daemons, based on some criteria, which would be a more efficient and
dynamic solution, if it's possible.

-- 
. Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
: CWIS Systems Administrator -   [EMAIL PROTECTED] : 
| IT Services   -   Murdoch University | 
 --- Member of the #SAS#  #CFC# 
| On nights such as this, evil deeds are done. And good deeds, of /
| course. But mostly evil, on the whole. /
 \  -- (Terry Pratchett, Wyrd Sisters)  /



Re: Advanced daemon allocation

2001-06-18 Thread Gunther Birznieks

At 02:29 PM 6/18/2001 +0800, Trevor Phillips wrote:
Gunther Birznieks wrote:

  I suppose I could do this now by having a front-end proxy, and mini-Apache
  configs for each group I want, but that seems to be going too far 
 (at this
  stage), especially if the functionality already exists to do this 
 within the
  one server.

To me, this isn't very ideal. Even sharing most of an apache configuration
file, what is the overhead of running a separate server? And can multiple

I think this is covered in the guide.

Apache servers share writing to the same log files?

Why would you need to? The front end can write the log file. Then don't 
bother logging the mod_perl servers. Or make them all log to syslog or some 
other shared logging mechanism.

It also doesn't help if I have dozens of possible groupings - running 
dozens of
slightly different Apache's doesn't seem a clean solution. Hence me asking if
it was possible within the one Apache server to prioritise the allocation to
specific daemons, based on some criteria, which would be a more efficient and
dynamic solution, if it's possible.

It's not ideal, but it's also not possible to do what you say until 
mod_perl 2.0.

You might also consider using Speedy::CGI if you aren't using handlers as 
it makes the multiple configs issue much more trivial to administer, but 
you still get a pretty fast speed up.





Install mod_perl on Solaris 2.7

2001-06-18 Thread Joseph Francois




Hello,
 I've been trying to install 
Mod_perl as APACI on solaris 2.7. but after the build i get " httpd: Cannot find 
ELF". I make mod_perl install apache for me. when I install apache without 
mod_perl, apache works fine. Please help

thank you


Re: Install mod_perl on Solaris 2.7

2001-06-18 Thread Paul Reynolds

What versoin of mod_perl are you using? I tend to stay away from 1.25. Try
installing a version between 1.17 and 1.25, excluding 1.25.

- Original Message -
From: Joseph Francois
To: [EMAIL PROTECTED]
Sent: Monday, June 18, 2001 10:09 AM
Subject: Install mod_perl on Solaris 2.7



Hello,
I've been trying to install Mod_perl as APACI on solaris 2.7. but after
the build i get  httpd: Cannot find ELF. I make mod_perl install apache
for me. when I install apache without mod_perl, apache works fine. Please
help

thank you




[ANNOUNCE] HTML::StickyForms 0.05

2001-06-18 Thread Peter Haworth

From the README:

This a lightweight form generation module, which can be used with either
CGI.pm (version 2 or 3), or (inside mod_perl) Apache::Request.
The module provides similar facilities to CGI.pm's HTML tag generation
routines, but is restricted to form field generation tags, with sticky values.
Also, the interface is not so flexible as CGI.pm's, in order to keep the code
size down.

Changes since version 0.04:
  Added set_sticky() method, useful if you ad parameters after creation
  Added values_as_labels() method, to allow labels to default to their values
  Added values_as_labels attribute to checkbox_group()/radio_group()/select()



The uploaded file

HTML-StickyForms-0.05.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/P/PM/PMH/HTML-StickyForms-0.05.tar.gz
  size: 5663 bytes
   md5: 18406762bcd4657064ce7f026ee93adb
-- 
Peter Haworth   [EMAIL PROTECTED]
We do not have to cater to the Windows 95 level of user-obsequiousness
-- Kai MacTane



single process

2001-06-18 Thread Purcell, Scott

Hello,
In the CGi to mod_perl porting coding guidelines, under the headline
sometimes it works, Sometimes it doesn't
It says to run the server (during testing) in a single process mode (httpd
-X)

I tried putting httpd 1 into the conf file, and it got mad at me.

How does one set the process (spawning of children) to 1

Thanks

Scott Purcell




Re: single process

2001-06-18 Thread Christoph Wernli

Purcell, Scott wrote:
 
 It says to run the server (during testing) in a single process mode (httpd
 -X)
 
 I tried putting httpd 1 into the conf file, and it got mad at me.
 
 How does one set the process (spawning of children) to 1

You have to add the X-option to the commandline, eg:

/path/to/httpd -X -f /path/to/config.file

http://httpd.apache.org/docs/programs/httpd.html

Cheers,

-Christoph
 S/MIME Cryptographic Signature


Re: single process

2001-06-18 Thread Nick Tonkin


The -X flag is a command-line option, not a conf file param. All your
other conf params stay the same (inside httpd.conf) and you just start
your server with /usr/local/apache/bin/httpd -X or whatever is
appropriate for your system.

This is not a mod_perl issue though; you may want to review the apache
docs.

~~~
Nick Tonkin

On Mon, 18 Jun 2001, Purcell, Scott wrote:

 Hello,
 In the CGi to mod_perl porting coding guidelines, under the headline
 sometimes it works, Sometimes it doesn't
 It says to run the server (during testing) in a single process mode (httpd
 -X)
 
 I tried putting httpd 1 into the conf file, and it got mad at me.
 
 How does one set the process (spawning of children) to 1
 
 Thanks
 
 Scott Purcell
 
 




[JOB] mod_perl programmer looking for development project

2001-06-18 Thread Dzuy Nguyen

Hi,

I am a seasoned web programmer (mod_perl, Perl, PHP) seeking for web 
development in similar environment.  I also manage, amdin systems, web 
sites, basically an all in one, jack of all trade kind of guy.  If 
interested, please email me for resume.  I prefer telecomuting unless 
you're in the Austin, TX area.  Thanks.

Dzuy




Re: Advanced daemon allocation

2001-06-18 Thread Matthew Byng-Maddick

On Mon, Jun 18, 2001 at 02:29:18PM +0800, Trevor Phillips wrote:
Gunther Birznieks wrote:
[Trevor wrote:]
Yeah, just use the mod_proxy model and then proxy to different mod_perl
backend servers based on the URL itself.
Isn't this pretty much what I said is *a* solution?

Yes, and the only one.

I suppose I could do this now by having a front-end proxy, and mini-Apache
configs for each group I want, but that seems to be going too far (at this
stage), especially if the functionality already exists to do this within the
one server.
 To me, this isn't very ideal. Even sharing most of an apache configuration
 file, what is the overhead of running a separate server? And can multiple
 Apache servers share writing to the same log files?

No. The way the multiple process model that apache uses works because of
the way that sockets work:

Parent process runs as root, calls:
 socket() (create the socket)
 bind()   (bind to our local sockaddr_in structure - ip/port)
 listen() (set the socket to listen mode)

now, normally, it would then call accept() to sit there and block for while
it waits for a connection to be made. Instead what it does is rather more
cunning.

It fork()s (several times) to create the children, and immediately setuid()s
to drop its root privs. However, the bit that needs the root privs is the
bind() call above, and because of the way that fork() works, we inherit the
socket from the parent.

These *children* then call accept(). And they all block.

When a connection comes in on that socket, whichever is currently in the
schedule queue will return from the accept() system call, and handle the
request. It is, however, up to the kernel, which one calls accept().
accept() returns a *new* file descriptor, which is the one for the *stream*
(as opposed to the socket).

Obviously, if your modperl is URL dependent, then you can't determine what
URL they are going to ask for at the time you have to call accept. The only
alternative way of doing what you're asking for is to use file descriptor
passing, which is still about *the* topmost unportable bit of UNIX. :-(
It is also quite complicated to get right.

It also doesn't help if I have dozens of possible groupings - running dozens of
slightly different Apache's doesn't seem a clean solution. Hence me asking if
it was possible within the one Apache server to prioritise the allocation to
specific daemons, based on some criteria, which would be a more efficient and
dynamic solution, if it's possible.

It isn't, because otherwise there'd be even more context-switching, (which is
slow). The clean solution, in this case, would be to have the one apache that
actually accepts, does a bit of work on the URL, and then delegates to
children (probably by passing the fd), but then you still have to do rather
too much work on the URL before you can do anything about it.

It isn't as unclean as you might think, though.

Hope this helps

MBM

-- 
Matthew Byng-Maddick [EMAIL PROTECTED]   http://colondot.net/



Forking Child 2

2001-06-18 Thread Purcell, Scott

Hello,
I wrote a little bit ago about trying to not fork my Apache server. I want
to run only a single child. Anyway, I got three terrific responses, but have
no clue what they mean.

I am on Apache NT4.0 and  am learning. Anyway, some of the responses I got
for setting a single process were:
type:
/path/to/apache/dir/httpd -X

I have been through my install trying to execute a httpd at the command
line, but I am making no connection.

Could someone please explain a litle more in detail what I should do on a NT
system and what the httpd is (exe?);

Thanks

Scott Purcell




Re: [Patch] Apache-dso_module()

2001-06-18 Thread Philippe M . Chiasson

On Wed, Jun 13, 2001 at 09:52:39PM -0700, Doug MacEachern wrote:
 On Fri, 25 May 2001, Philippe M . Chiasson wrote:
 
  I know I posted this patch a while ago, but I am looking thru a few patches
  I have and I thought I might re-post this one along with the rest
  
  This module allows one to do
  
  Apache-dso_module('module_name.c') and it will be true only of the
  module in question is present and has been loaded as DSO.
  
  Used to be usefull to me when attempting to work around Perl directives
  and mod_perl as DSO/not-DSO (now fixed).
  
  But I figured it could be usefull to others.
 
 any examples you can think of? 

In my case, I used it to work around the strange mod_perl behaviour under DSO (fixed 
in CVS)
 in any case, it would be better to have
 Apache-module('mod_foo.so') provide this functionality rather than add a
 new method.

Sure, only question, is the .so extension generic enough ? How about on Win platforms ?

Let me know and I'll re-patch

 

-- 
+---+
| Philippe M. Chiasson  [EMAIL PROTECTED]|
| SmartWorker http://www.smartworker.org|
| IM : gozerhbe  ICQ : gozer/99685021   |
|   64.8% computer corrupt according to |
| http://www.freespeech.org/ljk/purity.html |
+---+
That's about as funny as muppet Norwegian. 
-- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/print||$$++redo}'




Re: Forking Child 2

2001-06-18 Thread Gunther Birznieks

heh...I see your confusion (and everyone else's)

There's no such thing as httpd -X on Windows. It's one server that's 
multi-threaded. A completely differnet model to UNIX.

You don't have to do httpd -X because mod_perl on Windows Apache is kind of 
crippled anyway. It will ONLY run with one perl interpreter with serialized 
access to it. So you are already experiencing the equivalent of debug mode 
(httpd -X) when you run on Apache for Windows.

No extra work necessary.

At 09:45 AM 6/18/01 -0500, Purcell, Scott wrote:
Hello,
I wrote a little bit ago about trying to not fork my Apache server. I want
to run only a single child. Anyway, I got three terrific responses, but have
no clue what they mean.

I am on Apache NT4.0 and  am learning. Anyway, some of the responses I got
for setting a single process were:
type:
/path/to/apache/dir/httpd -X

I have been through my install trying to execute a httpd at the command
line, but I am making no connection.

Could someone please explain a litle more in detail what I should do on a NT
system and what the httpd is (exe?);

Thanks

Scott Purcell

__
Gunther Birznieks ([EMAIL PROTECTED])
eXtropia - The Open Web Technology Company
http://www.eXtropia.com/




Re: Advanced daemon allocation

2001-06-18 Thread Keith G. Murphy

Trevor Phillips wrote:
 
 Is there any way to control which daemon handles a certain request with apache
 1.x?
 
 eg; Out of a pool of 50 daemons, restricting accesses to a certain mod_perl
 application to 10 specific daemons would improve the efficiency of data cached
 in those processes.
 
Making sure the browser supports HTTP 1.1 (persistent connections) will
get you a lot better performance in many cases, since a particular user
will tend to keep hitting the same daemon, so that helps if they're
hitting the same or a related script over and over.

In one case, I was seeing really bad performance from an app, but it
seemed acceptable to the users, who were all running IE, where I was
running Netscape, which still doesn't support 1.1 in version 4
browsers.  :-(  Dunno about 6, Mozilla, etc.

Noticed you were running Netscape on Linux; what are your users
running?  ;-)



Re: Forking Child 2

2001-06-18 Thread William A. Rowe, Jr.

From: Purcell, Scott [EMAIL PROTECTED]
Sent: Monday, June 18, 2001 9:45 AM


 Hello,
 I wrote a little bit ago about trying to not fork my Apache server. I want
 to run only a single child. Anyway, I got three terrific responses, but have
 no clue what they mean.
 
 I am on Apache NT4.0 and  am learning. Anyway, some of the responses I got
 for setting a single process were:
 type:
 /path/to/apache/dir/httpd -X

That is it.  But httpd is Apache.exe on Win32.  So... Apache -x

 I have been through my install trying to execute a httpd at the command
 line, but I am making no connection.

You first need to stop apache  (apache -k stop -n Apache)
 
 Could someone please explain a litle more in detail what I should do on a NT
 system and what the httpd is (exe?);

It's named Apache.exe.  You should have mentioned Windows in you original post
so folks wouldn't mislead you (they certainly didn't mean to.)

Apache on unix uses the httpd executable, and forks many processes (one per
connection to serve.)

Apache on Win32 uses the threaded Apache.exe, twice.  The parent is only out
there to replace a dead child process.  Be warned, the -X is a crippled, debugging
version, and simple things like Ctrl+C to stop the server, and running as a service,
simply don't work.

Bill




Re: Advanced daemon allocation

2001-06-18 Thread Stas Bekman

On Mon, 18 Jun 2001, Keith G. Murphy wrote:

 Trevor Phillips wrote:
 
  Is there any way to control which daemon handles a certain request with apache
  1.x?
 
  eg; Out of a pool of 50 daemons, restricting accesses to a certain mod_perl
  application to 10 specific daemons would improve the efficiency of data cached
  in those processes.
 
 Making sure the browser supports HTTP 1.1 (persistent connections) will
 get you a lot better performance in many cases, since a particular user
 will tend to keep hitting the same daemon, so that helps if they're
 hitting the same or a related script over and over.

I beg your pardon Keith, but probably in most cases this is a very bad
suggestion. By leaving the KeepAlive's on (I guess that's what you refer
to by persistent connections) you tie a server to a user. Which makes your
service very unscalable. Given that you can afford X servers processes
running, when X users will get their persistent connection open, your
service becomes closed to any other users.

Using KeepAlive's is good mainly for static requests.

hold off... here is the story:
http://thingy.kcilink.com/modperlguide/performance/KeepAlive.html

Your solution is good though if you know that you can have at most X users
over a long time span. Which is usually the case on the intranet servers
in the small companies.

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: Advanced daemon allocation

2001-06-18 Thread Matthew Byng-Maddick

On Mon, Jun 18, 2001 at 10:41:50AM -0500, Keith G. Murphy wrote:
Trevor Phillips wrote:
 
Is there any way to control which daemon handles a certain request with apache
1.x?
 
eg; Out of a pool of 50 daemons, restricting accesses to a certain mod_perl
application to 10 specific daemons would improve the efficiency of data cached
in those processes.
Making sure the browser supports HTTP 1.1 (persistent connections) will
get you a lot better performance in many cases, since a particular user
will tend to keep hitting the same daemon, so that helps if they're
hitting the same or a related script over and over.

This only works within the keepalive timeout. (default configuration 15s)

In one case, I was seeing really bad performance from an app, but it
seemed acceptable to the users, who were all running IE, where I was
running Netscape, which still doesn't support 1.1 in version 4
browsers.  :-(  Dunno about 6, Mozilla, etc.

This is only true if you're serving images off the mod_perl server which
is crazy unless you're generating them.

Anyway: the point of this post was:
  http://perl.apache.org/guide/performance.html#KeepAlive

Sorry.

Although: Stas:
  Since keepalive connections will not incur the additional three-way TCP
   handshake, turning it off will be kinder to the network.
erm Surely if you turn it *on* you'll be kinder to the network,
because you're not reinitiating the handshake?

MBM

-- 
Matthew Byng-Maddick [EMAIL PROTECTED]   http://colondot.net/



Re: Advanced daemon allocation

2001-06-18 Thread Stas Bekman

 Although: Stas:
   Since keepalive connections will not incur the additional three-way TCP
handshake, turning it off will be kinder to the network.
 erm Surely if you turn it *on* you'll be kinder to the network,
 because you're not reinitiating the handshake?

[it] refers to [handshake]. I've rephrased this sentence to make it more
clear :) thanks!

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: Install mod_perl on Solaris 2.7

2001-06-18 Thread Paul Lindner

On Mon, Jun 18, 2001 at 11:03:10AM +0100, Paul Reynolds wrote:
 What versoin of mod_perl are you using? I tend to stay away from 1.25. Try
 installing a version between 1.17 and 1.25, excluding 1.25.

The attached script works for our project.  Just replace the @x@
values with stuff that you use on your own site..  It assumes that you
have the following directory layout:

  ./perl
  ./http/apache
  ./http/mod_perl

We use Apache 1.3.20, mod_perl 1.25, and perl 5.6.1, all built with
gcc 2.95.3 on solaris 2.6 or 2.8..

First off, some optimization flags:

CC=gcc CXX=g++ CFLAGS='-pipe -mcpu=ultrasparc -mtune=ultrasparc -m32 
-Wa,-xarch=v8plusa -Os'


Then, the perl args for use on Solaris, followed by some make rules to
build perl..


PERL_OPTS=-O -Dprefix=@prefix@ \
   -Dcc=@CC@ \
   -Doptimize=@CFLAGS@ \
   -Dlocincpth=@prefix@/include \
   -Dloclibpth=@prefix@/lib \
   [EMAIL PROTECTED] \
   [EMAIL PROTECTED] \
   -Ud_bincompat5005 \
   -Ubincompat5005 \
   -Uusemymalloc \
   -Uinstallusrbinperl \
   -Dlibperl=libperl.so \
   -Duseshrplib=true \
   -Dldflags=-L@prefix@/lib\
   -Duse64bitint \
   -des

PERL_CCEOPTS=-Dccflags='-DPERL_EMERGENCY_SBRK -DTWO_POT_OPTIMIZE -DPACK_MALLOC'

@prefix@/bin/perl: @srcdir@/perl/perl @srcdir@/perl/Makefile
$(MAKE) -C @srcdir@/perl install.perl
cd /usr/include; @prefix@/bin/h2ph * sys/*; \

@srcdir@/perl/perl: @srcdir@/perl/Makefile @prefix@/lib/libgdbm.so
@$(MAKE) -C @srcdir@/perl -j2 $(DEVARGS)

@srcdir@/perl/Makefile: @srcdir@/perl/Configure
(cd perl; env CCEOPTS=$(PERL_CCEOPTS) sh Configure $(PERL_OPTS))




And finally the apaci args used to build mod_perl+apache..


HTTPDENV=
PERLFLAGS=

APACI_ARGS=--enable-module=status --enable-module=proxy --prefix=@prefix@ 
--includedir=@prefix@/include/apache --disable-module=so --disable-module=asis 
--disable-module=imap --disable-module=cgi --disable-module=userdir 
--disable-module=autoindex --disable-module=include --disable-rule=EXPAT 
--disable-rule=WANTHSREGEX

echo ..configuring mod_perl+apache;\
cd @srcdir@/http/mod_perl;\
env CFLAGS=@CFLAGS@ -DDYNAMIC_MODULE_LIMIT=0 
-DSINGLE_LISTEN_UNSERIALIZED_ACCEPT $(PERL) $(PERLFLAGS) Makefile.PL $(HTTPDENV)\
USE_APACI=1 APACI_ARGS=$(APACI_ARGS) \
EVERYTHING=1 PERL_STASH_POST_DATA=1 \
DO_HTTPD=1 APACHE_SRC=../apache/src \
PERL_USELARGEFILES=0\
PERL_MARK_WHERE=1 PERL_SECTIONS_SELF_BOOT=1


Hope this helps others using solaris...  It seems to work well for us.
I can't wait to try gcc 3.0 now that it's been released, this should
allow for even greater optimization of the code base...




 - Original Message -
 From: Joseph Francois
 To: [EMAIL PROTECTED]
 Sent: Monday, June 18, 2001 10:09 AM
 Subject: Install mod_perl on Solaris 2.7
 
 
 
 Hello,
 I've been trying to install Mod_perl as APACI on solaris 2.7. but after
 the build i get  httpd: Cannot find ELF. I make mod_perl install apache
 for me. when I install apache without mod_perl, apache works fine. Please
 help
 
 thank you

-- 
Paul Lindner
[EMAIL PROTECTED]



Re: CGI::Cookie vs Apache::Cookie -- help?

2001-06-18 Thread will trillich

On Mon, Jun 18, 2001 at 07:18:56AM +0200, Per Einar wrote:
 
 - Original Message -
 From: will trillich [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 18, 2001 7:09 AM
 Subject: Re: CGI::Cookie vs Apache::Cookie -- help?

  what does $cookie-bake do (add set-cookie header) that
  $r-header_out('set-cookie'=$cookie) (add set-cookie header)
  does not?
 
  [ and why ain't that mentioned in the manual? ]
 
 As someone else stated, bake() actually sends a Set-Cookie header, but with
 $cookie-as_string and not just $cookie (which is an instance of
 Apache::Cookie). When you're just sending $cookie you're sending an object
 reference.
 
 Per Einar Ellefsen
 [EMAIL PROTECTED]

my grok quotient has grown considerably. thanks!

-- 
I figure: if a man's gonna gamble, may as well do it
without plowing.   -- Bama Dillert, Some Came Running

[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!



Multiple AddHandler statements

2001-06-18 Thread Douglas C. Heestand

We have a CGI script which dynamically generates a certain page on our site.
We want to include an SSI on that dynamically created page.  Is that
possible?  We have two AddHandler statements for files that end in .cgi...

IfModule mod_mime.c
...
AddHandler server-parsed .cgi
...
/IfModule

VirtualHost 192.168.1.1
ServerName www.xyz.com
... 
AddHandler cgi-script .cgi
/VirtualHost

Unfortunately, the dynamically generated page is not being server-parsed
because the Include virtual statement is showing up in the HTML source (the
same statment on a .shtml file, however, is replaced with the result of the
SSI).

Any help would be greatly appreciated.




Adding parameters to a request

2001-06-18 Thread Rob Bloodgood

In my AuthenHandler, I run the following snippet:

# validation successful
$apr-subprocess_env(REMOTE_PASSWORD = $pass);
  my $args = $apr-args || '';
$apr-args( $args . ( length $args ? '' : '' ) . pid=$pid )
   unless $args =~ /pid=\d+/;
return OK;

The intent is to add the parameter 'pid=99' or whatever to the request if it
is not already present.

It feels clunky and forced to me... is there a better way to do this?  As
indicated by the variable, I'm using Apache::Request, for the sole purpose
of having easier access to the parameters.  Except that it turns out
Apache::Request's param() method does NOT support *setting* parameters, only
*getting* them. sigh

TIA!

L8r,
Rob




RE: Adding parameters to a request

2001-06-18 Thread Geoffrey Young

 

-Original Message-
From: Rob Bloodgood
To: mod_perl
Sent: 6/18/01 6:35 PM
Subject: Adding parameters to a request

[snip]
 I'm using Apache::Request, for the sole
purpose
of having easier access to the parameters.  Except that it turns out
Apache::Request's param() method does NOT support *setting* parameters,
only
*getting* them. sigh

the
$apr-param('foo' = [qw(one two three)]);
example in the docs didn't work until recently in CVS and it hasn't been
propigated out yet (although a 0.33 release of libapreq is pending)

for the moment, try

my $parms = $apr-parms;

$parms is an Apache::Table object, for which you can call get(), set(),
add(), etc.

in the next release, $apr-param will return an Apache::Table object in a
scalar contect, removing the need for a separate parms() method.  for now,
that should help.

--Geoff



RE: Adding parameters to a request

2001-06-18 Thread Rob Bloodgood

 [snip]
  I'm using Apache::Request, for the sole
 purpose
 of having easier access to the parameters.  Except that it turns out
 Apache::Request's param() method does NOT support *setting* parameters,
 only
 *getting* them. sigh

 the
 $apr-param('foo' = [qw(one two three)]);
 example in the docs didn't work until recently in CVS and it hasn't been
 propigated out yet (although a 0.33 release of libapreq is pending)

 for the moment, try

 my $parms = $apr-parms;

 $parms is an Apache::Table object, for which you can call get(), set(),
 add(), etc.

 in the next release, $apr-param will return an Apache::Table object in
 a scalar contect, removing the need for a separate parms() method.
 for now, that should help.

I tried this:

my $parms = $apr-parms;
$parms-add( pid = $pid) unless defined $parms-get('pid');

But now my app complains that it's not getting a parameter for pid at all.
I looked at the source, and parms() returns

ST(0) = mod_perl_tie_table(req-parms);

But I don't know if the above call is complete (changes to the
Apache::Table object reflect in the request).  Am I supposed to re-insert
the table into the request?  None of the following worked:

$apr-args($parms);
$apr-parms($parms);

and I couldn't figure out how to convince $parms to stringify so that I
could just assign THAT to $apr-args.

Suggestions?

TIA!

L8r,
Rob




RE: Adding parameters to a request

2001-06-18 Thread Geoffrey Young

 

-Original Message-
From: Rob Bloodgood
To: Geoffrey Young
Cc: mod_perl
Sent: 6/18/01 8:33 PM
Subject: RE: Adding parameters to a request

[snip]

But I don't know if the above call is complete (changes to the
Apache::Table object reflect in the request).  

oh, I see... I don't think I have ever tried to use Apache::Request to set
the values for the current request.

ok, here are a few suggestions (none tested)...

use Apache::Request::instance instead of Apache::Request::new - I assume
that you are setting parameters in your auth handler then reading them again
with Apache::Request.  try using instance() to stash $apr away.  if your
version doesn't support it, take a look at the code - it's just stashing
$apr into $r-pnotes()

I don't think (off the top of my head, which is frequently wrong :) that you
can use any Apache::Request method to set query string parameters that are
dug out in later phases, since I'll be that Apache::Request goes straight to
r-args in the request_rec.  so, try calling $r-args($new_query_string)
instead of using param() to set them...

 Am I supposed to
re-insert
the table into the request?  None of the following worked:

$apr-args($parms);
$apr-parms($parms);

and I couldn't figure out how to convince $parms to stringify so that I
could just assign THAT to $apr-args.

you'll just have to use a $parms-do() loop to concatinate them together I'd
think.

HTH some

--Geoff



Re: mod_perl bof Oreilly Conference TShirts

2001-06-18 Thread Randal L. Schwartz

 Gunther == Gunther Birznieks [EMAIL PROTECTED] writes:

Gunther A month ago I posed a question about TShirts for mod_perl BOF.
Gunther One group of people did volunteer to do the design and posted interest
Gunther on here. So if they are still up for it, it would be awesome to start
Gunther discussing ideas/proof of concept.

Gunther However, before such a thing can be discussed, unfortunately no one
Gunther has come up to be able to sponsor the cost for the T-Shirts. So I
Gunther figure I would raise the question again in case someone has a company
Gunther that would be willing to corporate sponsor such a thing.

I'm already pumping out about 750 T's at TPC, so I don't think I can
be Yet Another Sponsor.  However, I've got a producer that can make
shirts at Very Reasonable Prices, or I wouldn't be doing this in the
first place, and would be happy to set you up with them (it's a mom
and pop shop here near my neck of the woods, and we have a nice
relationship with them).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Requests using If-Modified-Since cause response Set-Cookie to be discarded

2001-06-18 Thread Andrew Gilmartin

I have PerlAuthenHandler handler that sets a cookie on authentication
success. The cookie records, in part, the time of the last access to
the site. Therefore for each access the cookie is updated. When a new
document is accessed or a CGI script is run the cookie is sent to the
browser. However, if the browser is asking for a document it has
cached it will send an If-Modified-Since header. The file delivery
mechanism in Apache will do the right thing with If-Modified-Since
information and only send the document if, in fact, it has changed.
Unfortunately, if it has not changed the cookie I set in my handler is
discarded (no matter if I use $r-header_out() or
$r-err_header_out()).

How can I force Apache to send the Set-Cookie header even if the
document being delivered has not changed? I suspect that I am not the
first person to run into this problem. A search of the list was
unsuccessful, unfortunately.

---
Andrew Gilmartin
Ingenta / Dynamic Diagrams
[EMAIL PROTECTED]






Re: [Patch] Apache-dso_module()

2001-06-18 Thread Doug MacEachern

On Mon, 18 Jun 2001, Philippe M . Chiasson wrote:
 
 In my case, I used it to work around the strange mod_perl behaviour
 under DSO (fixed in CVS)

right, so that is no longer needed.  any other examples?  i hesitate on
adding the feature because anything that needs to be conditional based on
mod_perl being a dso probably means that there is a bug in mod_perl that
should be fixed instead.

 Sure, only question, is the .so extension generic enough ? How about on
 Win platforms ? 

win32 recently started using .so for all apache dso modules.




Re: Install mod_perl on Solaris 2.7

2001-06-18 Thread Doug MacEachern

On Mon, 18 Jun 2001, Paul Lindner wrote:

-Uusemymalloc \
... 
 PERL_CCEOPTS=-Dccflags='-DPERL_EMERGENCY_SBRK -DTWO_POT_OPTIMIZE -DPACK_MALLOC'

these options are only in effect when using Perl's malloc, which
-Uusemymalloc turns off.  they are also all turned on by default in 5.6.0+





Re: Install mod_perl on Solaris 2.7

2001-06-18 Thread Doug MacEachern

On Mon, 18 Jun 2001, Paul Reynolds wrote:

 What versoin of mod_perl are you using? I tend to stay away from 1.25.

care to share the problems you have with 1.25?  if they are not fixed in
cvs, now is the time to make them known to be fixed for 1.26.






Confusion resolved (was: mod_perl DSO leaking on restart)

2001-06-18 Thread Paul G. Weiss

I think I've found the error of my ways.

The reason that it was leaking with a static build was that the
PerlFreshRestart directive was set to 'On'.  This resulted in a
leak of a couple of Mb.

The reason that it was leaking with a USE_DSO build was that I didn't set
PERL_DESTRUCT_LEVEL.  Once I added
PerlSetEnv PERL_DESTRUCT_LEVEL 2
the leak stopped.  Actually I get the behavior Doug reported: a small leak
of around 24K on the first restart and none thereafter.

Actually in order to achieve this I had to comment out the load of
example_module.  That module leaks about 56K when restarted as a dso.

I've not been able to avoid a leak with a USE_APXS build.

-Paul



On Sun, 17 Jun 2001, Paul G. Weiss wrote:

 Now I'm really confused.  I built the whole thing statically and it still
 leaks:
 
 the static build (using the same Perl):
 
 ~/test/prefix/bin/perl Makefile.PL EVERYTHING=1 \
 APACHE_PREFIX=$(echo ~/test/prefix/apache) \
 APACHE_SRC=../apache_1.3.19 DO_HTTPD=1
 
 Now it still leaks 520K per restart:
 
  make start_httpd_fork
 ../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -d `pwd`/t
  ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
   PID   VSZ COMMAND
  4877  7856 httpd
  kill -USR1  $(cat t/logs/httpd.pid )
  ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
   PID   VSZ COMMAND
  4877  8488 httpd
  kill -USR1  $(cat t/logs/httpd.pid )
  ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
   PID   VSZ COMMAND
  4877  9108 httpd
 
 This is on Redhat 7.1 (not Linux 7.1 as I said below).  I didn't bother
 trying it on Solaris.
 
 You don't suppose building with APACHE_PREFIX could have anything to do
 with it, do you?  I haven't heard of any leaks with a static build.
 
 -P
 
 
 
 
 
 
 On Sun, 17 Jun 2001, Paul G. Weiss wrote:
 
  Doug,
  
  I'm confused as to how you managed to *not* leak when I'm still
  leaking.  I've tried these tests on both a Solaris 2.7 system and
  a Linux 7.1.
  
  Here is a summary of what I do:
  
  I build Perl
  
  ./Configure -des -Uusemymalloc -Dprefix=$(echo ~/test/prefix) -Dcc=gcc
  make  make test  make install
  
  I build Apache
  
  ~/test/prefix/bin/perl Makefile.PL USE_DSO=1 EVERYTHING=1 \
  USE_APACI=1 APACHE_PREFIX=$(echo ~/test/prefix/apache) \
  APACHE_SRC=../apache_1.3.19 \
  APACI_ARGS='--enable-module=all --enable-shared=max' \
  DO_HTTPD=1
  
  make
  make test
  
  I now run the test:
  
  make start_httpd_fork
  ps -o 'pid,vsz,comm' -p $(cat t/logs/httpd.pid )
  kill -USR1 $(cat t/logs/httpd.pid )
  ps -o 'pid,vsz,comm' -p $(cat t/logs/httpd.pid )
  kill -USR1 $(cat t/logs/httpd.pid )
  
  etc.  The virtual size grows each time, although by different amounts 
  in Linux and Solaris.  Both are around 4Mb.  So what are you doing 
  differently?  Let me know so I can do the same thing.  The Perl I'm using
  is 5.6.1 and the modperl is
  modperl_20010614113010.tar.gz.
  
  -P
  
  
  On Fri, 15 Jun 2001, Paul G. Weiss wrote:
  
   Don't be so willing to bet.  Still leaking.
   
   I did as you said and just rebuilt Perl and mod_perl but didn't bother to
   rebuild all the Perl modules (I would have done so had I been successful
   here).
   
   Here's what I see:
   
make start_httpd_fork
   ../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -d `pwd`/t
ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
 PID  PPID  VSZ COMMAND
   28802 1 15528 ../apache_1.3.19/src/httpd
kill -USR1 $(cat t/logs/httpd.pid )
ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
 PID  PPID  VSZ COMMAND
   28802 1 20016 ../apache_1.3.19/src/httpd
kill -USR1 $(cat t/logs/httpd.pid )
ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
 PID  PPID  VSZ COMMAND
   28802 1 24544 ../apache_1.3.19/src/httpd
kill -USR1 $(cat t/logs/httpd.pid )
ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
 PID  PPID  VSZ COMMAND
   28802 1 27224 ../apache_1.3.19/src/httpd
make kill_httpd
   kill `cat t/logs/httpd.pid`
   rm -f t/logs/httpd.pid
   rm -f t/logs/error_log
   
   
   
   On Thu, 14 Jun 2001, Doug MacEachern wrote:
   
On Fri, 15 Jun 2001, Paul G. Weiss wrote:

 alignbytes=8, usemymalloc=y, prototype=define
^
ok, here's why i kept asking for perl -V.  i don't see Perl's malloc.c
ever release its memory pool.  when usemymalloc=y, free() only puts memory
back into Perl's pool for use by other malloc()'s.  i don't see a function
to destroy this pool when perl cleans itself up.  willing to bet if you
rebuild Perl with: Configure -des -Uusemymalloc ...
and then rebuild mod_perl, the leaks will go away.

   
  
  
  
  
  
 
 




Re: Confusion resolved (was: mod_perl DSO leaking on restart)

2001-06-18 Thread Doug MacEachern

ah ha, right, since i always have PERL_DEBUG=1, perl_destruct_level is
always set to 2.  good find!  it should always be 2 for dso, this patch
seems to fix USE_APXS too.

--- src/modules/perl/mod_perl.c 2001/06/14 04:49:08 1.137
+++ src/modules/perl/mod_perl.c 2001/06/19 01:59:18
@@ -259,8 +259,6 @@
 
 if((pdl = getenv(PERL_DESTRUCT_LEVEL)))
perl_destruct_level = atoi(pdl);
-else
-   perl_destruct_level = PERL_DESTRUCT_LEVEL;
 
 if(perl_destruct_level  0) {
MP_TRACE_g(fprintf(stderr, 
@@ -510,6 +508,7 @@
 array_header *librefs;
 
 librefs = xs_dl_librefs((pool *)data);
+perl_destruct_level = 2;
 perl_shutdown(NULL, NULL);
 unload_xs_so(librefs);
 } 






cvs commit: modperl Changes

2001-06-18 Thread dougm

dougm   01/06/18 19:36:42

  Modified:src/modules/perl mod_perl.c
   .Changes
  Log:
  perl_destruct_level must always be 2 for DSO builds
  
  Revision  ChangesPath
  1.138 +1 -2  modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.137
  retrieving revision 1.138
  diff -u -r1.137 -r1.138
  --- mod_perl.c2001/06/14 04:49:08 1.137
  +++ mod_perl.c2001/06/19 02:36:38 1.138
  @@ -259,8 +259,6 @@
   
   if((pdl = getenv(PERL_DESTRUCT_LEVEL)))
perl_destruct_level = atoi(pdl);
  -else
  - perl_destruct_level = PERL_DESTRUCT_LEVEL;
   
   if(perl_destruct_level  0) {
MP_TRACE_g(fprintf(stderr, 
  @@ -510,6 +508,7 @@
   array_header *librefs;
   
   librefs = xs_dl_librefs((pool *)data);
  +perl_destruct_level = 2;
   perl_shutdown(NULL, NULL);
   unload_xs_so(librefs);
   } 
  
  
  
  1.600 +3 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.599
  retrieving revision 1.600
  diff -u -r1.599 -r1.600
  --- Changes   2001/06/14 16:38:15 1.599
  +++ Changes   2001/06/19 02:36:40 1.600
  @@ -10,6 +10,9 @@
   
   =item 1.25_01-dev
   
  +perl_destruct_level must always be 2 for DSO builds to prevent
  +leaking on restarts, thanks to Paul G. Weiss for the spot
  +
   make sure file to be reloaded can be found in @INC, adjusting based on
   %INC value if needed
   [Ilya Konstantinov [EMAIL PROTECTED]]
  
  
  



cvs commit: modperl/src/modules/perl mod_perl.c

2001-06-18 Thread dougm

dougm   01/06/18 19:38:55

  Modified:src/modules/perl mod_perl.c
  Log:
  removing dead code
  
  Revision  ChangesPath
  1.139 +0 -23 modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.138
  retrieving revision 1.139
  diff -u -r1.138 -r1.139
  --- mod_perl.c2001/06/19 02:36:38 1.138
  +++ mod_perl.c2001/06/19 02:38:54 1.139
  @@ -480,29 +480,6 @@
   }
   }
   
  -#if 0
  -/* unload_xs_dso should obsolete this hack */
  -static void cancel_dso_dlclose(void)
  -{
  -module *modp;
  -
  -if(!PERL_DSO_UNLOAD)
  - return;
  -
  -if(strEQ(top_module-name, mod_perl.c))
  - return;
  -
  -for(modp = top_module; modp; modp = modp-next) {
  - if(modp-dynamic_load_handle) {
  - MP_TRACE_g(fprintf(stderr, 
  -mod_perl: cancel dlclose for %s\n, 
  -modp-name));
  - modp-dynamic_load_handle = NULL;
  - }
  -}
  -}
  -#endif
  -
   static void mp_dso_unload(void *data) 
   { 
   array_header *librefs;
  
  
  



cvs commit: modperl/src/modules/perl mod_perl.c mod_perl.h perl_config.c

2001-06-18 Thread dougm

dougm   01/06/18 20:12:48

  Modified:.Makefile.PL
   src/modules/perl mod_perl.c mod_perl.h perl_config.c
  Log:
  remove dead code for PERL_STARTUP_{IS_DONE,DONE_CHECK} hack
  
  Revision  ChangesPath
  1.187 +0 -2  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.186
  retrieving revision 1.187
  diff -u -r1.186 -r1.187
  --- Makefile.PL   2001/06/14 04:49:07 1.186
  +++ Makefile.PL   2001/06/19 03:12:41 1.187
  @@ -232,8 +232,6 @@
   
   my %experimental = map { $_,1 } qw{
   PERL_AUTOPRELOAD
  -PERL_DSO_UNLOAD
  -PERL_STARTUP_DONE_CHECK
   PERL_RUN_XS
   PERL_MARK_WHERE
   DO_INTERNAL_REDIRECT
  
  
  
  1.140 +5 -21 modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- mod_perl.c2001/06/19 02:38:54 1.139
  +++ mod_perl.c2001/06/19 03:12:44 1.140
  @@ -603,7 +603,7 @@
   dstr = NULL;
   #endif
   
  -if(PERL_RUNNING()  PERL_STARTUP_IS_DONE) {
  +if(PERL_RUNNING()) {
saveINC;
mp_check_version();
   #if !HAS_MMN_136
  @@ -760,22 +760,6 @@
GvIMPORTED_CV_on(exitgp);
   }
   
  -if(PERL_STARTUP_DONE_CHECK)  {
  - char *psd = getenv(PERL_STARTUP_DONE);
  - if (!psd) {
  - MP_TRACE_g(fprintf(stderr, 
  -mod_perl: PerlModule,PerlRequire postponed\n));
  - my_setenv(PERL_STARTUP_DONE, 1);
  - saveINC;
  - return;
  - }
  - else { 
  - MP_TRACE_g(fprintf(stderr, 
  -mod_perl: postponed PerlModule,PerlRequire 
enabled\n));
  - my_setenv(PERL_STARTUP_DONE, 2);
  - }
  -}
  -
   ENTER_SAFE(s,p);
   MP_TRACE_g(mod_perl_dump_opmask());
   
  @@ -808,10 +792,10 @@
   #endif
   
   saveINC;
  -#if MODULE_MAGIC_NUMBER = MMN_130
  -if(perl_module.dynamic_load_handle) 
  - register_cleanup(p, p, mp_dso_unload, null_cleanup); 
  -#endif
  +
  +if (PERL_IS_DSO) {
  + register_cleanup(p, p, mp_dso_unload, null_cleanup);
  +}
   }
   
   int mod_perl_sent_header(request_rec *r, int val)
  
  
  
  1.109 +0 -11 modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- mod_perl.h2001/02/16 23:30:27 1.108
  +++ mod_perl.h2001/06/19 03:12:45 1.109
  @@ -503,17 +503,6 @@
   # endif
   #endif
   
  -#ifndef PERL_STARTUP_DONE_CHECK
  -#define PERL_STARTUP_DONE_CHECK getenv(PERL_STARTUP_DONE_CHECK)
  -#endif
  -
  -#define PERL_STARTUP_IS_DONE \
  -(!PERL_STARTUP_DONE_CHECK || strEQ(getenv(PERL_STARTUP_DONE), 2))
  -
  -#ifndef PERL_DSO_UNLOAD
  -#define PERL_DSO_UNLOAD getenv(PERL_DSO_UNLOAD)
  -#endif
  -
   #ifdef APACHE_SSL
   #define PERL_DONE_STARTUP 1
   #else
  
  
  
  1.110 +22 -26modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- perl_config.c 2001/05/15 17:02:32 1.109
  +++ perl_config.c 2001/06/19 03:12:45 1.110
  @@ -593,21 +593,19 @@
   MP_TRACE_d(fprintf(stderr, PerlModule: arg='%s'\n, arg));
   
   if(PERL_RUNNING()) {
  - if (PERL_STARTUP_IS_DONE) {
  - if (perl_require_module(arg, NULL) != OK) {
  - dTHR;
  - STRLEN n_a;
  - dTHRCTX;
  - return SvPV(ERRSV,n_a);
  - }
  +if (perl_require_module(arg, NULL) != OK) {
  +dTHR;
  +STRLEN n_a;
  +dTHRCTX;
  +return SvPV(ERRSV,n_a);
  +}
   #ifdef PERL_SECTIONS
  -else {
  -if (CAN_SELF_BOOT_SECTIONS) {
  -perl_section_self_boot(parms, dummy, arg);
  -}
  - }
  +else {
  +if (CAN_SELF_BOOT_SECTIONS) {
  +perl_section_self_boot(parms, dummy, arg);
  +}
  +}
   #endif
  - }
   }
   else {
   /* Delay processing it until Perl starts */
  @@ -625,21 +623,19 @@
   MP_TRACE_d(fprintf(stderr, PerlRequire: arg=`%s'\n, arg));
   
   if(PERL_RUNNING()) {
  - if (PERL_STARTUP_IS_DONE) {
  - if (perl_load_startup_script(parms-server, parms-pool, arg, TRUE) != OK) 
{
  - dTHR;
  - STRLEN n_a;
  - dTHRCTX;