[PATCH] [phil@fifi.org: Bug#86964: One more method ( patch) for libapache-mod-perl]

2001-03-05 Thread Daniel Jacobowitz

Here's another reasonable-looking patch from Philippe Troin; it exposes
child_num() in Apache::Connection.

-- 
Daniel Jacobowitz   Debian GNU/Linux Developer
Monta Vista Software  Debian Security Team
 "I am croutons!"



Package: libapache-mod-perl
Version: 1.25-2
Severity: wishlist

Included is more more patchlet to libapache-mod-perl.

It adds the child_num() method to the Apache::Connection class.

Why ?

  - The Apache C API has it, why not the perl API ?

  - You can do some cool stuff with it... I've used it as an index to
a pseudo-scoreboard which forbids the same IP address to download
the same file with two or more connection (that is bounce the
download managers which were saturating my Apache server with
multiple non-overlapping requests to the same file "to speed-up
downloads").

It's a trivial patch. Please forward upstream.

Phil.



diff -ruN libapache-mod-perl-1.25.maint/Apache/Apache.pm libapache-mod-perl-1.25/Apache/Apache.pm
--- libapache-mod-perl-1.25.maint/Apache/Apache.pm	Thu Feb 22 01:01:58 2001
+++ libapache-mod-perl-1.25/Apache/Apache.pm	Thu Feb 22 01:02:13 2001
@@ -567,6 +567,10 @@
 This can be used to detect client disconnect without doing any I/O,
 e.g. using IO::Select.
 
+=item $c-child_num
+
+Returns which child number (or "slot") handles the connection.
+
 =back
 
 =back
diff -ruN libapache-mod-perl-1.25.maint/src/modules/perl/Connection.xs libapache-mod-perl-1.25/src/modules/perl/Connection.xs
--- libapache-mod-perl-1.25.maint/src/modules/perl/Connection.xs	Fri Sep 29 07:41:30 2000
+++ libapache-mod-perl-1.25/src/modules/perl/Connection.xs	Thu Feb 22 01:02:13 2001
@@ -157,6 +157,16 @@
 OUTPUT:
 RETVAL
 
+int
+child_num(conn)
+Apache::Connection	conn
+
+CODE:
+RETVAL = conn-child_num;
+
+OUTPUT:
+RETVAL
+
 char *
 auth_type(conn, ...)
 Apache::Connection	conn




Re: [PATCH] [phil@fifi.org: Bug#86964: One more method ( patch)for libapache-mod-perl]

2001-03-05 Thread Stas Bekman



 Here's another reasonable-looking patch from Philippe Troin; it exposes
 child_num() in Apache::Connection.

Apache::Scoreboard has all the scoreboard related methods.

I use it in Apache::VMonitor and Apache::Watchdog::RunAway.

_
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://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: mod_perl shared memory with MM

2001-03-05 Thread Alexander Farber (EED)

Adi Fairbank wrote:
 Yeah, I was thinking about something like that at first, but I've never played
 with named pipes, and it didn't sound too safe after reading the perlipc man
 page.  What do you use, Perl open() calls, IPC::Open2/3, IPC::ChildSafe, or

IPC:ChildSafe is a good module, I use it here to access ClearCase, but 
it probably won't help you to exchange any data between Apache children



Apache, mod_perl, mysql, php segfault!

2001-03-05 Thread Michael Turley

Hello, anyone come across a problem where they get 
"exit signal Segmentation fault (11)" when they try to
connect to mysql via mod_perl?

I am getting it even on simple connect and disconnect
- I can access Oracle via mod_perl. Neither standard
standalone scripts or php have problems communicating
to mysql.I heard something that there could be some
sort of static linking problem with mysql when apache
has both php and mod_perl modules activated. Any ideas
would be greatly appreciated as I am stumped.

I am using apache 1.3.12, mod_perl 1.25, php 4.0.3pl1
and mysql 3.23.33

from mydbi trace log: 

DBI 1.14-nothread dispatch trace level set to 4
Note: perl is running without the recommended perl
-w option
- DBI-connect(DBI:mysql:test;host=localhost,
root, )
- DBI-install_driver(mysql) for perl=5.00503
pid=27862 ruid=99 euid=99
   install_driver: DBD::mysql loaded (version
2.0415)
New DBI::dr (for DBD::mysql::dr, parent=, id=)
   
dbih_setup_handle(DBI::dr=HASH(0x8459418)=DBI::dr=HASH(0x83dbbc8),
DBD::mysql::dr, 0, Null!)
dbih_make_com(Null!, DBD::mysql::dr, 84)
- install_driver= DBI::dr=HASH(0x8459418)
- connect for DBD::mysql::dr
(DBI::dr=HASH(0x8459418)~0x83dbbc8
'test;host=localhost' 'root'  HASH(0x8432474))
New DBI::db (for DBD::mysql::db,
parent=DBI::dr=HASH(0x83dbbc8), id=HASH(0x84329c8))
   
dbih_setup_handle(DBI::db=HASH(0x82a83c8)=DBI::db=HASH(0x836db54),
DBD::mysql::db, 82c3a10, HASH(0x84329c8))
dbih_make_com(DBI::dr=HASH(0x83dbbc8),
DBD::mysql::db, 520)

=
Mr. Michael Turley
Gracious winner, Generous lover, All round great guy.

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



RE: push_handlers question

2001-03-05 Thread Geoffrey Young

 -Original Message-
 From: Mike Cameron [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, March 04, 2001 11:59 PM
 Cc: modperl
 Subject: push_handlers question
 
 
 I am trying to sub class Apache::AuthCookieURL and would like to use
 $r-push_handlers(PerlAuthenHandler = My::Class-authenticate);
 the push_handler is set in a handler called from httpd.conf on the
 PerlInitHandler phase but the authenticate routine does not 
 seem to be getting
 the apache request object passed to it as I get a can't call 
 dir_config on an
 udefined value error.

my $r = Apache-request;

HTH

--Geoff

 
 I'm sure I am missing something simple but can someone point 
 it out to me.
 
 Thanks
 



[DIGEST] mod_perl digest 03/03/01

2001-03-05 Thread Geoffrey Young

--

  mod_perl digest
 
   February 25, 2001 - March 3, 2001

--

Recent happenings in the mod_perl world...


Features

  o mod_perl status
  o module announcements
  o mailing list highlights
  o links


mod_perl status

  o mod_perl
- stable: 1.25 (released January 29, 2001) [1]
- development: 1.25_01-dev [2]
  o Apache
- stable: 1.3.19 (released February 28, 2001) [3]
- development: 1.3.20-dev [4]
  o Perl
- stable: 5.6 (released March 23, 2000) [5]
- development: 5.7 [6]


module announcements

  o Apache-AuthzCache 0.04 - work with a mod_perl authorization
module to provide caching of group membership [7]

  o Apache-ProxyRewrite 0.12 - a reverse-proxy that will rewrite URLs
embedded in HTML documents [8]


mailing list highlights
  
  o There were a few non-mod_perl modules announced to the list this
week:
  - OpenInteract 1.06, an extensible web application framework
built on Apache, mod_perl, Template Toolkit and SPOPS [9]

  - mod_proxy_add_forward.c [10]

  - MLDBM::Sync, a locking wrapper around MLDBM [11]

  o An interesting thread on using shared memory with mod_perl [12]

  o For users of lingerd, there is now a patch that allows you to 
build lingerd with mod_ssl [13]

  o There is a call for articles for take23.org [14]

  o Development on mod_perl 2.0 seems to be progressing well: 51
patches this week!


news
 
  o Apache 1.3.19 was released this week [15].  New features of note:

  - Apache will now get the correct IP address if ServerName is
not set and Apache cannot find a fully-qualified domain name
at startup.

  - Restore functionality broken by the mod_rewrite security fix:
The mod_rewrite string arithmetic is corrected for rewrite map

  - Under certain circumstances, Apache did not supply the right
response headers when requiring authentication

  - More Windows and NetWare patches than you can shake a stick at

see Changes [16] for a full list of new features and bug fixes

  o Netcraft February statistics
 Apache 59.99% IIS 19.64% [17]
 
  o Security Space February statistics
 Apache 58.19% IIS 28.71% [18]
 12.01% (178,713) of Apache servers are running mod_perl [19]


links

  o The Apache/Perl Integration Project [20]
  o mod_perl documentation [21]
  o mod_perl modules on CPAN [22]
  o mod_perl homepage [23]
  o mod_perl news and advocacy [24]
  o mod_perl list archives [25] [26]


happy mod_perling...

--Geoff
[EMAIL PROTECTED]

--
[1] http://perl.apache.org/dist/
[2] http://perl.apache.org/from-cvs/modperl/
[3] http://www.apache.org/dist/
[4] http://dev.apache.org/from-cvs/apache-1.3/
[5] http://www.perl.com/pub/language/info/software.html#stable
[6] http://www.perl.com/pub/language/info/software.html#devel
[7] http://forum.swarthmore.edu/epigone/modperl/vingcrahserd
[8] http://forum.swarthmore.edu/epigone/modperl/langswerstoi
[9] http://forum.swarthmore.edu/epigone/modperl/phulworcly
[10] http://forum.swarthmore.edu/epigone/modperl/glarbermzhy
[11] http://forum.swarthmore.edu/epigone/modperl/quermhingblel
[12] http://forum.swarthmore.edu/epigone/modperl/twerdgraxclimp
[13] http://forum.swarthmore.edu/epigone/modperl/whimphahbrum
[14] http://forum.swarthmore.edu/epigone/modperl/zhoglulgrol
[15] http://take23.org/news/2001/02/28/apache.xml
[16] http://www.apache.org/dist/CHANGES_1.3
[17] http://www.netcraft.com/survey/
[18] http://www.securityspace.com/s_survey/data/index.html
[19] http://www.securityspace.com/s_survey/data/man.200102/apachemods.html
[20] http://perl.apache.org
[21] http://perl.apache.org/#docs
[22] http://www.cpan.org/modules/by-module/Apache/
[23] http://www.modperl.com
[24] http://www.take23.org
[25] http://forum.swarthmore.edu/epigone/modperl/
[26] http://marc.theaimsgroup.com/?l=apache-modperlr=1w=2



Re: Apache, mod_perl, mysql, php segfault!

2001-03-05 Thread Matt Sergeant

On Mon, 5 Mar 2001, Michael Turley wrote:

 Hello, anyone come across a problem where they get
 "exit signal Segmentation fault (11)" when they try to
 connect to mysql via mod_perl?

This is a known issue IIRC. Simply re-compile PHP without the built-in
MySQL support (you can still connect to MySQL).

-- 
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  **
 \\//
 //\\
//  \\




problem with installation

2001-03-05 Thread Henri Delebecque

hello,

I'm sure that's trivial, but I'm a newbie in using mod_perl.
I have read the FAQ, which tells that I should read the documentation.
I have read the http://perl.apache.org/guide/install.html page,
and the "A Summary of a Basic mod_perl installation" section.

when I execute the following command:
perl Makefile.PL APACHE_SRC=/webmaster/apache/src \
DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
APACHE_PREFIX=/webmaster/apache/httpd.perl,

the perl script runs well, but when I try to make httpd, I
encounter the following error message:

"entering /webmaster/apache/src"
"no rule to make target 'all'. Stop"

My server is a Digital/Unix, under Digital Unix 4

any hint ?
thanks alot

__
| Henri Delebecque[EMAIL PROTECTED] |
| Webmaster   |
| Supelec  Tel (33)  01.69.85.14.91   |
| 3 rue Joliot-Curie  |
| Plateau de Moulon Fax:(33) 01.69.85.12.34   |
| 91190 Gif sur Yvette|
| FRANCE  |
|_|





Re: push_handlers question

2001-03-05 Thread Mike Cameron

Thanks for the suggestion, but what i really want to know is why is the
request object passed if I call the module directly from http.conf and not
when I use the push handlers method? Are the two methods not functionally
equivalent?  Everything works fine when the handler is set in httpd.conf.

Mike

Geoffrey Young wrote:

  -Original Message-
  From: Mike Cameron [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, March 04, 2001 11:59 PM
  Cc: modperl
  Subject: push_handlers question
 
 
  I am trying to sub class Apache::AuthCookieURL and would like to use
  $r-push_handlers(PerlAuthenHandler = My::Class-authenticate);
  the push_handler is set in a handler called from httpd.conf on the
  PerlInitHandler phase but the authenticate routine does not
  seem to be getting
  the apache request object passed to it as I get a can't call
  dir_config on an
  udefined value error.

 my $r = Apache-request;

 HTH

 --Geoff

 
  I'm sure I am missing something simple but can someone point
  it out to me.
 
  Thanks
 




Re: problem with installation

2001-03-05 Thread Peter Brown

Henri Delebecque writes:
  hello,
  
  I'm sure that's trivial, but I'm a newbie in using mod_perl.
  I have read the FAQ, which tells that I should read the documentation.
  I have read the http://perl.apache.org/guide/install.html page,
  and the "A Summary of a Basic mod_perl installation" section.
  
  when I execute the following command:
  perl Makefile.PL APACHE_SRC=/webmaster/apache/src \
  DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
  APACHE_PREFIX=/webmaster/apache/httpd.perl,
  
  the perl script runs well, but when I try to make httpd, I
  encounter the following error message:
  
  "entering /webmaster/apache/src"
  "no rule to make target 'all'. Stop"

this would suggest to me that there is something wrong with the
Makefile in that directory or a Makefile doesnt exist there

the APACHE_SRC directive should point to the src subdirectory of the
apache source you are compiling mod_perl with


  My server is a Digital/Unix, under Digital Unix 4




Re: problem with installation

2001-03-05 Thread Stas Bekman

On Mon, 5 Mar 2001, Henri Delebecque wrote:

 hello,

 I'm sure that's trivial, but I'm a newbie in using mod_perl.
 I have read the FAQ, which tells that I should read the documentation.
 I have read the http://perl.apache.org/guide/install.html page,
 and the "A Summary of a Basic mod_perl installation" section.

 when I execute the following command:
 perl Makefile.PL APACHE_SRC=/webmaster/apache/src \
 DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
 APACHE_PREFIX=/webmaster/apache/httpd.perl,

 the perl script runs well, but when I try to make httpd, I
 encounter the following error message:

 "entering /webmaster/apache/src"
 "no rule to make target 'all'. Stop"

 My server is a Digital/Unix, under Digital Unix 4

 any hint ?
 thanks alot

Hmm, may be it has something to do with Digital, but if not, make sure
that /webmaster/apache actually includes the apache sources. I'll repeat
the steps here:

  % cd /usr/src
  % lwp-download http://www.apache.org/dist/apache_x.x.x.tar.gz
  % lwp-download http://perl.apache.org/dist/mod_perl-x.xx.tar.gz
  % tar xzvf apache_x.x.x.tar.gz
  % tar xzvf mod_perl-x.xx.tar.gz
  % cd mod_perl-x.xx
  % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \
DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
  % make  make test  make install
  % cd ../apache_x.x.x
  % make install

replace x.x.x and x.xx with the versions that you use.

if that doesn't help what do you see if you go to apache_x.x.x/src and
type:

  % ./configure
  % make

?

_
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://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





RE: push_handlers question

2001-03-05 Thread Geoffrey Young



 -Original Message-
 From: Mike Cameron [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 05, 2001 10:18 AM
 Cc: '[EMAIL PROTECTED]'
 Subject: Re: push_handlers question
 
 
 Thanks for the suggestion, but what i really want to know is 
 why is the
 request object passed if I call the module directly from 
 http.conf and not
 when I use the push handlers method? Are the two methods not 
 functionally
 equivalent?  Everything works fine when the handler is set in 
 httpd.conf.

according to the mod_perl pocket reference (p20) method handlers do not get
the request object passed to them - Andrew suggests using a closure for
this.  Apache-request should work fine as well.

HTH

--Geoff

 
 Mike
 
 Geoffrey Young wrote:
 
   -Original Message-
   From: Mike Cameron [mailto:[EMAIL PROTECTED]]
   Sent: Sunday, March 04, 2001 11:59 PM
   Cc: modperl
   Subject: push_handlers question
  
  
   I am trying to sub class Apache::AuthCookieURL and would 
 like to use
   $r-push_handlers(PerlAuthenHandler = My::Class-authenticate);
   the push_handler is set in a handler called from httpd.conf on the
   PerlInitHandler phase but the authenticate routine does not
   seem to be getting
   the apache request object passed to it as I get a can't call
   dir_config on an
   udefined value error.
 
  my $r = Apache-request;
 
  HTH
 
  --Geoff
 
  
   I'm sure I am missing something simple but can someone point
   it out to me.
  
   Thanks
  
 



segmentation fault 11

2001-03-05 Thread Michael Turley

Hello, my last post has been solved. After searching
through google most of the morning I decided to
upgrade mysql to version 3.23.33 and rebuild
absolutely everything. And hey presto, everything
works. It may have been something to do with the
earlier mysql version but more likely the incremental
sequence in which I am rebuilding apache.

=
Mr. Michael Turley
Gracious winner, Generous lover, All round great guy.

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



RE: push_handlers question

2001-03-05 Thread Geoffrey Young



 -Original Message-
 From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 05, 2001 9:58 AM
 To: 'Mike Cameron'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: push_handlers question
 
 
 
 
  -Original Message-
  From: Mike Cameron [mailto:[EMAIL PROTECTED]]
  Sent: Monday, March 05, 2001 10:18 AM
  Cc: '[EMAIL PROTECTED]'
  Subject: Re: push_handlers question
  
  
  Thanks for the suggestion, but what i really want to know is 
  why is the
  request object passed if I call the module directly from 
  http.conf and not
  when I use the push handlers method? Are the two methods not 
  functionally
  equivalent?  Everything works fine when the handler is set in 
  httpd.conf.
 
 according to the mod_perl pocket reference (p20) method 
 handlers do not get
 the request object passed to them

I should have said method handlers that are set up via push_handlers() don't
have the request object passed to them.

for normal method handlers,
$self = shift;
$r = shift;

works just fine.

hopefully everyone understood that :)

--Geoff

 - Andrew suggests using a 
 closure for
 this.  Apache-request should work fine as well.
 
 HTH
 
 --Geoff
 
  
  Mike
  
  Geoffrey Young wrote:
  
-Original Message-
From: Mike Cameron [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 04, 2001 11:59 PM
Cc: modperl
Subject: push_handlers question
   
   
I am trying to sub class Apache::AuthCookieURL and would 
  like to use
$r-push_handlers(PerlAuthenHandler = My::Class-authenticate);
the push_handler is set in a handler called from 
 httpd.conf on the
PerlInitHandler phase but the authenticate routine does not
seem to be getting
the apache request object passed to it as I get a can't call
dir_config on an
udefined value error.
  
   my $r = Apache-request;
  
   HTH
  
   --Geoff
  
   
I'm sure I am missing something simple but can someone point
it out to me.
   
Thanks
   
  
 



RE: push_handlers question

2001-03-05 Thread Robert Landrum

At 10:36 AM -0500 3/5/01, Geoffrey Young wrote:
   Thanks for the suggestion, but what i really want to know is
  why is the
  request object passed if I call the module directly from
  http.conf and not
  when I use the push handlers method? Are the two methods not
  functionally
  equivalent?  Everything works fine when the handler is set in
  httpd.conf.

 according to the mod_perl pocket reference (p20) method
 handlers do not get
 the request object passed to them

I should have said method handlers that are set up via push_handlers() don't
have the request object passed to them.

for normal method handlers,
$self = shift;
$r = shift;



Couldn't you fake it?

$r-push_handlers(
 PerlHandler = sub{ unshift @_, Apache-request; goto real_handler; }
);

Robert Landrum


[snip]



--
"Will hack Perl for food."



RE: push_handlers question

2001-03-05 Thread Geoffrey Young



 -Original Message-
 From: Robert Landrum [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 05, 2001 11:19 AM
 To: Geoffrey Young; 'Mike Cameron'
 Cc: [EMAIL PROTECTED]
 Subject: RE: push_handlers question
 
 
 At 10:36 AM -0500 3/5/01, Geoffrey Young wrote:
Thanks for the suggestion, but what i really want to know is
   why is the
   request object passed if I call the module directly from
   http.conf and not
   when I use the push handlers method? Are the two methods not
   functionally
   equivalent?  Everything works fine when the handler is set in
   httpd.conf.
 
  according to the mod_perl pocket reference (p20) method
  handlers do not get
  the request object passed to them
 
 I should have said method handlers that are set up via 
 push_handlers() don't
 have the request object passed to them.
 
 for normal method handlers,
 $self = shift;
 $r = shift;
 
 
 
 Couldn't you fake it?
 
 $r-push_handlers(
  PerlHandler = sub{ unshift @_, Apache-request; goto 
 real_handler; }
 );

there's always more than one way :)

--Geoff

 
 Robert Landrum
 
 
 [snip]
 
 
 
 --
 "Will hack Perl for food."
 



Apache processes not dying

2001-03-05 Thread Chris Allen

I am running a site with:

Apache 1.3.9
mod perl 1.21
HTML::Embperl
 

The site is relatively busy - up to 3 hits a day, and has been
running fine for over a year. However in the last two weeks I
have found that I am ending up with a large number of httpd
processes that don't die.

Looking with apache status shows nothing out of the ordinary - 
the processes are usually in the W (sending reply) state - 
however ps shows them as

[httpd]

rather than the more normal 

/usr/local/apache/bin/httpd

which I thought indicated a process that had stopped responding.

Attaching with strace shows the processes are *always* sitting at:

read(46,


Problem is, that Apache seems to ignore these processes and start new ones
without killing them - so I end up with *hundreds* of http processes with
the machine swapping like crazy.

The rogue processes also haven't reached their MaxRequestsPerChild limit of
100 yet either - they are usually at about 20 or 30 or so...


Any ideas as to what I could try to find out what is happening would
be much appreciated - at the moment I am having to kill them all off
with a script at regular intervals!


Chris Allen
[EMAIL PROTECTED]




Re: push_handlers question

2001-03-05 Thread Mike Cameron

Thanks all.  My real question was not so much HOW to fix but more WHY do
i need to fix.  I did not realize that using push_handlers would not
send the Apache request to the method handler.

Geoffrey Young wrote:

  -Original Message-
  From: Robert Landrum [mailto:[EMAIL PROTECTED]]
  Sent: Monday, March 05, 2001 11:19 AM
  To: Geoffrey Young; 'Mike Cameron'
  Cc: [EMAIL PROTECTED]
  Subject: RE: push_handlers question
 
 
  At 10:36 AM -0500 3/5/01, Geoffrey Young wrote:
 Thanks for the suggestion, but what i really want to know is
why is the
request object passed if I call the module directly from
http.conf and not
when I use the push handlers method? Are the two methods not
functionally
equivalent?  Everything works fine when the handler is set in
httpd.conf.
  
   according to the mod_perl pocket reference (p20) method
   handlers do not get
   the request object passed to them
  
  I should have said method handlers that are set up via
  push_handlers() don't
  have the request object passed to them.
  
  for normal method handlers,
  $self = shift;
  $r = shift;
 
 
 
  Couldn't you fake it?
 
  $r-push_handlers(
   PerlHandler = sub{ unshift @_, Apache-request; goto
  real_handler; }
  );

 there's always more than one way :)

 --Geoff

 
  Robert Landrum
 
 
  [snip]
  
  
 
  --
  "Will hack Perl for food."
 




uri to filename

2001-03-05 Thread Nikolaus Rath

Hello!

As described in the other mail, i have a TransHandler wich modifies
the URI. But this doesn't work correctly.

Two examples:

When the URI is not been modified:

TransHandler:   $r-uri:  /showsession.php
$r-filename: [empty]
$r-path_info: [empty]

AccessHandler:  $r-uri:  /showsession.php
$r-filename: [DocumentRoot]/showsession.php
$r-path_info: [empty]

But when the URI is been modified:

TransHandler:   $r-uri:  /session/11/showsession.php -- /showsession.php
$r-filename: [empty]
$r-path_info: [empty]

AccessHandler:  $r-uri:  /showsession.php
$r-filename: /showsession.php
$r-path_info: [empty]

   
Why has the URI modification an effect to the filename translation? In
my opinion $r-filename should be equal in both cases, because after
the uri_handler the uri is the same in both examples. I think the
filename translation is done as a part of the dir_conf building
process, which starts *after* the TransHandler was called, because a.
filename and path_info are empy in TransHandlers and b. TransHandlers
cannot be used in Location/File/Directory sections.

Am i wrong? What can i do to get the expected behaviour?

  - Nikolaus

-- 
$|++;@_=map{chr(ord($_)-$|)}split//,"Kvtu!bopuifs!Qfsm!Ibdlfs-";$\="\r";@a=qw(
 ^  v);$="_"x25;until($!~m~_~){$o=int(rand 28)+65;next if$s{$o}++;$o==91?
$o=44:($o==92?$o=32:0);$g=chr$o;for(0..24){if($_[$_]=~m)$g)i){for$m(@a,$_[$_])
{substr $,$_,$|,$m;print$;select$/,$/,$/,0.1}}}print$}print$/




Re: uri to filename

2001-03-05 Thread Pierre Phaneuf

Nikolaus Rath wrote:

 As described in the other mail, i have a TransHandler wich modifies
 the URI. But this doesn't work correctly.

After modifying the URI, do you return DECLINED or something else?

-- 
Pierre Phaneuf
http://www3.sympatico.ca/pphaneuf/



Re: problem with installation

2001-03-05 Thread Peter Brown

Henri Delebecque writes:

Henri
for future please make sure you reply to the [EMAIL PROTECTED] list
as well

then others can see the entire conversation

it seems i was wrong in telling you what i said
as evidenced be stas's reply to your post

i was unaware of the problem he described (thanks stas)
please refer to his reply
thanks 

  Hello,
  
  Thanks for your answer.
  
  
  this would suggest to me that there is something wrong with the
  Makefile in that directory or a Makefile doesnt exist there
  You're right: the Makefile in this directory is relatively old,
  much older that the Makefile in the mod_perl directory.
  It seems that the perl script doesn't generate a Makefile
  in the /webmaster/apache/src directory...
  
  
  the APACHE_SRC directive should point to the src subdirectory of the
  apache source you are compiling mod_perl with
  Yes, I have check it .
  
  I have currently tried to delete the whole mod_perl directory,
  and regenerate it from the tar archive. I have renamed the
  Makefile in the /webmaster/apache/src to another name, and
  relaunch the perl script. It never creates a Makefile in the
  /webmaster/apache/src directory...
  
  a suggestion ?
  Thanks




Re: Authentication handlers

2001-03-05 Thread Daryl Campbell


From: Erdmut Pfeifer [EMAIL PROTECTED]
Subject: Re: Authentication handlers

On Mon, Mar 05, 2001 at 10:28:15AM +1100, Sisyphus wrote:
 
 
 - Original Message -
 From: Pierre Phaneuf [EMAIL PROTECTED]
 To: modperl [EMAIL PROTECTED]
 Sent: Monday, March 05, 2001 9:29 AM
 Subject: Re: Authentication handlers
 
 
  Cees Hek wrote:
 
   So instead of storing a y/n in the database, store a unique string that
 is
   used as the realm, and clear it when they log out.  Now everytime you
 send
   the Authenitication required header, send the unique realm for this user
   that you stored in the database, and if it doesn't exist, generate a new
   one.
 
  Good one! The only bad thing I see is that the realm is visible in the
  dialog box the user see, isn't it? Seeing a random string might be a bit
  unsettling for the user, but there is no technical reason for it not to
  work.
 
  --
  Pierre Phaneuf
  Systems Exorcist
 
 Hi,
 Are you guys sure about this ? I just tried it out and it doesn't work for
 Apache1.3.12(win32) on win 98.
 I visited a page in a 'basic authentication' protected directory, then
 changed the name of the realm from 'htdocs access' to 'htdocs' but was still
 able to access other pages in the same directory without being hit for
 username and password. I tried hitting the back button and 'refreshing', and
 I also visited another site in the interim. All to no avail.

Hi,

there are two things to consider here. First, the server really has to
send the AUTH_REQUIRED + realm; second, the browser does have to honor
that authentication request by asking the user for a new name/password.

Typically, servers are set up not to send the AUTH_REQUIRED response
code, when the browser already is sending a valid username/password
combination. And that's where browser caching comes into play: having
queried the user once for username/password, the browser associates it
with that specific URL and automatically resends it for each subsequent
request to that location (which usually makes sense as it avoids another
round trip to the server).
Now, what happens if the server is configured such that it sends an
AUTH_REQUIRED, even though it did already get the basic authorization
header?  Well, as so often, it depends on the browser. Netscape, for
example, does pop up a dialog box, asking for re-authentication, while
IE simply resends the same old username/password combination again.
Thus, in IE you don't get a chance to enter any new credentials for a
certain location which you've already visited in the current browser
session. M$ obviously thought that this would never make sense ;(
(it effectively means that you have to restart IE, if you need to
login anew...)

I haven't yet tested this issue again to see what happens when bringing
the "changing realms"-idea into play. Maybe an AUTH_REQUIRED + _new_
realm would even convince IE to allow re-authentication... ;)

Erdmut

Hi,

Cees suggestion seems to unlock part of the browser behaviour puzzle 
that we are trying to solve to meet the following requirements for a 
PerlAuthenHandler:

*URL based session handling if cookies not enabled,
*LDAP authentication,
*Force reauthentication if given inactivity period passed,
*Maintain state information in main memory, no DBI store required.

So now our session state information is "Time_last_accessed and Next_realm", 
or generate the realm based on current time if inactivity period lapsed.
Assuming that we are sending an AUTH_REQUIRED when inactivity period is
lapsed.

Now what PerlAuthenHandler's do we build on that come closest to this
design?

Apache::AuthCookieURL and extend to include inactivity modifications 
  + memory management like in Eagle book pg. 222
Apache::AuthenLDAP

and use them together as stacked handlers.

Go easy on me, it's my first mod_perl posting but have been chewing on 
the mod_perl guide, eagle book, and the mailing list archives.

-- 
Daryl Campbell  The magician tried to blame it on the rabbit,
Athabasca Universitypulled her out of the hat couldn't make her disappear 
(780) 675 6379   ...never more blind than when looking at ourselves   
[EMAIL PROTECTED]  Bob Kemmis,  Kemmisutra



Apache does not start with Perlrequire

2001-03-05 Thread Roberto Osorio González

Hi, I'm using Apache 1.3.12-2 that comes with RedHat 6.2 and into the
same CD I have mod_perl both are RPM`s packages and both are working
well.
However if I use Perlrequire directive:
   Perlrequire /path to my startup/my startup.pl
and I try to restart my httpd, this says OK but there is no one daemon
started, does somebody can help me ?

To load mod_perl my httpd.conf has
...
LoadModule  perl_modulemodules/libperl.so
...
...
and
AddModule mod_perl.c
I used the following code for test and it work ok:
   ...
   ...
   if (exists $ENV{'MOD_PERL'}){
  print "Running as a mod_perl application";
  }
   else{
  print "Running as a CGI script";
  }

Thanks in advence

Roberto Osorio
Centro Universitario de Investigaciones Bibliotecolgicas, UNAM




mod_perl startup sequence?

2001-03-05 Thread Drew Wilson
Title: mod_perl startup sequence?





I'm confused about when mod_perl loads Perl Modules. It appears my perl module gets loaded twice: once when the log writes to stdout, and once when the log message is written to error-log.

I would expect my module to only get loaded once. Why twice?


To help me trace loading, I added print STDERR statements to my .conf file and my perl module. To my surprise, log messages go to the console, and messages go the log file 30 milliseconds later. Also, the Apache::Server::Starting is 1 first time through, and 0 the second time through. NOTE: PerlFreshRestart is NOT defined.

For example, this appears on my console:
# .conf started at 983839924.241642, Starting = 1, ReStarting=0
# wierd.pm started at 983839924.274978, Starting = 1, ReStarting=0
# .conf finished at 983839924.277637


And this appears in my error-log:
# .conf started at 983839924.285614, Starting = 0, ReStarting=0
# wierd.pm started at 983839924.292273, Starting = 0, ReStarting=0
# .conf finished at 983839924.294823


Notice the difference in execution times (1st ends at 983839924.277637 and the 2nd one starts at 983839924.285614).



Here's my simplified .conf
Perl
 use Time::HiRes qw( time );
 print STDERR # .conf started at  . time() . \n;
/Perl 
PerlModule wierd.pm
Location /my_wierd
 SetHandler perl-script
 PerlHandler wierd
/Location
Perl
 use Time::HiRes qw( time );
 print STDERR # .conf finished at  . time() . \n;
/Perl 



And here's my simplified wierd.pm
package wierd;
use strict;
use Time::HiRes qw( time );


print STDERR # wierd.pm loaded at  . time() . \n;
return 1;



TIA,


drew
==





Re: Apache does not start with Perlrequire

2001-03-05 Thread Stas Bekman

On Mon, 5 Mar 2001, Roberto Osorio [iso-8859-1] González wrote:

 Hi, I'm using Apache 1.3.12-2 that comes with RedHat 6.2 and into the
 same CD I have mod_perl both are RPM`s packages and both are working
 well.
 However if I use Perlrequire directive:
Perlrequire /path to my startup/my startup.pl
 and I try to restart my httpd, this says OK but there is no one daemon
 started, does somebody can help me ?

Roberto, check the error_log file. See:
http://perl.apache.org/guide/debug.html#Warning_and_Errors_Explained


_
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://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: Apache processes not dying

2001-03-05 Thread Stas Bekman

 The site is relatively busy - up to 3 hits a day, and has been
 running fine for over a year. However in the last two weeks I
 have found that I am ending up with a large number of httpd
 processes that don't die.


[snip]

 Problem is, that Apache seems to ignore these processes and start new ones
 without killing them - so I end up with *hundreds* of http processes with
 the machine swapping like crazy.

http://perl.apache.org/guide/debug.html#Hanging_Processes_Detection_and
See also Apache::Watchdog::RunAway

_
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://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Make test hangs on httpdconf

2001-03-05 Thread John Walker

Apache 1.3.19 / Mod_perl-1.25 on Linux 2.2 (debian)

I have been following the guide, and I wasn't too successful with the CPAN
method, so I tried the "A Summary of a Basic mod_perl Installation" method.
I didn't notice any error during the configuration or the make step. The
tests stall at httpdconf. I'm baffeled by the errors logs. I have included
the last few lines of the tests and the tail on the error log. What might
cause this?

Thanks in advance,
John

cp t/conf/mod_perl_srm.conf t/conf/srm.conf
../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t 
httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
modules/actions.ok
modules/cgi.ok
modules/constants...ok
modules/cookie..skipping test on this platform
modules/fileok
modules/httpdconf...

(^C after a few minutes)

# tail t/logs/error_log
Constant subroutine XHTML_DTD redefined at /usr/lib/perl5/5.005/constant.pm
line 175.
[notice] Destruction-DESTROY called for $global_object
[Mon Mar  5 21:56:54 2001] [warn] [notice] child_init for process 6284,
report any problems to [no address given]

[notice] child process 6284 terminating
[notice] push'd PerlChildExitHandler called, pid=6284
[notice] push'd PerlChildExitHandler called, pid=6284
[notice] push'd PerlChildExitHandler called, pid=6284
[notice] END block called for startup.pl
[notice] Destruction-DESTROY called for $global_object





Re: Make test hangs on httpdconf

2001-03-05 Thread Stas Bekman

On Mon, 5 Mar 2001, John Walker wrote:

 Apache 1.3.19 / Mod_perl-1.25 on Linux 2.2 (debian)

 I have been following the guide, and I wasn't too successful with the CPAN
 method, so I tried the "A Summary of a Basic mod_perl Installation" method.
 I didn't notice any error during the configuration or the make step. The
 tests stall at httpdconf. I'm baffeled by the errors logs. I have included
 the last few lines of the tests and the tail on the error log. What might
 cause this?

 Thanks in advance,
 John

 cp t/conf/mod_perl_srm.conf t/conf/srm.conf
 ../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t 
 httpd listening on port 8529
 will write error_log to: t/logs/error_log
 letting apache warm up...\c
 done
 /usr/bin/perl t/TEST 0
 modules/actions.ok
 modules/cgi.ok
 modules/constants...ok
 modules/cookie..skipping test on this platform
 modules/fileok
 modules/httpdconf...

As explained at:
http://perl.apache.org/guide/install.html#Built_Server_Testing_make_test_

You should do:
  % cd mod_perl-1.25
  % make start_httpd
  % perl t/TEST -v modules/httpdconf
  % make kill_httpd

then you will see more verbose output.

Hope this helps...

_
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://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





cvs commit: modperl-2.0/xs/APR/Pool APR__Pool.h

2001-03-05 Thread dougm

dougm   01/03/05 21:16:26

  Modified:xs   modperl_xs_util.h
   xs/APR/Pool APR__Pool.h
  Log:
  shutup fussy compiler
  
  Revision  ChangesPath
  1.2   +2 -2  modperl-2.0/xs/modperl_xs_util.h
  
  Index: modperl_xs_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/modperl_xs_util.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_xs_util.h 2001/03/05 03:48:15 1.1
  +++ modperl_xs_util.h 2001/03/06 05:16:24 1.2
  @@ -33,8 +33,8 @@
   #define mpxs_sv_is_object(sv) \
   (SvROK(sv)  (SvTYPE(SvRV(sv)) == SVt_PVMG))
   
  -#define mpxs_sv_object_deref(sv) \
  -(mpxs_sv_is_object(sv) ? SvIV((SV*)SvRV(sv)) : NULL)
  +#define mpxs_sv_object_deref(sv, type) \
  +(mpxs_sv_is_object(sv) ? (type *)SvIVX((SV*)SvRV(sv)) : NULL)
   
   #define mpxs_sv2_obj(obj, sv) \
   (obj = mp_xs_sv2_##obj(sv))
  
  
  
  1.2   +1 -1  modperl-2.0/xs/APR/Pool/APR__Pool.h
  
  Index: APR__Pool.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/Pool/APR__Pool.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- APR__Pool.h   2001/03/05 03:53:29 1.1
  +++ APR__Pool.h   2001/03/06 05:16:25 1.2
  @@ -2,7 +2,7 @@
   
   static MP_INLINE apr_pool_t *mpxs_apr_pool_create(pTHX_ SV *obj)
   {
  -apr_pool_t *parent = (apr_pool_t *)mpxs_sv_object_deref(obj);
  +apr_pool_t *parent = mpxs_sv_object_deref(obj, apr_pool_t);
   apr_pool_t *retval = NULL;
   (void)apr_pool_create(retval, parent);
   return retval;