Re: templating benchmarks...

2001-06-14 Thread Stas Bekman

On Wed, 13 Jun 2001, Perrin Harkins wrote:

   wow. template toolkil took a big hit, there. (no mod_perl on
   this list? hmm!)
 
  This benchmark can be very non-representive. If you don't know how to
  optimize each and every thing under test, you end up with unfair
  benchmark and come to potentially wrong conclusions. Take TT, add compiled
  template caching on the disk and shared TT object and I bet TT won't be at
  the bottom.

 I actually helped Joshua tune the TT example a little, and it using a cached
 Template object and caching the templates used in the test in memory.  The
 slowness comes from the fact that it provides a major feature that the
 others don't, and it is being exercised in this test.  The magic dot
 notation which allows templates to say foo.bar.baz, regardless of what kind
 of data structure, object, or code ref foo, bar, and baz may be takes
 a little more work.  Whether it's a good idea or not is left as an exercise
 to the reader, but I will say this: if Template Toolkit is the bottleneck in
 your app's performance, you have either done some serious tuning or written
 a really simple application (like this benchmark).

I stand corrected.

I've tried to provide a general note of not taking any numbers for
granted. Your explanation is as usual the great one :)

 Nevertheless, it's good to see some numbers, if only to convince Andy to
 finish his optimized XS version of the TT stash.

Yeah, it beats our apps' performance badly, with some 8000 calls to
_dotop()  in TT in some rendered-data-heavy requests, since we use deeply
nested datastructures like foo.bar.baz. I'll probably have to rework this
if Andy doesn't come up with Stash written in XS. If you plan to work with
the current TT and are going to use lots of vars in loops, consider not to
use hashes deeper than one level, and if you still want to use them,
consider reducing the nesting level wherever possible in the templates by
doing [% baz = foo.bar.baz %] before diving into a loop where foo.bar.baz
will be constantly accessed. (of course relevant for loops with many
iterations).

Surpisingly though, TT is faster than pure Perl when it comes to writing
loops rendering data from relatively deeply nested data structures:

Benchmark: timing 2000 iterations of access_perl, access_tt...
access_perl:  7 wallclock secs ( 7.01 usr +  0.00 sys =  7.01 CPU) @
285.31/s (n=2000)
 access_tt:  5 wallclock secs ( 4.19 usr +  0.05 sys =  4.24 CPU) @
471.70/s (n=2000)

Here is the benchmark I've used. (this code is a dream of calendar
programmers, since all months are 31-days long :-) :

use Time::HiRes qw( gettimeofday tv_interval );
use Template;
my $tt = Template-new();

my $data =
{
 month_name = [1..12],
 day_event  = [ map {
 [ map { {time=1,info=2} } 1..31 ]
 } 1..12
   ],
};

use Benchmark;
timethese(2000,
  {
   access_perl = \access_perl,
   access_tt   = \access_tt,
  });

sub access_tt{
my $output = '';
$tt-process(\*DATA, {data=$data},\$output);
}

sub access_perl{
my $output = '';
for my $m (0..11){
$output .= Month: $data-{month_name}[$m]\n;
for my $d (0..30){
my $event = $data-{day_event}[$m][$d];
$output .= Time: $event-{time}\n;
$output .= Info: $event-{info}\n;
}
}
}

__DATA__
  [% FOR m = [0..11] %]
  Month: [% data.month_name.$m %]
  [% FOR d = [0..30] %]
  [% event = data.day_event.$m.$d %]
  Time: [% event.time %]
  Info: [% event.info %]
  [% END %]
  [% END %]


Cool, huh?

_
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/





Best way to attach a module to /

2001-06-14 Thread Jamie Krasnoo

What is the best way to attach a module to be run when a user first enters
the site?

use LocationMatch and set it to only match / as in ^/$ ?

Thanks,

Jamie Krasnoo
[EMAIL PROTECTED]




Re: Charset woes

2001-06-14 Thread Ged Haywood

Hi Robin,

On Wed, 13 Jun 2001, Robin Berjon wrote:

 I'm running into trouble with browsers submitting data using various charsets 
 and not telling me which charset they're using. This results in all sorts of 
 breakages and unusable text. I can't be the only one dealing with this 
 problem (if I am, then I'm really out of luck) so I was wondering if anyone 
 here knows of a good way to reliably detect the charset that the browser is 
 using to post its data.

It will be very difficult to guess reliably what charset is in use from
a random sample of characters taken from it.  I think you just have to
be able to handle the data.  You need sixteen bits per character.

73,
Ged.





Re: Charset woes

2001-06-14 Thread Robin Berjon

On Thursday 14 June 2001 13:18, Ged Haywood wrote:
 On Wed, 13 Jun 2001, Robin Berjon wrote:
  I'm running into trouble with browsers submitting data using various
  charsets and not telling me which charset they're using. This results in
  all sorts of breakages and unusable text. I can't be the only one dealing
  with this problem (if I am, then I'm really out of luck) so I was
  wondering if anyone here knows of a good way to reliably detect the
  charset that the browser is using to post its data.

 It will be very difficult to guess reliably what charset is in use from
 a random sample of characters taken from it.  I think you just have to
 be able to handle the data.  You need sixteen bits per character.

I'm able to handle the data :) The problem is simply that I need to mix that 
data with other data in another encoding, which means I have to convert it. 
And in order to convert it, I need to know the original encoding... otherwise 
either the converter will blow up, or I'll corrupt the content.

Thanks Ged :)

-- 
___
Robin Berjon [EMAIL PROTECTED] -- CTO
k n o w s c a p e : // venture knowledge agency www.knowscape.com
---
There are trivial truths and there are great Truths. The opposite of 
a trival truth is obviously false. The opposite of a great Truth is 
also true.  
-- Niels Bohr 




Re: Apache::StatINC patch

2001-06-14 Thread Doug MacEachern

thanks, this has been applied for 1.26-tobe.

On Wed, 14 Mar 2001, Ilya Konstantinov wrote:

 Hi,
 
 While developing with mod_perl and Apache::ASP here at Aduva SID
 department, we've came across an annoying problem.
 
 Apache::ASP adds it's 'Global' directory to @INC. We naturally
 used it to store modules. Since mod_perl resets @INC across requests
 but doesn't reset %INC, Apache::StatINC sometimes found changes in the
 used modules, but couldn't reload them (since their directory wasn't in
 @INC).
 
 This patch will insert missing directories into @INC on the fly.
 
 




Re: untraceable uninit warnings

2001-06-14 Thread Doug MacEachern

On Wed, 7 Mar 2001, Graham Barr wrote:

 Does anyone have any idea what could be causing 
 
 Use of uninitialized value at PerlHandler subroutine `VC::Delivery::Cycle::handler' 
line 1.
 
 to appear in the errorlog ?
 
 I even added
 
 local $SIG{__WARN__} = sub { warn here };
 
 as the first line of VC::Delivery::Cycle::handler, but it never gets
 triggered, so it would seem the uninit is before the sub is called.
 
 The strange thing is that it is only this one handler that causes
 such a warning, all others are fine.

this will only happen if you gave Makefile.PL PERL_MARK_WHERE=1
which will modify CopFILEGV(curcop) if Perl doesn't know what it is for
some reason.  not sure why the WARN hook is being ignored, if you can
whittle it down to a small test case i will have a look.





Re: Problem with $r-register_cleanup()

2001-06-14 Thread Doug MacEachern

On Wed, 7 Feb 2001 [EMAIL PROTECTED] wrote:

 Hi,
 
 I just ran into a problem with $r-register_cleanup() only sometime beeing
 called.
 
 This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on
 AIX 4.3.3.
 
 Here's a sample code (snippet):
 
 sub handler { # PerlTransHandler
   my $r = shift;
   $r-register_cleanup(\clean1);
   $r-push_handlers(PerlCleanupHandler = \clean2);
   $r-pnotes('cleanup', bless {} );
   print STDERR 'in ;
 ^   ^

could this have something todo with it?
after fixing that, i tried your transhandler and get the expected results
in the error_log:
in register_cleanup register_cleanup push_handlers push_handlers DESTROY

if you still see this behavior with 1.25, i'd need more info of how to
reproduce the problem, such as what requests you're making that produce
unexpected results.





Re: untraceable uninit warnings

2001-06-14 Thread Graham Barr

Ah, this was a while ago,

I did actually trace the problem down. The handler was returning undef
which was causing these warnings. It was just not taht obvious from the
warning given.

Graham.

On Thu, Jun 14, 2001 at 09:48:42AM -0700, Doug MacEachern wrote:
 On Wed, 7 Mar 2001, Graham Barr wrote:
 
  Does anyone have any idea what could be causing 
  
  Use of uninitialized value at PerlHandler subroutine 
`VC::Delivery::Cycle::handler' line 1.
  
  to appear in the errorlog ?
  
  I even added
  
  local $SIG{__WARN__} = sub { warn here };
  
  as the first line of VC::Delivery::Cycle::handler, but it never gets
  triggered, so it would seem the uninit is before the sub is called.
  
  The strange thing is that it is only this one handler that causes
  such a warning, all others are fine.
 
 this will only happen if you gave Makefile.PL PERL_MARK_WHERE=1
 which will modify CopFILEGV(curcop) if Perl doesn't know what it is for
 some reason.  not sure why the WARN hook is being ignored, if you can
 whittle it down to a small test case i will have a look.
 



Re: BSDI 4.1 libperl.so problem

2001-06-14 Thread Doug MacEachern

On Thu, 8 Feb 2001, Aaron Schlesinger wrote:

 Hi there. I am having a HELL of a time trying to get
 mod_perl compiled into apache 1_3.17.
 
 I built it using APXS and I really have tried
 everything I can think of.
 
 It makes, and builds without a problem. When I try to
 do a configtest (after installing the new LoadModule
 and such into the httpd.conf file) I get this:
 
 % apachectl configtest
 Syntax error on line 207 of
 /usr/local/apache/conf/httpd.conf:
 Cannot load /usr/local/apache/libexec/libperl.so into
 server: File not found

the problem is likely that the dynamic linker cannot find a shared library
that was linked against modperl's libperl.so.  you can find out by using
bsdi's equivalent of strace or truss (to trace system calls) and look for
failed calls of open() for .so files.





Re: CONNECT proxy rewrite

2001-06-14 Thread Doug MacEachern

On Thu, 1 Mar 2001, Chris Lewis wrote:

 Does anybody know how to alter the destination of a CONNECT transaction
 (in this case secure proxy request) in mod_perl? 
 $r-uri(newplace:newport) in a Trans handler doesn't seem to do it.

mod_proxy uses the parsed_uri, try this:

use Apache::URI ();
$r-parsed_uri-hostname('newplace');
$r-parsed_uri-port('newport');
$r-uri('newplace:newport');
 




Re: /dev/null problems

2001-06-14 Thread Doug MacEachern

On 28 Mar 2001, Matthew Kennedy wrote:

 Hello,
 
 From the mod_perl guide:
 
   syntax error at /dev/null line 1, near line arguments:
   Execution of /dev/null aborted due to compilation errors.
   parse: Undefined error: 0
   There is a chance that your /dev/null device is broken. Try:
   % sudo echo  /dev/null
 
 This is exactly the problem I have been getting when starting Apache
 mod_perl, however the suggested fix does not work for me. We're on a
 HPUX 11 machine. Is there another way to solve this problem? As I
 understand it, if /dev/null is being used as the $0 argument to the
 handler, perhaps I could somehow explicitly set it to another (empty)
 file? How would I go about that?

you can use this patch.  -e0 used to be the default, but caused some
problems related to suexec or something.

--- src/modules/perl/mod_perl.c~Wed Jun 13 22:17:51 2001
+++ src/modules/perl/mod_perl.c Thu Jun 14 10:02:15 2001
@@ -670,7 +670,7 @@
 #ifdef WIN32
 argv[argc++] = nul;
 #else
-argv[argc++] = /dev/null;
+argv[argc++] = -e0;
 #endif
 
 MP_TRACE_g(fprintf(stderr, perl_parse args: ));





open2() write doesn't go anywhere

2001-06-14 Thread Ime Smits

Sorry if this is already somewhere in the faq or just plain stupid, but I
couldn't find any satisfying answer or workaround to this. When I do
something like:

--
use IPC::Open2;
...
 if($state-{pid} = open2(my $rx,my $tx,'/usr/bin/ispell','-S', '-a')) {
   $state-{header} = scalar $rx;
   ...
 }
...
--

Under modperl, I can see the other progam sending data back (checked Ispell,
but also did some diagnostics with others), but the mod_perl program seems
not able to send *anything* over the $tx descriptor to the other end. Tried
this with 1 MB of junk and a 'tee -a /tmp/anything' to see if this is a
buffering issue. The file is created by tee, but no data present on STDIN.
Funny thing is that the whole thing *is* working under regular perl 5.6.0.

In the list archives, about a year ago there was a similar discussion
betweeen Richard Timuss and Doug. At some point it was said that this was
addressed and fixed in cvs
(http://www.mail-archive.com/modperl@apache.org/msg05632.html).

Current setup is perl 5.6.0, Apache 1.3.20, mod_perl 1.25, but also tried
downgrading to apache 1.3.19, mod_perl 1.24, 1.24_01 and todays snapshot
(20010612). All with the same problem.

Any ideas where to start searching?

Thanks,

Ime



--

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.0, archname=i686-linux
uname='linux roambird 2.4.0 #22 wed jan 10 13:50:18 cet 2001 i686
unknown '
config_args=''
hint=previous, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
cc='gcc', optimize='-O3', gccversion=2.96 2731 (Red Hat Linux 7.0)
cppflags='-fno-strict-aliasing -I/www/include'
ccflags ='-fno-strict-aliasing -I/www/include'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='gcc', ldflags ='-L/www/lib'
libpth=/lib /usr/lib /www/lib
libs=-lnsl -lgdbm -ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/www/lib'


Characteristics of this binary (from libperl):
  Compile-time options:
  Built under linux
  Compiled at Jan 11 2001 12:30:24
  @INC:
/www/lib/perl




Questions Simple

2001-06-14 Thread Purcell, Scott

Hello,
I am on IIS and fighting ActiveStates .plex. It appears so buggy and flaky
that I am losing development time.

I want to try some code that is flaky on the IIS/perl .plex on the Apache
mod-perl.

I know I can download the apache web server in binary form and install it
pretty quickly. After that what would I have to do to get mod-perl running?
Is this a quick thing, or a long deal. Then I just want to take my clean
code and see how it works on that platform.

Is mod-perl just a perl module that I require in my scripts? Or is there a
lot of server configuration?

Please be honest and let me know,
Scott Purcell




Hello World Benchmark Suite, mod_cgi update

2001-06-14 Thread Joshua Chamas

Doug asked that I add some plain 'ol mod_cgi tests
to compare mod_perl to, so here you go!

hello]# ./bench.pl -time 10 CGI
Test Name   Test File  Hits/sec   Total Hits Total Time 
sec/Hits   Bytes/Hit  
-- -- -- -- 
-- -- 
Apache::Registry CGI Rawhello_raw.  591.6 5929 hits  10.02 sec  
0.001690   52 bytes   
Apache::Registry CGI.pm hello.cgi   406.2 4068 hits  10.02 sec  
0.002462   216 bytes  
mod_cgi CGI Raw hello_raw.  124.3 1243 hits  10.00 sec  
0.008046   196 bytes  
mod_cgi CGI.pm  hello.cgi 9.2 99 hits10.81 sec  
0.109242   216 bytes  
mod_speedycgi   hello.cgi   248.8 2500 hits  10.05 sec  
0.004019   216 bytes  

The benchmark suite as usual is at
  http://www.chamas.com/bench/hello.tar.gz

--Josh
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks - Web Link Checking  Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: Best way to attach a module to /

2001-06-14 Thread Ged Haywood

Hi there,

On Thu, 14 Jun 2001, Jamie Krasnoo wrote:

 What is the best way to attach a module to be run when a user first
 enters the site?

Can you be a bit more specific?

73,
Ged.




Setting the Server header in a response

2001-06-14 Thread Randy J. Ray

I'd like to append the ident string for my XML-RPC server class to the
outgoing Server: header, within my mod_perl handler. It seems that setting
this with $r-header_out (or getting the tied hash from $r-headers_out and
setting the key) doesn't appear in the resulting headers. Is there a
different API call I should be using?

Randy
--
---
Randy J. Ray | Buy a copy of a baby naming book and you'll never be at a
[EMAIL PROTECTED] | loss for variable names. Fred is a wonderful name, and easy
+1 408 543-9482  | to type. --Roedy Green, How To Write Unmaintainable Code



How To Turn On .pl files on Apache?

2001-06-14 Thread Purcell, Scott

Hello,
Rookie here.

Well I installed the Apache Web Server on my local NT box here and it runs.
I have gone through the FAQ's but cannot find out how to turn on .pl files
that are in the cgi-bin directory much less making other cgi-bin
directories.

Could some kind sole please assist me with getting this started.
PS I run activeState perl and it is on my C drive of the local machine where
the Apache server lives.



Thanks,

Scott Purcell




ssl encryption

2001-06-14 Thread Tim Gardner

When apache is serving a ssl connection, I assume that everything 
sent back and forth between the server and the client is encrypted. 
I want an mod_perl script to encrypt/decrypt credit card numbers 
obtained over the ssl connection for storage in a db on the server. 
Is there any access to the same routines that apache is using for the 
encryption or do I have to use some other module.  If I have to use 
another module, what would be a good choice?

Thanks,
Tim



Re: How To Turn On .pl files on Apache?

2001-06-14 Thread Ged Haywood

Hi there,

On Thu, 14 Jun 2001, Purcell, Scott wrote:

 Well I installed the Apache Web Server on my local NT box here and it runs.

Did you install mod_perl too?

73,
Ged.




Re: Best way to attach a module to /

2001-06-14 Thread Andrew Ho

Hello,

JKWhat is the best way to attach a module to be run when a user first
JKenters the site?

GEDCan you be a bit more specific?

I think the question is better phrased by the subject, how can I
use mod_perl to handle all requests?

This is less intuitive than the much more easily understandable how can I
use mod_perl to handle a request for a certain URL? In the latter case
you can use Apache::Registry (and associate it with LocationMatch or
FilesMatch or whatever) or an explicit handler. In the former case, it's
not as obvious.

One solution is to use a PerlTransHandler with a dispatch table in it. The
PerlTransHandler will be called on all requests, and you can inspect
$r-uri to see if you want to handle it. Return DECLINED if it's not
something you're interested in handling (say a /images URL); otherwise,
handle the request right away, internally redirect to another handler, or
just directly add the handlers you want down the chain.

Hope that helps--

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--




Re: Setting the Server header in a response

2001-06-14 Thread Matt Sergeant

On Thu, 14 Jun 2001, Randy J. Ray wrote:

 I'd like to append the ident string for my XML-RPC server class to the
 outgoing Server: header, within my mod_perl handler. It seems that setting
 this with $r-header_out (or getting the tied hash from $r-headers_out and
 setting the key) doesn't appear in the resulting headers. Is there a
 different API call I should be using?

I think Doug might be adding this to mod_perl 1.26. Until then you need to
use XS and call ap_add_version_component().

-- 
Matt/

/||** Founder and CTO  **  **   http://axkit.com/ **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
 \\//
 //\\
//  \\




Re: can not redirect on POST w/ CGI.pm

2001-06-14 Thread Rodney Broom

From: Doug MacEachern [EMAIL PROTECTED]
  I've found that if I post to this PerlAccessHandler, I get no response:
 this problem is fixed in 1.25, from Changes:
 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


  From: David Young [EMAIL PROTECTED]
DY What I am actually doing is extending the cookie-based access
DY control (TicketMaster) outlined in the Apache Modules book[1]. If the
DY  user attempts to access a restricted area and they don't have a cookie,
they
DY  are redirected to a login page (courtesy of an ErrorDocument 403). Upon
DY submission (POST) of the login page, if their credentials are good, they
are
DY redirected to their original destination.

OK, this makes sence. I just did something like this myself. I was
redirecting the user to change the URI that they saw in the browser, but
didn't want to loose POSTed data. Since you are using mod_perl, you can
catch STDIN inside of a handler with:
  $data = $STDIN

From there, I stored the data in a file and redirected the user. When the
user has all of the auth work finished and finally makes it back to the
right location, I read in the data from that file and assign to STDIN with:
  read(TEMP_FILE, $STDIN, (-s $temp_file))

This works fine, but you'll obviously need to jump through a few hoops.
Things like setting ENV{CONTENT-LENGTH} after reassigning $STDIN, and making
sure that you are giving the user their data and not somebody elses.

---
Rodney Broom
Programmer: Desert.Net






Re: ssl encryption

2001-06-14 Thread Mark Madsen


Apache uses OpenSSL to implement the transport encryption for HTTP
connections.  You can find out more at http://www.openssl.org

This isn't necessarily how you would want to encrypt things on disk, however.
Encrypting a regular file or db file is not really a typical public key
encryption task -- typically this is done by using a block cipher like
Blowfish and a single shared secret.  Information is available at:
http://www.counterpane.com/blowfish.html, and there are perl modules on CPAN
as Crypt::Blowfish.

Hope this helps.


 When apache is serving a ssl connection, I assume that everything
 sent back and forth between the server and the client is encrypted.
 I want an mod_perl script to encrypt/decrypt credit card numbers
 obtained over the ssl connection for storage in a db on the server.
 Is there any access to the same routines that apache is using for the
 encryption or do I have to use some other module.  If I have to use
 another module, what would be a good choice?

 Thanks,
 Tim


---
Mark Madsen   EMAIL: [EMAIL PROTECTED]
Internap Network ServicesOFFICE: 206.441.8800
601 Union Street, Suite 1000FAX: 206.264.1833
Seattle, WA  98101PAGER: 888.464.6381

* The contents of this message are proprietary and confidential *




Re: ssl encryption

2001-06-14 Thread Benjamin Trott

 When apache is serving a ssl connection, I assume that everything
 sent back and forth between the server and the client is encrypted.
 I want an mod_perl script to encrypt/decrypt credit card numbers
 obtained over the ssl connection for storage in a db on the server.
 Is there any access to the same routines that apache is using for the
 encryption or do I have to use some other module.  If I have to use
 another module, what would be a good choice?

You could use either an asymmetric cipher or a symmetric cipher.

An example of the former is Crypt::RSA (Crypt::DSA is another, but DSA is
used only for signing/verification, not for encryption/decryption).

A good, fast example of the latter is Crypt::Blowfish. Used together with
Crypt::CBC, you get Blowfish in CBC mode:

use Crypt::CBC;
my $cipher = Crypt::CBC-new('passphrase', 'Blowfish');
my $ciphertext = $cipher-encrypt('data');
my $plaintext = $cipher-decrypt($ciphertext);

In other words, you use the same passphrase to both encrypt and decrypt the
data (ie. symmetric).

Personally, I think I'd use a symmetric cipher, but the thing you have to be
careful of is leaving your passphrase around in plain text (eg. in a
script). Doing this negates many of the benefits of encrypting the data in
the first place. :) Sadly I'm not sure of the best answer to this dilemma.

bye,
Ben




Re: ssl encryption

2001-06-14 Thread Martin Redington


Not storing the credit card numbers at all would be the best option :-)

If you must, we've usually used crypt for one-way encryption, or 
Crypt::BlowFish for stuff we need to be able to decrypt (look after your 
key!).

On Thursday, June 14, 2001, at 09:54  pm, Tim Gardner wrote:

 When apache is serving a ssl connection, I assume that everything sent 
 back and forth between the server and the client is encrypted. I want 
 an mod_perl script to encrypt/decrypt credit card numbers obtained over 
 the ssl connection for storage in a db on the server. Is there any 
 access to the same routines that apache is using for the encryption or 
 do I have to use some other module.  If I have to use another module, 
 what would be a good choice?

 Thanks,
 Tim




Re: ChildInitHandler

2001-06-14 Thread Doug MacEachern

On 30 Mar 2001, Nikolaus Rath wrote:

 Hello!
 
 The following code doesn't work. I think that child_init_handler is
 never called. But there are no errors in the error log.
 
 sub child_init_handler($$)
 {
 my($this,$r) = @_;
 $r-log_error(Session Manager initialized);
 return OK;
 }
 
 sub child_exit_handler($$)
 {
 my($this,$r) = @_;
 $r-log_error(Session Manager initialized);
 ^^^

maybe you were expecting a different error message?
 
 PerlChildInitHandler  Apache::foo-child_init_handler()
 PerlChildExitHandler  Apache::foo-child_exit_handler()
   ^^ 
need to loose the parens, you should get an error for that.  i tried your
code, works fine, startup:
[Thu Jun 14 10:08:42 2001] [error] Session Manager initialized
kill -HUP:
[Thu Jun 14 10:08:43 2001] [error] Session Manager stopped





Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Doug MacEachern

On Wed, 25 Apr 2001, Philip Mak wrote:

 On Thu, 26 Apr 2001, Stas Bekman wrote:
 
   There is also the strange case of mod_perl leaking memory on graceful
   restarts when compiled as DSO.  But I don't feel like getting into
   this one quite yet.
 
 Hmm. My httpd was using 20 MB. I did apachectl graceful ten times, and
 the usage jumped to 24 MB. Then I did apachectl graceful another ten
 times, and the usage jumped to 29 MB.
 
 I guess that's the reason (or one of them) that my httpd grows bigger and
 bigger as time passes. My mod_perl is a DSO (I run two copies of httpd,
 one without mod_perl and one with; I set it up as a DSO since this way I
 only need one executable). Should I recompile it statically linked?

repeat
1.21_01 had two dso fixes, one to close all .so's opened by DynaLoader and
one to call perl_shutdown(), both of which were large leaks.  with
1.25_01-dev and Perl 5.6.1 i see a 4k growth on the first kill -USR1 and
no change after that.  what is your perl -V and mod_perl version?
/repeat

if people are seeing leaks on restart using Perl 5.005_03 i am not
surprised, 5.6.1 plugs a great many leaks.





Re: Tracking down taint problems

2001-06-14 Thread Doug MacEachern

On Tue, 24 Apr 2001, Jamie Krasnoo wrote:

 I recently got this error:
 
 Insecure dependency in eval while running with -T switch.
 Callback called exit.
 
 Now, yes that tells me that something is wrong. What it doesn't tell me is
 where the problem is except for the fact that its somewhere in the current
 module that's being run. Is there a way that I could get mod_perl to fess up
 where the problem is?

if you can reproduce at will, use gdb:
% gdb httpd
(gdb) source mod_perl-x.xx/.gdbinit
(gdb) b Perl_croak
(gdb) run -X
... run request that causes error ...
(gdb) where
... stack printed here ...
(gdb) curinfo
... perl filename:linenumber printed here ...





Re: ssl encryption

2001-06-14 Thread Kevin Schroeder

This would make an interesting discussion because I've had the same question
come up in my mind.  How do you encrypt things on your server without giving
out the passphrase?  Is it even possible to keep the key in the same
location as the program using it and still maintain security?

Kevin

- Original Message -
From: Benjamin Trott [EMAIL PROTECTED]
To: modperl [EMAIL PROTECTED]
Sent: Thursday, June 14, 2001 5:00 PM
Subject: Re: ssl encryption


  When apache is serving a ssl connection, I assume that everything
  sent back and forth between the server and the client is encrypted.
  I want an mod_perl script to encrypt/decrypt credit card numbers
  obtained over the ssl connection for storage in a db on the server.
  Is there any access to the same routines that apache is using for the
  encryption or do I have to use some other module.  If I have to use
  another module, what would be a good choice?

 You could use either an asymmetric cipher or a symmetric cipher.

 An example of the former is Crypt::RSA (Crypt::DSA is another, but DSA is
 used only for signing/verification, not for encryption/decryption).

 A good, fast example of the latter is Crypt::Blowfish. Used together with
 Crypt::CBC, you get Blowfish in CBC mode:

 use Crypt::CBC;
 my $cipher = Crypt::CBC-new('passphrase', 'Blowfish');
 my $ciphertext = $cipher-encrypt('data');
 my $plaintext = $cipher-decrypt($ciphertext);

 In other words, you use the same passphrase to both encrypt and decrypt
the
 data (ie. symmetric).

 Personally, I think I'd use a symmetric cipher, but the thing you have to
be
 careful of is leaving your passphrase around in plain text (eg. in a
 script). Doing this negates many of the benefits of encrypting the data in
 the first place. :) Sadly I'm not sure of the best answer to this dilemma.

 bye,
 Ben






Re: Questions Simple

2001-06-14 Thread Gunther Birznieks

It's pretty easy to get mod_perl running on Apache for windows because one 
of the list members regularly makes a full binary distro available of 
apache/mod_perl/perl all bundled together.

I think there is a link from the perl.apache.org homepage but I am not 
sure. I've set it up before several times in the last couple years and each 
time it seems to get easier (not because I am familiar with it, but because 
the install seems to get better/more intuitive).

At 12:25 PM 6/14/01 -0500, Purcell, Scott wrote:
Hello,
I am on IIS and fighting ActiveStates .plex. It appears so buggy and flaky
that I am losing development time.

I want to try some code that is flaky on the IIS/perl .plex on the Apache
mod-perl.

I know I can download the apache web server in binary form and install it
pretty quickly. After that what would I have to do to get mod-perl running?
Is this a quick thing, or a long deal. Then I just want to take my clean
code and see how it works on that platform.

Is mod-perl just a perl module that I require in my scripts? Or is there a
lot of server configuration?

Please be honest and let me know,
Scott Purcell

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




Re: crash on exit with -X

2001-06-14 Thread Doug MacEachern

On Wed, 9 May 2001, Greg Wilson wrote:

 Hi.  We're getting a segfault when httpd shuts down
 when using mod_perl on Red Hat 6.2, and I'd like to
 know whether anyone else has seen this as well. If I
 run httpd -X -f /home/gvwilson/httpd.conf under gdb,
 the stack trace is:

can you rebuild mod_perl with Makefile.PL PERL_DEBUG=1 ...
then set the MOD_PERL_TRACE enviornment variable to 'g' and post the
output of:
% grep 0x error_log

which should show us the .so's modperl is trying to close.






Re: Build problem (lperl)

2001-06-14 Thread Doug MacEachern

On Sun, 15 Apr 2001, Sean LeBlanc wrote:

 I'm trying to have mod_perl build apache during its own build,
 but I'm getting an error that I can't dig any answers up on. I have
 the libperl.so.5.6.0 in /usr/lib, but I'm uncertain how to get
 compiler to recognize that it is there. I ran ldconfig, but still
 no luck. 

% ln -s libperl.so.5.6.0 libperl.so

but you shouldn't need todo that and your libperl should not be in
/usr/lib

 -L/usr/lib/perl/5.6.0/CORE

this looks broken, there should be an architecture component to the path.
your perl -V might shed some light.





Re: sending a response without a Content-Type header

2001-06-14 Thread Doug MacEachern

On Mon, 16 Apr 2001, Matthew Darwin wrote:

 
 I'm buiding an HTTP gateway in mod_perl and trying to send back to the
 client exactly what I get from the remote server.  The remote server
 doesn't set a Content-Type on the document being returned, so I don't want
 to set one either.
 
 However, Mod_perl (or Apache), doesn't like it when I don't send a
 Content-type and seems to send a default of text/plain regardless.  I
 don't want this.  I don't want any Content-type at all.
 
 What I have now is sending mod_perl a Content-Type of ''.  This sends a
 blank Content-Type to the browser.  How can I avoid doing this?
... 
   $r-send_http_header;

roll your own version of send_http_header.  apache's send_http_header will
always send a content-type, part of being rfc compliant i guess.





RE: Tracking down taint problems

2001-06-14 Thread Rob Bloodgood

 if you can reproduce at will, use gdb:
 % gdb httpd
 (gdb) source mod_perl-x.xx/.gdbinit
 (gdb) b Perl_croak
 (gdb) run -X
  run request that causes error ...
 (gdb) where
  stack printed here ...
 (gdb) curinfo
  perl filename:linenumber printed here ...

OOOHH

Seriously, tho, do you think you could come up with a short list of
definitions for those macros?  I was pretty excited to see them, once,
except that I couldn't make them work. sigh  Even a comment w/ a usage:

AvFILL(address)

just to see what to feed the macro from gdb space?

Not like you have anything ELSE to do... (JUST KIDDING I can tell you've
been writing email *all day* by the posts that keep trickling into the
list).

L8r,
Rob




Re: Trying to trace a spinning httpd

2001-06-14 Thread Doug MacEachern

On 7 May 2001, Yusuf Goolamabbas wrote:

 Apache 1.3.19/Mod-perl 1.25 under Linux 2.2.19
 
 Hi, I am trying to better understand Apache/mod-perl behaviour under
 this scenario. I have some CGI's which connect to various servers
 listening on different ports and collect the output and push them to
 the clients. Whilst the data is streaming from the server to the CGI,
 I kill the server. After a few seconds, I see httpd take up increasing
 amount of CPU time [it can go up to 90% of CPU]. straceing the httpd
 process shows that it is continuously in a read call to the file
 descriptor representing the connection it was last in
 
 I ran httpd in single instance mode [httpd -X] and attached gdb to
 it. I sourced .gdbinit and typed curinfo
 This is what I get 
 
 (gdb) curinfo
 Attempt to extract a component of a value that is not a structure
 pointer.

what is your perl -V?
you might need to move up the stack first:
(gdb) up 7
(gdb) curinfo
 
 #8  0x80e574b in Perl_pp_readline ()

this would be the  operator, did you check the return value from
whatever you use to connect to the socket ?  what are you using to connect
to these various servers?










Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Philip Mak

On Thu, 14 Jun 2001, Doug MacEachern wrote:

 repeat
 1.21_01 had two dso fixes, one to close all .so's opened by DynaLoader and
 one to call perl_shutdown(), both of which were large leaks.  with
 1.25_01-dev and Perl 5.6.1 i see a 4k growth on the first kill -USR1 and
 no change after that.  what is your perl -V and mod_perl version?
 /repeat

 if people are seeing leaks on restart using Perl 5.005_03 i am not
 surprised, 5.6.1 plugs a great many leaks.

Perl 5.005_03, mod_perl 1.25.

I have since fixed the memory leak problem by recompiling mod_perl so that
it is statically linked to Apache instead of as a DSO.

-Philip Mak ([EMAIL PROTECTED])




Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Doug MacEachern

On Thu, 14 Jun 2001, Paul G. Weiss wrote:

 Sad to say, I'm not as fortunate as you.  I'm leaking ~4.4Mb which each
 HUP (I haven't tried USR1).  I'm also using Perl 5.6.1 and 1.25_01-dev
 (the CVS snapshot modperl_20010614113010.tar.gz).  I'm doing a PerlRequire
 if that is significant.
 
 One more thing - I'm building mod_perl using apxs.  I don't know if that
 makes a difference.

i am surprised to see, it does make a difference.  i built with:
perl Makefile.PL USE_DSO=1 EVERYTHING=1 - no leaks.
perl Makefile.PL USE_APXS=1 WITH_APXS=... EVERYTHING=1 - leaks.

i haven't looked into it yet.  can you try with USE_DSO=1 ?
if you're still leaking please post your 'perl -V' and the full list of
Makefile.PL options you're using.





Re: Getting unbuffered output from a subprocess

2001-06-14 Thread Doug MacEachern

On Tue, 27 Mar 2001, Andrew Ho wrote:

 Hello,
 
 So, when doing a CGI and needing to execute a subprocess with input based
 on user input, I always do a open()-fork()-exec() like so:
... 
 When using a mod_perl script, I use Apache::SubProcess and the above
 stuff still works. However, let's say the subprocess I kicked off takes a
 while to process, but prints status information in the meantime (for
 example, tagging a big CVS tree, or indexing textfiles, or whatnot). I
 want the user to see the information real-time (so I'd probably have
 local $| = 1 inside the if($pid) block above).
 
 This no longer works under Apache::SubProcess. Tt buffers up all the
 output and then sends it all at once. So my parent process reads in an
 unbuffered way, but the child exec() outputs all at once.

can you post a small test case using Apache::SubProcess?  that'll make it
easier to see whats going on.




RE: Tracking down taint problems

2001-06-14 Thread Doug MacEachern

On Thu, 14 Jun 2001, Rob Bloodgood wrote:
 
 Seriously, tho, do you think you could come up with a short list of
 definitions for those macros?  I was pretty excited to see them, once,
 except that I couldn't make them work. sigh  Even a comment w/ a usage:
 
 AvFILL(address)

most of them (the C macros) are documented in Perl's perlapi.pod
the gdb macros are just the cpp expanded versions of the C macros, not
including some of the homebrewed ones like curinfo.





Re: Finding AuthUserFile name with the request object.

2001-06-14 Thread Doug MacEachern

On Sat, 5 May 2001, Rodney Broom wrote:

 Hi all,
 
 I'm trying to add a little bit more security to a running app. In this app, I'd
 like to be able to confirm what physical file was used in the 'AuthUserFile
 /path/to/pass.db' statement. This file choice needs to be dynamic, so I can't
 simply hard wire this info.

this has been asked a bunch of times in the past and normally i say
mod_auth's structures are private to mod_auth.c, which is still true,
but the structure is small and unlikely to change for 1.3.x, we can just
copy-n-paste it.  so here's a little module to access AuthUserFile,
AuthGroupFile and AuthAuthoritative config, see the mod_auth_example
script for usage:

http://perl.apache.org/~dougm/Apache-ModAuthConfig-0.01.tar.gz




RE: NameWithVirtualHost

2001-06-14 Thread Doug MacEachern

On Thu, 17 May 2001, Geoffrey Young wrote:
 
 well, you're not using Apache::Registry (which uses the
 $Apache::Registry::NameWithVirtualHost global)
 but Apache::RegistryNG (for which there's no corresponding
 $Apache::RegistryNG::NameWithVirtualHost :)

he used Apache::RegistryNG in the startup.pl, but we didn't see
httpd.conf, which i'm guessing is configured to use Apache::Registry,
because..

 I haven't used RegistryNG at all, so I don't know the benefits of it over
 Registry (someone might) but I suspect that you
 will get the namespace isolation you desire if you move to Apache::Registry
 instead.

Apache::RegistryNG actually uses $r-filename instead of $r-uri so it
should have namespace protection.





Re: Getting the wrong URL

2001-06-14 Thread Doug MacEachern

On 1 Jun 2001, [EMAIL PROTECTED] wrote:

 OK, I think I have solved this problem, but I would like to run my solution by
 you folks, and see if it makes any sense. What we found, on a more thorough
 code review, was that a number of the handlers were doing a redirect by calling
 send_cgi_header, and then exit()'ing. It seemed to us that the exit would kill
 the Perl interp, and the Apache child would then just keep serving whatever it
 had in its buffer at the time. Does that make any sense? If so, will die() have
 the same results? I started grepping for exit everywhere, and removed it, but
 along the way I saw a number of places that we're calling die.

i'm missing the original message, but if you can post a small test case,
along with results and expected results, we can look into it.




Re: PerlSetEnv scoping (again)

2001-06-14 Thread Doug MacEachern

i will add this to the ToDo to look at before 1.26.  in the meantime, if
you don't need to access these variables before the fixup stage and don't
need %ENV to be inherited by a forked program, try changing PerlSetEnv to
SetEnv.

On Sat, 2 Jun 2001, Roman Maeder wrote:

 back in 1998 and 99 there was a longer discussion about scoping problems
 with PerlSetEnv (inside httpd.conf and .htaccess files), which ended
 with fixes applied to mod_perl-1.20, which is the version I have been
 using (along with apache-1.3.6 and perl 5.00404)
 
 Now I am setting up a brand new machine to replace my aging web server
 and compiled Perl 5.6.1, apache_1.3.20, and mod_perl-1.25 (Solaris 8)
 and the old problem is back, only worse. This is so severe I can't
 imagine it happening in all configurations out there, but here is
 what I found.
 
 Summary:
 
 1 a variable defined with PerlSetEnv in the main server (outside any
   virtual hosts) cannot be changed inside a virtual host section (the
   change is ignored)
 
 2 a variable defined inside a virtual host section is visible to all
   *other* virtual hosts and the main server
 
 3 a variable defined in httpd.conf cannot be changed inside a .htaccess
   file (the change is ignored)
 
 
 I set up my Apache with a minimal httpd.conf and two IP-based
 virtual hosts (besides the main server), configured like this
 (plus the necessary AllowOverride All, etc.; see attached file)
 
 # main server
 
 DocumentRoot /www/test/root
 
 PerlSetEnv VarA Global
 PerlSetEnv VarB Global
 
 
 # virthost 1
 
 VirtualHost IP1
 DocumentRoot /www/test/root1
 
 PerlSetEnv VarA VirtHost1
 PerlSetEnv VarC VirtHost1
 
 /VirtualHost
 
 
 # virthost 2
 
 VirtualHost IP2
 DocumentRoot /www/test/root2
 
 PerlSetEnv VarA VirtHost2
 
 /VirtualHost
 
 
 additionally, /www/test/root2 contains this .htaccess file
 
 PerlSetEnv VarB root2
 PerlSetEnv VarD root2
 
 
 Using a Apache::Registry script to print the enviroment in all three
 servers (main and the two virtual hosts), I get these values
 
 Var   mainvirthost1   virthost2
 
 VarA  Global  Global* Global*
 VarB  Global  Global  Global*
 VarC  VirtHost1*  VirtHost1   VirtHost1*
 VarD  -   -   root2
 
 the entries with the * are wrong, I think.
 
 Has anyone seen something like this before?
 
 
 Regards,
 
 Roman Maeder
 
 




Re: errors installing Apache 1.3.19/mod_perl 1.25 on RedHat 6.1

2001-06-14 Thread Doug MacEachern

On Tue, 10 Apr 2001, Jonathan Swartz wrote:

 % ./configure --activate-module=src/modules/perl/libperl.a
...
 %Config is not exported by the Apache::ExtUtils module at -e line 0

this is a bug.  newer mod_perl's override %Config::Config using
Apache::ExtUtils, which when you build inside the mod_perl-1.xx tree is
found ok, but inside the apache tree the build is picking up your older
Apache::ExtUtils.  you can bandaid by setting the PERL5LIB environment
variable inside the apache_1.3.19 tree to: `pwd`/../mod_perl-1.25/lib




Re: Resetting STDIN after r-read

2001-06-14 Thread Doug MacEachern

On Fri, 8 Jun 2001, Rodney Broom wrote:

 OK, here's what the solution was. According to Doug in a posting that I
 found in an archive search, mod_perl's STDIN is really just a Perl glob, and
 not a file handle. So instead of reading from it (and thereby emptying the
 file handle named STDIN so that CGI and other things can't get this data),
 now I simply assign from it:

*{STDIN} is a Perl glob.  STDIN is a Perl IO 'handle', which is normally
used to access C's stdio stdin FILE pointer.  under mod_perl, the STDIN
handle is tied to the  Apache request_rec, rather than stdio stdin. 

i never said anything about using the $STDIN scalar.  $STDIN is just like
any other global variable, except that it aliased to $main::STDIN no
matter what package you reference it from.  $STDIN != STDIN
 
   if ($first_pass) {
 print TEMP_FILE, $STDIN;

this will only work if you first read(STDIN, $STDIN, $content_length);
otherwise, you're getting the global value from the previous request,
since $STDIN is not reset.  and again is no different from using a global
such as $Foo::PostData, other than the aliasing mentioned above.





Re: Make Test problems...

2001-06-14 Thread Doug MacEachern

On Sun, 10 Jun 2001, Ian (the webguy) wrote:
... 
 I'm not sure what's causing this.  When I telnet to port 8529 and try to get
 /test.html, I get
 snip
 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN
 HTMLHEAD
 TITLE403 Forbidden/TITLE

this is a bug in the test suite, permissions problem if you 'make' as
root.  if you can 'perl Makefile.PL ...  make' as another user and 
'make install' as root the test should work fine.





Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Doug MacEachern

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.




DSO mod_perl HUP memory leak

2001-06-14 Thread Paul G. Weiss

I know that this is an ongoing problem, but I seem to remember that
someone somewhere had a patch that reduced the size of the memory leak on
restarts to a manageable size.  Has this patch been applied to the CVS
version?  If not, can some kind soul tell me where to find it?  I've
looked around the net in vain.

-Paul Weiss
-Arity Corp






Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Paul G. Weiss

Sad to say, I'm not as fortunate as you.  I'm leaking ~4.4Mb which each
HUP (I haven't tried USR1).  I'm also using Perl 5.6.1 and 1.25_01-dev
(the CVS snapshot modperl_20010614113010.tar.gz).  I'm doing a PerlRequire
if that is significant.

One more thing - I'm building mod_perl using apxs.  I don't know if that
makes a difference.

-Paul


On Thu, 14 Jun 2001, Doug MacEachern wrote:

 On Wed, 25 Apr 2001, Philip Mak wrote:
 
  On Thu, 26 Apr 2001, Stas Bekman wrote:
  
There is also the strange case of mod_perl leaking memory on graceful
restarts when compiled as DSO.  But I don't feel like getting into
this one quite yet.
  
  Hmm. My httpd was using 20 MB. I did apachectl graceful ten times, and
  the usage jumped to 24 MB. Then I did apachectl graceful another ten
  times, and the usage jumped to 29 MB.
  
  I guess that's the reason (or one of them) that my httpd grows bigger and
  bigger as time passes. My mod_perl is a DSO (I run two copies of httpd,
  one without mod_perl and one with; I set it up as a DSO since this way I
  only need one executable). Should I recompile it statically linked?
 
 repeat
 1.21_01 had two dso fixes, one to close all .so's opened by DynaLoader and
 one to call perl_shutdown(), both of which were large leaks.  with
 1.25_01-dev and Perl 5.6.1 i see a 4k growth on the first kill -USR1 and
 no change after that.  what is your perl -V and mod_perl version?
 /repeat
 
 if people are seeing leaks on restart using Perl 5.005_03 i am not
 surprised, 5.6.1 plugs a great many leaks.
 
 




Re: mod_perl DSO leaking on restart?

2001-06-14 Thread Paul G. Weiss

Still leaking I'm afraid, by roughly the same amount.
I'm posting the files you asked for.  Perhaps it has something to do with
the fact that both the Perl and Apache are installed in non-standard
places, or that I'm also using mod_ssl.

Here goes:

perl -V:

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris
uname='sunos us2 5.7 generic_106541-12 sun4u sparc
sunw,ultrasparc-iii-engine '
config_args='-e -Ubincompat5005
-Dprefix=/vol1/home/tecadmin/envs/env_nothreads -Doptimize=-O -g -Dcc=gcc
-U
installusrbinperl -Dloclibpth=/vol1/home/tecadmin/envs/env_nothreads/lib
/usr/local/lib -Dlocincpth=/vol1/home/t
ecadmin/envs/env_nothreads/include /usr/local/include -ds'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
cc='gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing
-I/vol1/home/tecadmin/envs/env_nothreads/include -I/usr
/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O -g',
cppflags='-DDEBUGGING -fno-strict-aliasing
-I/vol1/home/tecadmin/envs/env_nothreads/include -I/usr/local/inc
lude'
ccversion='', gccversion='2.95.2 19991024 (release)',
gccosandvers='solaris2.7'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/vol1/home/tecadmin/envs/env_nothreads/lib
-L/usr/local/lib '
libpth=/vol1/home/tecadmin/envs/env_nothreads/lib /usr/local/lib
/usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G
-L/vol1/home/tecadmin/envs/env_nothreads/lib -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING USE_LARGE_FILES
  Built under solaris
  Compiled at Jun 13 2001 12:52:50
  %ENV:
PERL5LIB=/vol1/home/pweiss/perllib
  @INC:
/vol1/home/pweiss/perllib
/vol1/home/tecadmin/envs/env_nothreads/lib/perl5/5.6.1/sun4-solaris
/vol1/home/tecadmin/envs/env_nothreads/lib/perl5/5.6.1
/vol1/home/tecadmin/envs/env_nothreads/lib/perl5/site_perl/5.6.1/sun4-solaris
/vol1/home/tecadmin/envs/env_nothreads/lib/perl5/site_perl/5.6.1
/vol1/home/tecadmin/envs/env_nothreads/lib/perl5/site_perl
.

Here is how I do Makefile.PL:

LIBS_SHLIB=$(gcc -print-libgcc-file-name) CFLAGS='-O -g' \
  perl Makefile.PL SSL_BASE=/vol1/home/tecadmin/envs/env_nothreads \ 
  USE_APACI=1 USE_DSO=1 EVERYTHING=1 \
  APACHE_PREFIX=/vol1/home/tecadmin/envs/env_nothreads/apache \
  APACHE_SOURCE=../apache_1.3.19 \
  APACI_ARGS='--enable-module=all --enable-shared=max' DO_HTTPD=1

-Paul

P.S.  By the way, the CFLAGS='-O -g' appears to have no affect at all.  I
can't seem to get Apache compiled with symbols.



On Thu, 14 Jun 2001, Doug MacEachern wrote:

 On Thu, 14 Jun 2001, Paul G. Weiss wrote:
 
  Sad to say, I'm not as fortunate as you.  I'm leaking ~4.4Mb which each
  HUP (I haven't tried USR1).  I'm also using Perl 5.6.1 and 1.25_01-dev
  (the CVS snapshot modperl_20010614113010.tar.gz).  I'm doing a PerlRequire
  if that is significant.
  
  One more thing - I'm building mod_perl using apxs.  I don't know if that
  makes a difference.
 
 i am surprised to see, it does make a difference.  i built with:
 perl Makefile.PL USE_DSO=1 EVERYTHING=1 - no leaks.
 perl Makefile.PL USE_APXS=1 WITH_APXS=... EVERYTHING=1 - leaks.
 
 i haven't looked into it yet.  can you try with USE_DSO=1 ?
 if you're still leaking please post your 'perl -V' and the full list of
 Makefile.PL options you're using.
 
 




Re: DSO mod_perl HUP memory leak

2001-06-14 Thread Doug MacEachern

On Thu, 14 Jun 2001, Paul G. Weiss wrote:

 I know that this is an ongoing problem, but I seem to remember that
 someone somewhere had a patch that reduced the size of the memory leak on
 restarts to a manageable size.  Has this patch been applied to the CVS
 version?  If not, can some kind soul tell me where to find it?  I've
 looked around the net in vain.

1.21_01 had two dso fixes, one to close all .so's opened by DynaLoader and
one to call perl_shutdown(), both of which were large leaks.  with
1.25_01-dev and Perl 5.6.1 i see a 4k growth on the first kill -USR1 and
no change after that.  what is your perl -V and mod_perl version?




cvs commit: modperl ToDo

2001-06-14 Thread dougm

dougm   01/06/14 09:15:01

  Modified:.ToDo
  Log:
  catigorification
  
  Revision  ChangesPath
  1.283 +54 -46modperl/ToDo
  
  Index: ToDo
  ===
  RCS file: /home/cvs/modperl/ToDo,v
  retrieving revision 1.282
  retrieving revision 1.283
  diff -u -r1.282 -r1.283
  --- ToDo  2001/06/14 06:01:39 1.282
  +++ ToDo  2001/06/14 16:14:58 1.283
  @@ -3,92 +3,100 @@
(well, close to it anyhow)
   ---
   
  +... core bugs ...
  +
   - readdir() broken with glibc 2.2
   
   - PERL5LIB foo
   
  -- From: Dave Rolsky [EMAIL PROTECTED]
  -  Subject: Apache::test patch
  -
  -- From: Joshua Chamas [EMAIL PROTECTED]
  -  Subject: Apache::SizeLimit patches
  -
   - 1.25 Apache::ExtUtils fix broke elsewhere
   
  -- 1.25 change did not work for:
  -  From: Wenzhong Tang [EMAIL PROTECTED]
  -  Subject: RE: Prototype mismatch in Apache::PerlRun line 343
  -
   - warn() going to the wrong log?
   
  -- rid Apache-can_stack_handlers, make Apache-can('push_handlers') work
  +- From: Andy Wardley [EMAIL PROTECTED]
  +  Subject: Problems with SERVER_MERGE and DIR_MERGE
   
  -- 'make test' as root permissions problems
  +- $r-args parsing of one=two=2
   
  -- USE_APXS=1 + DYNAMIC=1 do not work together
  +- From: Adi Fairbank [EMAIL PROTECTED]
  +  Subject: Re: two identical directives in Perl configuration
   
  -- support SSL_BASE=SYSTEM (i.e. test -d $SSL_BASE in Makefile.PL)
  +- segfaults with DBI-connect (mysql), reported that downgrade to
  +  1.21_03 cures
   
  -- re-enabled unsigned short-ness test for $s-port in t/net/perl/api.pl
  +- need to revisit send_http_header and r-status again, patch to
  +revert to old behavior from [Julian Gilbey [EMAIL PROTECTED]]
   
  -- From: Andy Wardley [EMAIL PROTECTED]
  -  Subject: Problems with SERVER_MERGE and DIR_MERGE
  +- revisit DSO restart leakage
   
  -- hooking up PL_check (-c) to ap_configtest_only
  +... core enhancements ...
  +
  +- PerlChildInitHandler should not be allowed inside VirtualHost
   
  +- rid Apache-can_stack_handlers, make Apache-can('push_handlers') work
  +
   - fileno(STD{IN,OUT}) should be r-connection-client-fd or
 fileno(std{in,out}), rather than hardcoded fileno(stdout)
   
  -- consider making PERL_USELARGEFILES=0 by default
  +- close STDERR;
   
  -- $r-args parsing of one=two=2
  +- {get,set}_handlers troubles [Geoffrey Young [EMAIL PROTECTED]]
  +  see also: http://perl.apache.org/~dougm/set_handlers.pat
   
  -- From: JR Mayberry [EMAIL PROTECTED]
  -  Subject: Apache::Status problems?..CGI::Cookie, (dont want no CGI.pm) (?)
  +... modules ...
   
  -- From: Adi Fairbank [EMAIL PROTECTED]
  -  Subject: Re: two identical directives in Perl configuration
  +- 1.25 change did not work for:
  +  From: Wenzhong Tang [EMAIL PROTECTED]
  +  Subject: RE: Prototype mismatch in Apache::PerlRun line 343
   
  -- PerlChildInitHandler should not be allowed inside VirtualHost
  +- Apache::FakeRequest improvments [Gary Richardson [EMAIL PROTECTED]]
   
  -- close STDERR;
  +- Apache::StatINC patch [Ilya Konstantinov [EMAIL PROTECTED]]
   
  -- require +ExecCGI for Perl in .htaccess, etc.
  +- From: Dave Rolsky [EMAIL PROTECTED]
  +  Subject: Apache::test patch
   
  -- {get,set}_handlers troubles [Geoffrey Young [EMAIL PROTECTED]]
  -  see also: http://perl.apache.org/~dougm/set_handlers.pat
  +- From: Joshua Chamas [EMAIL PROTECTED]
  +  Subject: Apache::SizeLimit patches
   
  -- remove eg/ directory, it's way out of date and no longer needed now
  -  with the guide, the books, and piles of Apache::* modules
  +- IPC::Open3 no workie
   
  -- document Apache::Status Apache::Request preference over CGI.pm
  -  and make it more clear that Apache::Status should not be used in a
  -  production environment, as it adds quite a bit of bloat
  +- From: JR Mayberry [EMAIL PROTECTED]
  +  Subject: Apache::Status problems?..CGI::Cookie, (dont want no CGI.pm) (?)
   
  -- segfaults with DBI-connect (mysql), reported that downgrade to
  -  1.21_03 cures
  +... build items ...
   
  -- disable PERL_SSI unless mod_include is listed in httpd -l
  -  and Action unless mod_action, etc.
  +- xsubpp -nolinenumbers is not supported with 5.004
   
  -- docs: update CREDITS, cleanup install docs
  +- 'make test' as root permissions problems
   
  -- Apache::FakeRequest improvments [Gary Richardson [EMAIL PROTECTED]]
  +- USE_APXS=1 + DYNAMIC=1 do not work together
   
  -- Apache::StatINC patch [Ilya Konstantinov [EMAIL PROTECTED]]
  +- support SSL_BASE=SYSTEM (i.e. test -d $SSL_BASE in Makefile.PL)
   
  -- need to revisit send_http_header and r-status again, patch to
  -revert to old behavior from [Julian Gilbey [EMAIL PROTECTED]]
  +- disable PERL_SSI unless mod_include is listed in httpd -l
  +  and Action unless mod_action, etc.
   
  -- IPC::Open3 no workie
  +... 

cvs commit: modperl/lib/Apache StatINC.pm

2001-06-14 Thread dougm

dougm   01/06/14 09:38:27

  Modified:.Changes ToDo
   lib/Apache StatINC.pm
  Log:
  make sure file to be reloaded can be found in @INC
  
  Revision  ChangesPath
  1.599 +4 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.598
  retrieving revision 1.599
  diff -u -r1.598 -r1.599
  --- Changes   2001/06/14 05:26:27 1.598
  +++ Changes   2001/06/14 16:38:15 1.599
  @@ -10,6 +10,10 @@
   
   =item 1.25_01-dev
   
  +make sure file to be reloaded can be found in @INC, adjusting based on
  +%INC value if needed
  +[Ilya Konstantinov [EMAIL PROTECTED]]
  +
   croak if the filehandle passed to $r-send_fd is NULL, otherwise
   apache will segfault
   
  
  
  
  1.284 +0 -2  modperl/ToDo
  
  Index: ToDo
  ===
  RCS file: /home/cvs/modperl/ToDo,v
  retrieving revision 1.283
  retrieving revision 1.284
  diff -u -r1.283 -r1.284
  --- ToDo  2001/06/14 16:14:58 1.283
  +++ ToDo  2001/06/14 16:38:18 1.284
  @@ -51,8 +51,6 @@
   
   - Apache::FakeRequest improvments [Gary Richardson [EMAIL PROTECTED]]
   
  -- Apache::StatINC patch [Ilya Konstantinov [EMAIL PROTECTED]]
  -
   - From: Dave Rolsky [EMAIL PROTECTED]
 Subject: Apache::test patch
   
  
  
  
  1.15  +26 -4 modperl/lib/Apache/StatINC.pm
  
  Index: StatINC.pm
  ===
  RCS file: /home/cvs/modperl/lib/Apache/StatINC.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StatINC.pm2000/03/07 02:50:38 1.14
  +++ StatINC.pm2001/06/14 16:38:24 1.15
  @@ -11,7 +11,7 @@
   $r-dir_config(UndefOnReload)) || '') eq on);
   my $DEBUG = ref($r)  (lc($r-dir_config(StatINCDebug) || '') eq on);
   $DEBUG = $r-dir_config(StatINC_Debug) if ref($r)  
$r-dir_config(StatINC_Debug);
  -
  +
   while(my($key,$file) = each %INC) {
local $^W = 0;
my $mtime = (stat $file)[9];
  @@ -20,16 +20,38 @@
unless(defined $Stat{$file}) { 
$Stat{$file} = $^T;
}
  +# if modified, reload the module
if($mtime  $Stat{$file}) {
  + # make sure file's prefix is in @INC
  + my $found_in_inc;
  + for (@INC) {
  +if(index($file,$_) == 0) {
  +   $found_in_inc = 1;
  +   last;
  +}
  + }
  +
  +if(!$found_in_inc) {
  +   my $inc_dir = substr($file, 0, length($file)-length($key)-1);
  +   push @INC, $inc_dir;
  +warn Apache::StatINC: process $$ adding $inc_dir to \@INC\n
  +   if $DEBUG  0;
  +}
  +
if($do_undef and $key =~ /\.pm$/) {
require Apache::Symbol;
my $class = Apache::Symbol::file2class($key);
$class-Apache::Symbol::undef_functions( undef, 1 );
}
delete $INC{$key};
  - require $key;
  - warn Apache::StatINC: process $$ reloading $key\n
  - if $DEBUG  0;
  + eval{ require $key };
  + if ($@) {
  +   warn Apache::StatINC: process $$ failed to reload $key. $@
  +  if $DEBUG  0;
  + } else {
  +warn Apache::StatINC: process $$ reloading $key.\n
  +  if $DEBUG  0;
  +}
}
$Stat{$file} = $mtime;
   }
  
  
  



cvs commit: modperl ToDo

2001-06-14 Thread dougm

dougm   01/06/14 23:10:16

  Modified:.ToDo
  Log:
  yawn
  
  Revision  ChangesPath
  1.285 +13 -1 modperl/ToDo
  
  Index: ToDo
  ===
  RCS file: /home/cvs/modperl/ToDo,v
  retrieving revision 1.284
  retrieving revision 1.285
  diff -u -r1.284 -r1.285
  --- ToDo  2001/06/14 16:38:18 1.284
  +++ ToDo  2001/06/15 06:10:15 1.285
  @@ -27,10 +27,18 @@
   - need to revisit send_http_header and r-status again, patch to
   revert to old behavior from [Julian Gilbey [EMAIL PROTECTED]]
   
  -- revisit DSO restart leakage
  +- revisit DSO restart leakage (seems ok with USE_DSO=1, USE_APXS leaks)
   
  +- Apache-server-register_cleanup
  +
  +- PerlSetEnv scoping [Roman Maeder [EMAIL PROTECTED]]
  +
  +- %LocationMatch Perl bug [Michael J Schout [EMAIL PROTECTED]]
  +
   ... core enhancements ...
   
  +- option to startup with something other than /dev/null
  +
   - PerlChildInitHandler should not be allowed inside VirtualHost
   
   - rid Apache-can_stack_handlers, make Apache-can('push_handlers') work
  @@ -74,6 +82,10 @@
   
   - disable PERL_SSI unless mod_include is listed in httpd -l
 and Action unless mod_action, etc.
  +
  +- Mac OS X
  +
  +- perl -MApache::ExtUtils=%Config does not work inside the apache tree
   
   ... docs ...