Re: compile latest CVS

2003-07-31 Thread jehan procaccia
Stas Bekman wrote:

You can also try to use the latest src.rpm from rawhide, I'm not sure 
how recent it is 
http://fr.rpmfind.net//linux/RPM/rawhide/1.0/i386/RedHat/RPMS/mod_perl-1.99_09-6.i386.html 

says Jul 16, which is very recent.
great, I got the source rpm of the above, after compiling and installing 
it on my redhat 9 system it works fine :-)
I have even got the authCookieLdap module working after playing with 
compat and cheat a bit on use strict , more on this in my next mail to 
the list ; subject: Re: problem with method auth_type

thanks a lot to all of you .



compile latest CVS

2003-07-25 Thread jehan procaccia
hello

I just donwloaded latest cvs as stated in :
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
Now I don't really understand what directory is supposed to contain the 
MP_AP_PREFIX variable ?
Nothing is not a solution:
[EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
$ perl Makefile.PL
!!! Unable to determine server version, aborting.
!!! Please specify MP_APXS or MP_AP_PREFIX.

When I point it to apache 2.0.47 sources in configure ok apparently:
[EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
$ perl Makefile.PL MP_AP_PREFIX=/usr/src/redhat/BUILD/httpd-2.0.47/
Reading Makefile.PL args from @ARGV
  MP_AP_PREFIX = /usr/src/redhat/BUILD/httpd-2.0.47/
Configuring Apache/2.0.47 mod_perl/1.99_10-dev Perl/v5.8.0
   generating script t/TEST
...
But after while compiling :

[EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
$ make
cd src/modules/perl  make -f Makefile.modperl
make[1]: Entering directory 
`/usr/local/src/Mod_perl/modperl-2.0/src/modules/perl'

I get hundreds of error about ap* header files apparently;

In file included from /usr/src/redhat/BUILD/httpd-2.0.47/include/httpd.h:72,
from modperl_apache_includes.h:11,
from mod_perl.h:4,
from mod_perl.c:1:
/usr/src/redhat/BUILD/httpd-2.0.47/include/ap_config.h:58:17: apr.h: No 
such file or directory
In file included from 
/usr/src/redhat/BUILD/httpd-2.0.47/include/ap_config.h:59, 
from /usr/src/redhat/BUILD/httpd-2.0.47/include/httpd.h:72,
from modperl_apache_includes.h:11,
from mod_perl.h:4,
from mod_perl.c:1:
/usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr-util/include/apr_hooks.h:58:17: 
apu.h: No such file or directory

However, apr.h for example is here:

$ locate apr.h
/usr/include/httpd/apr.h
/usr/include/apr-0/apr.h
/usr/src/redhat/BUILD/apr-0.9.3/include/apr.h.in
/usr/src/redhat/BUILD/apr-0.9.3/include/apr.hnw
/usr/src/redhat/BUILD/apr-0.9.3/include/apr.hw
/usr/src/redhat/BUILD/apr-0.9.3/include/apr.h
/usr/src/redhat/BUILD/apr-0.9.3/test/test_apr.h
/usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr/test/test_apr.h
/usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr/include/apr.h.in
/usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr/include/apr.hw
/usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr/include/apr.hnw
/usr/src/redhat/BUILD/httpd-2.0.45/srclib/apr/include/apr.h.in
/usr/src/redhat/BUILD/httpd-2.0.45/srclib/apr/include/apr.hnw
/usr/src/redhat/BUILD/httpd-2.0.45/srclib/apr/include/apr.hw
/usr/src/redhat/BUILD/httpd-2.0.45/srclib/apr/test/test_apr.h
How can I compile mod_perl 2.0 ? mybe I should use MP_APXS instead, but 
again what directory should I point it to ?

thanks .




Re: compile latest CVS

2003-07-25 Thread Stas Bekman
jehan procaccia wrote:
hello

I just donwloaded latest cvs as stated in :
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution 

Now I don't really understand what directory is supposed to contain the 
MP_AP_PREFIX variable ?
It's the path where Apache was installed to. I'm not on RH so I'm not sure 
where it installs it to. But from looking at the RH rpms, it spreads things 
across different dirs.

There is a RH rpm package which includes the build instructions specific to 
RH, just grab the src.rpm from here:
http://fr.rpmfind.net/linux/rpm2html/search.php?query=mod_perlsubmit=Search+...

next look at the spec file, it says:

# Compile the module.
%{__perl} Makefile.PL /dev/null \
PREFIX=$RPM_BUILD_ROOT/usr INSTALLDIRS=vendor \
MP_APXS=%{_sbindir}/apxs MP_APR_CONFIG=%{_bindir}/apr-config \
CCFLAGS=$RPM_OPT_FLAGS -fPIC
make
So I suppose that if you have installed the Apache rpm from RH you should say 
at least:

perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_APR_CONFIG=/usr/bin/apr-config

adjust the paths to these scripts if my guess was wrong. You can use locate(1) 
to find them.

You can also try to use the latest src.rpm from rawhide, I'm not sure how 
recent it is 
http://fr.rpmfind.net//linux/RPM/rawhide/1.0/i386/RedHat/RPMS/mod_perl-1.99_09-6.i386.html
says Jul 16, which is very recent.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: compile latest CVS

2003-07-25 Thread Jrme Aug
On Fri, Jul 25, 2003 at 02:47:36PM +0200, jehan procaccia wrote:
 
 I just donwloaded latest cvs as stated in :
 http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
 Now I don't really understand what directory is supposed to contain the 
 MP_AP_PREFIX variable ?
 Nothing is not a solution:
 [EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
 $ perl Makefile.PL
 !!! Unable to determine server version, aborting.
 !!! Please specify MP_APXS or MP_AP_PREFIX.
 
 When I point it to apache 2.0.47 sources in configure ok apparently:
 [EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
 $ perl Makefile.PL MP_AP_PREFIX=/usr/src/redhat/BUILD/httpd-2.0.47/
 Reading Makefile.PL args from @ARGV
   MP_AP_PREFIX = /usr/src/redhat/BUILD/httpd-2.0.47/
 Configuring Apache/2.0.47 mod_perl/1.99_10-dev Perl/v5.8.0
generating script t/TEST
 ...
 
 But after while compiling :
 
 [EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
 $ make
 cd src/modules/perl  make -f Makefile.modperl
 make[1]: Entering directory 
 `/usr/local/src/Mod_perl/modperl-2.0/src/modules/perl'
 
 I get hundreds of error about ap* header files apparently;
 
 In file included from /usr/src/redhat/BUILD/httpd-2.0.47/include/httpd.h:72,
 from modperl_apache_includes.h:11,
 from mod_perl.h:4,
 from mod_perl.c:1:
 /usr/src/redhat/BUILD/httpd-2.0.47/include/ap_config.h:58:17: apr.h: No 
 such file or directory
 In file included from 
 /usr/src/redhat/BUILD/httpd-2.0.47/include/ap_config.h:59, 
 from /usr/src/redhat/BUILD/httpd-2.0.47/include/httpd.h:72,
 from modperl_apache_includes.h:11,
 from mod_perl.h:4,
 from mod_perl.c:1:
 /usr/src/redhat/BUILD/httpd-2.0.47/srclib/apr-util/include/apr_hooks.h:58:17: 
 apu.h: No such file or directory
 
 How can I compile mod_perl 2.0 ? mybe I should use MP_APXS instead, but 
 again what directory should I point it to ?
 

You don't need the full Apache sources, on redhat you just need the
'httpd' and 'httpd-devel' package, then MP_APXS should point to your
apxs, on redhat 8 it is:

  $ perl Makefile.PL MP_APXS=/usr/sbin/apxs

Regards,
Jérôme

--



Re: compile latest CVS

2003-07-25 Thread jehan procaccia
You guessed very well !
now it compiles with no problem, so on a redhat system use:
[EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
$ perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_APR_CONFIG=/usr/bin/apr-config
I'll continue with my AuthCookie now ... good weekend !

Stas Bekman wrote:

jehan procaccia wrote:

hello

I just donwloaded latest cvs as stated in :
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution 

Now I don't really understand what directory is supposed to contain 
the MP_AP_PREFIX variable ?


It's the path where Apache was installed to. I'm not on RH so I'm not 
sure where it installs it to. But from looking at the RH rpms, it 
spreads things across different dirs.

There is a RH rpm package which includes the build instructions 
specific to RH, just grab the src.rpm from here:
http://fr.rpmfind.net/linux/rpm2html/search.php?query=mod_perlsubmit=Search+... 

next look at the spec file, it says:

# Compile the module.
%{__perl} Makefile.PL /dev/null \
PREFIX=$RPM_BUILD_ROOT/usr INSTALLDIRS=vendor \
MP_APXS=%{_sbindir}/apxs MP_APR_CONFIG=%{_bindir}/apr-config \
CCFLAGS=$RPM_OPT_FLAGS -fPIC
make
So I suppose that if you have installed the Apache rpm from RH you 
should say at least:

perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_APR_CONFIG=/usr/bin/apr-config

adjust the paths to these scripts if my guess was wrong. You can use 
locate(1) to find them.

You can also try to use the latest src.rpm from rawhide, I'm not sure 
how recent it is 
http://fr.rpmfind.net//linux/RPM/rawhide/1.0/i386/RedHat/RPMS/mod_perl-1.99_09-6.i386.html 

says Jul 16, which is very recent.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: compile latest CVS

2003-07-25 Thread jehan procaccia
Jérôme Augé wrote:

You don't need the full Apache sources, on redhat you just need the
'httpd' and 'httpd-devel' package, then MP_APXS should point to your
apxs, on redhat 8 it is:
 $ perl Makefile.PL MP_APXS=/usr/sbin/apxs

Regards,
Jérôme
 

Indeed, it works fine now with:

[EMAIL PROTECTED] /usr/local/src/Mod_perl/modperl-2.0]
$ perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_APR_CONFIG=/usr/bin/apr-config
thanks .

--

 





cvs version make test errors

2003-03-20 Thread Jie Gao
Hi All,

I got a version from cvs today and make test fails with:

protocol/echo_filter...ok
protocol/eliza.skipped
all skipped: cannot find module 'Chatbot::Eliza'
All tests successful, 3 tests skipped.
Files=115, Tests=610, 230 wallclock secs (115.33 cusr + 30.32 csys = 145.65 CPU)
*** server localhost:8529 shutdown
*** port 8529 still in use...
done
cd ModPerl-Registry  gmake test
gmake[1]: Entering directory `/de1/src/lima/modperl-2.0/ModPerl-Registry'
/usr/local/perl-5.8.0_threaded/bin/perl -I../blib/arch/Apache2 -I../blib/lib/Apache2 \
t/TEST -clean
APACHE_USER= APACHE_GROUP= APACHE_PORT= APACHE= APXS= \
/usr/local/perl-5.8.0_threaded/bin/perl -I../blib/arch/Apache2 -I../blib/lib/Apache2 \
t/TEST
*** root mode: changing the fs ownership to 'nobody' (60001:60001)
/usr/local/WASM_Sessions_Checker_apache_2.0.44/bin/httpd  -d
/de1/src/lima/modperl-2.0/ModPerl-Registry/t -f
/de1/src/lima/modperl-2.0/ModPerl-Registry/t/conf/httpd.conf -DAPACHE2 
-DPERL_USEITHREADS
using Apache/2.0.44 (worker MPM)

waiting for server to start: ...
waiting for server to start: ok (waited 14 secs)
server localhost:8529 started
206ok
404ok
500ok
bad_scriptsok
basic..ok
closureok
perlrun_requireok
redirect...ok
special_blocks.ok 5/12unable to find interp de76d477-58b9-0310-b94d-dd991812e62e
special_blocks.dubious
Test returned status 29 (wstat 7424, 0x1d00)
DIED. FAILED tests 6-12
Failed 7/12 tests, 41.67% okay
Failed Test  Stat Wstat Total Fail  Failed  List of Failed
---
special_blocks.t   29  7424127  58.33%  6-12
*** server localhost:8529 shutdown
!!! error running tests (please examine t/logs/error_log)
gmake[1]: *** [run_tests] Error 1
gmake[1]: Leaving directory `/de1/src/lima/modperl-2.0/ModPerl-Registry'
gmake: *** [run_tests] Error 2

Sincerely,



Jie




perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris-thread-multi
uname='sunos lima 5.7 generic_106541-23 sun4u sparc sunw,ultra-80 '
config_args='-Dcc=gcc -B/usr/ccs/bin/ -Doptimize=-O2 
-Dprefix=/usr/local/perl-5.8.0_threaded
-Dusethreads -Ui_db -Uuselargefiles -Uusemymalloc -Dlocincpth=/usr/local/include 
/opt/local/include
/include /usr/include -Dloclibpth=/usr/local/lib /opt/local/lib /usr/lib /usr/ccs/lib'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc -B/usr/ccs/bin/', ccflags ='-D_REENTRANT -fno-strict-aliasing 
-I/opt/local/include',
optimize='-O2',
cppflags='-D_REENTRANT -fno-strict-aliasing -I/opt/local/include'
ccversion='', gccversion='3.2.2', 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=4
alignbytes=8, prototype=define
  Linker and Libraries:
ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib -L/opt/local/lib -L/usr/lib 
-L/usr/ccs/lib'
libpth=/usr/local/lib /opt/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -lgdbm -ldl -lm -lrt -lpthread -lc
perllibs=-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -L/opt/local/lib -L/usr/lib 
-L/usr/ccs/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
  Built under solaris
  Compiled at Mar 21 2003 11:50:43
  @INC:
/usr/local/perl-5.8.0_threaded/lib/5.8.0/sun4-solaris-thread-multi
/usr/local/perl-5.8.0_threaded/lib/5.8.0
/usr/local/perl-5.8.0_threaded/lib/site_perl/5.8.0/sun4-solaris-thread-multi
/usr/local/perl-5.8.0_threaded/lib/site_perl/5.8.0
/usr/local/perl-5.8.0_threaded/lib/site_perl
.




Re: cvs version make test errors

2003-03-20 Thread Stas Bekman
Jie Gao wrote:
Hi All,

I got a version from cvs today and make test fails with:

special_blocks.ok 5/12unable to find interp de76d477-58b9-0310-b94d-dd991812e62e
Thanks Jie.

Your bug report missing the mod_perl and apache information. You should have 
run t/REPORT to get this as explained here:
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
I can't tell whether you are running a threaded-mpm or a prefork.

However, this is not a bug in mod_perl, but a current limitation in one of the 
testing framework functionalities. Certain tests need to make sure that they 
hit the same interpreter twice in a row (e.g. to test the closure effect), 
apparently the current implementation doesn't work well on several platforms, 
win32 included.

If somebody (preferrably on a platform that has this problem) can look at this 
issue and resolve it, that would be a great help.

You can find the code in Apache-Test/lib/Apache/TestRequest.pm and you have 
several tests that use it (grep for 'same_interp_tie'). The currently used 
algorithm is very simple: the first request stores the unique id of the perl 
interpreter in the response headers and on the following requests the client 
supplies this header. Apache::TestRequest resubmits the request again and 
again till it hits the same interpreter and only then returns the response to 
the client. After TRY_TIMES (50) it'll give up and return an error. I'm not 
sure whether raising of this number to let's say 500 will help to solve the 
problem.

Your help is appreciated.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cvs version make test errors

2003-03-20 Thread Jie Gao
On Fri, 21 Mar 2003, Stas Bekman wrote:

 Date: Fri, 21 Mar 2003 14:09:11 +1100
 From: Stas Bekman [EMAIL PROTECTED]
 To: Jie Gao [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: cvs version make test errors

 Jie Gao wrote:
  Hi All,
 
  I got a version from cvs today and make test fails with:

  special_blocks.ok 5/12unable to find interp 
  de76d477-58b9-0310-b94d-dd991812e62e

 Thanks Jie.

 Your bug report missing the mod_perl and apache information. You should have
 run t/REPORT to get this as explained here:
 http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
 I can't tell whether you are running a threaded-mpm or a prefork.

 However, this is not a bug in mod_perl, but a current limitation in one of the
 testing framework functionalities. Certain tests need to make sure that they
 hit the same interpreter twice in a row (e.g. to test the closure effect),
 apparently the current implementation doesn't work well on several platforms,
 win32 included.

 If somebody (preferrably on a platform that has this problem) can look at this
 issue and resolve it, that would be a great help.

 You can find the code in Apache-Test/lib/Apache/TestRequest.pm and you have
 several tests that use it (grep for 'same_interp_tie'). The currently used
 algorithm is very simple: the first request stores the unique id of the perl
 interpreter in the response headers and on the following requests the client
 supplies this header. Apache::TestRequest resubmits the request again and
 again till it hits the same interpreter and only then returns the response to
 the client. After TRY_TIMES (50) it'll give up and return an error. I'm not
 sure whether raising of this number to let's say 500 will help to solve the
 problem.

 Your help is appreciated.

Guess what, I ran the test again, it passed. :-) I figure this had to
do with the load of the machine.

Anyway, I was using threaded-mpm with apache 2.0.44.

Many thanks,


Jie



Re: cvs version make test errors

2003-03-20 Thread Stas Bekman
Jie Gao wrote:

I got a version from cvs today and make test fails with:

special_blocks.ok 5/12unable to find interp de76d477-58b9-0310-b94d-dd991812e62e
Thanks Jie.

Your bug report missing the mod_perl and apache information. You should have
run t/REPORT to get this as explained here:
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
I can't tell whether you are running a threaded-mpm or a prefork.
However, this is not a bug in mod_perl, but a current limitation in one of the
testing framework functionalities. Certain tests need to make sure that they
hit the same interpreter twice in a row (e.g. to test the closure effect),
apparently the current implementation doesn't work well on several platforms,
win32 included.
If somebody (preferrably on a platform that has this problem) can look at this
issue and resolve it, that would be a great help.
You can find the code in Apache-Test/lib/Apache/TestRequest.pm and you have
several tests that use it (grep for 'same_interp_tie'). The currently used
algorithm is very simple: the first request stores the unique id of the perl
interpreter in the response headers and on the following requests the client
supplies this header. Apache::TestRequest resubmits the request again and
again till it hits the same interpreter and only then returns the response to
the client. After TRY_TIMES (50) it'll give up and return an error. I'm not
sure whether raising of this number to let's say 500 will help to solve the
problem.
Your help is appreciated.


Guess what, I ran the test again, it passed. :-) I figure this had to
do with the load of the machine.
Anyway, I was using threaded-mpm with apache 2.0.44.
Thanks. However this still needs to be fixed, as random failures aren't good 
enough.



__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


RE: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-05 Thread Beau E. Cox


 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 04, 2003 9:23 PM
 To: Beau E. Cox
 Cc: Modperl
 Subject: Re: [mp2] apache/mod_perl starup failure using cvs 09
 
 
 [...]
 
 why does Mason needs $r at the server startup? There is no
 request object at
 the server startup, so it's only fair that mp reports the error.
 
 [...]
 
  Would you have and suggestions from the mod_perl perspective?
  I will take this query over to mason if you feel that is where
  it belongs - but I'll need some further insight into the mod_perl
  changes.
 
 I see what you mean. In mp1 you relied on Apache-request's not 
 being defined 
 as a side-effect to test whether you are inside request or not.
 
 I will explain why I've chosen to croak, rather than return 'undef'.
 
 In mp1 Apache-request was either undef (outside of request) or 
 $r (during the 
 request). You couldn't control that. In mp2 in order to optimize things, 
 keeping the global request around is optional. So if you don't 
 need it you get 
 some speed improvement.
 
 So if the user has the global request setting off and 
 Apache-request returns 
 undef, he may think that he is not inside the request phases 
 (precisely what 
 mason does), which is wrong.
 
 Therefore if you still wish to rely on this (which is no longer 
 always valid 
 under mp2), you can do:
 
eval { $r = Apache-request}
 
 to trap the croak.
 
 may be you should use something else as a predicate to calling 
 Apache-request. For example you could use:
 
 ModPerl::Util::current_callback() to figure out where you are. 
 Though it'll 
 incur a checking of several options. So perhaps we need a new 
 method or may be 
 not. Ideas are welcome.
 
 Philippe has agreed with my reasoning when I've suggested the change and 
 nobody else has objected (or had any opinion at all), so it went 
 in. Since 
 nothing is cast is stone (yet) on the mp2 API, you may suggest your 
 explanation why it should behave differently if you think that my 
 idea is wrong.
 
 __
 Stas BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com
 

Yea, Stas, I clearly see your reasoning. However, this is not a change
of behaviour between mp1 and mp2, but rather between mp2-08 and the
current cvs (09). I will continue using mp2-08 and talk to the mason
list - but it seems that folks over there are not too anxious to
do much in the line of mp2 development until the 'request' is converted.

My only concern is that mp2 and mason will eventually work well
together - I feel a little like I am caught in the middle ;)

Please don't spend any more time on this until I get a mason answer.

Aloha = Beau; 



Re: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-05 Thread Stas Bekman
Beau E. Cox wrote:
Yea, Stas, I clearly see your reasoning. However, this is not a change
of behaviour between mp1 and mp2, but rather between mp2-08 and the
current cvs (09). 
since 09  08, it *is* a change in behaviour between mp1 and mp2 ;) though 
potentially not the final one.

I will continue using mp2-08 and talk to the mason
meanwhile you can continue using the lates cvs, but add to the beginning of 
your startup to cheat on the latest change:

require Apache::RequestUtil;
no warnings 'redefine';
my $sub = *Apache::request{CODE};
*Apache::request = sub {
my $r;
eval { $r = $sub-('Apache'); };
# warn $@ if $@;
return $r;
};
list - but it seems that folks over there are not too anxious to
do much in the line of mp2 development until the 'request' is converted.
You mean Apache::Request?

My only concern is that mp2 and mason will eventually work well
together - I feel a little like I am caught in the middle ;)
if you don't mind to get frustrated here and there, that's the best position 
to learn things ;)

Please don't spend any more time on this until I get a mason answer.
;)

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


RE: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-05 Thread Beau E. Cox
Hi Stas -

 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 04, 2003 10:45 PM
 To: Beau E. Cox
 Cc: Modperl
 Subject: Re: [mp2] apache/mod_perl starup failure using cvs 09


 Beau E. Cox wrote:
  Yea, Stas, I clearly see your reasoning. However, this is not a change
  of behaviour between mp1 and mp2, but rather between mp2-08 and the
  current cvs (09).

 since 09  08, it *is* a change in behaviour between mp1 and mp2
 ;) though
 potentially not the final one.

  I will continue using mp2-08 and talk to the mason

 meanwhile you can continue using the lates cvs, but add to the
 beginning of
 your startup to cheat on the latest change:

 require Apache::RequestUtil;
 no warnings 'redefine';
 my $sub = *Apache::request{CODE};
 *Apache::request = sub {
  my $r;
  eval { $r = $sub-('Apache'); };
  # warn $@ if $@;
  return $r;
 };

  list - but it seems that folks over there are not too anxious to
  do much in the line of mp2 development until the 'request' is converted.

 You mean Apache::Request?

Yes...

 [...]

Your fix works perfectly - I'm a happy camper. I passed our discussion
to the mason list - will keep you folks informed.

Aloha = Beau;

PS: Have you ever noticed the closer your deadline becomes, the more
things go wrong and the more mistakes you make?




[mp2] apache/mod_perl starup failure using cvs 09

2003-03-04 Thread Beau E. Cox

-8-- Start Bug Report 8--
1. Problem Description:

  Sorry - is this mason's problem?

  Apache does not start using latest mod_perl2 (cvs) when
  using a mason startup script.

  Failure matrix:

  mod_perl version   mason version  using startup.pl  using simple-mason.pl
OK?
  --

  08-source  1.16   yes   yes
OK
  08-source  1.19   yes   yes
OK
  09-cvs 1.19   yes   yes
FAIL
  09-cvs 1.16   yes   yes
FAIL
  09-cvs 1.19   no-in httpd   no mason
OK
  09-cvs 1.19   no-in httpd   no-in httpd
OK

  Apache startup console output:

[Tue Mar 04 16:45:09 2003] [error] Global $r object is not available. Set:
PerlOptions +GlobalRequest
in httpd.conf at /usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm
line 573.
Compilation failed in require at (eval 3) line 1.

[Tue Mar 04 16:45:09 2003] [error] Can't load Perl file:
/srv/www/conf/simple-mason.pl for server TOMOKO.beaucox.com:0, exiting...

  Apache error.log - no entries
  Apache rcapache.log - Syntax OK
  Apache access.log - no entries

  mod_perl/mason (1.19) relevant entries in httpd.conf:

LoadModule perl_module /srv/www/modules/mod_perl.so
PerlRequire /srv/www/conf/startup.pl

Alias /perl/ /srv/www/perl/
Location /perl/
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  Options +ExecCGI
/Location

PerlRequire /srv/www/conf/simple-mason.pl

FilesMatch \.html$
SetHandler perl-script
PerlHandler MyMason::MyApp
/FilesMatch

  /srv/www/conf/startup.pl

use Apache2 ();

use lib qw(/srv/www/perl);

use Apache::compat ();

use ModPerl::Util (); #for CORE::GLOBAL::exit

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();

use Apache::Session ();
use CGI::Cookie ();

use APR::Table ();

use ModPerl::Registry ();

use Apache::Const -compile = ':common';
use APR::Const -compile = ':common';

1;

  /srv/www/conf/simple-mason.pl

#!/usr/bin/perl
#
# A basic, functional Mason handler.pl.
#
package MyMason::MyApp;
#
# Setup for mod_perl 2
use Apache2 ();
use Apache::compat ();
# Preload CGI since we are using it for mod_perl 2
use CGI ();
# Bring in Mason with Apache support.
use HTML::Mason::ApacheHandler;
use strict;
#
# List of modules that you want to use within components.
{
  package HTML::Mason::Commands;
  use Data::Dumper;
}
# Create ApacheHandler object at startup.
my $ah =
  HTML::Mason::ApacheHandler-new (
args_method = CGI,
comp_root   = /srv/www/htdocs,
data_dir= /srv/www/mason,
error_mode  = 'output',
  );
#
sub handler
{
  my ($r) = @_;
  my $status = $ah-handle_request($r);
  return $status;
}
#
1;

  HTML::Mason::ApacheHandler revelant lines:

 my $allowed_params = $class-allowed_params(%defaults, %params);

573: if ( exists $allowed_params-{comp_root} and
  my $req = $r || Apache-request )  # DocumentRoot is only available
inside requests
 {
 $defaults{comp_root} = $req-document_root;
 }


2. Used Components and their Configuration:

*** using lib/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_AP_PREFIX= /usr/local/apache2
  MP_GENERATE_XS  = 1
  MP_INST_APACHE2 = 1
  MP_LIBNAME  = mod_perl
  MP_USE_DSO  = 1
  MP_USE_STATIC   = 1


*** /usr/local/apache2/sbin/httpd -V
Server version: Apache/2.0.44
Server built:   Mar  4 2003 14:35:52
Server's Module Magic Number: 20020903:0
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/worker
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=/usr/local/apache2
 -D SUEXEC_BIN=/usr/local/apache2/bin/suexec
 -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
 -D DEFAULT_ERRORLOG=logs/error_log
 -D AP_TYPES_CONFIG_FILE=/etc/httpd/mime.types
 -D SERVER_CONFIG_FILE=/etc/httpd/httpd.conf


*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.19, archname=i586-linux-thread-multi
uname='linux amdsim5 2.4.19 #1 wed mar 27 13:57:05 utc 2002 i686 unknown
'




config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_g
dbm -Duseshrplib=true'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='cc

Re: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-04 Thread Stas Bekman
Beau E. Cox wrote:
-8-- Start Bug Report 8--
1. Problem Description:
  Sorry - is this mason's problem?

  Apache does not start using latest mod_perl2 (cvs) when
  using a mason startup script.
  Failure matrix:

  mod_perl version   mason version  using startup.pl  using simple-mason.pl
OK?
  --

  08-source  1.16   yes   yes
OK
  08-source  1.19   yes   yes
OK
  09-cvs 1.19   yes   yes
FAIL
  09-cvs 1.16   yes   yes
FAIL
  09-cvs 1.19   no-in httpd   no mason
OK
  09-cvs 1.19   no-in httpd   no-in httpd
OK
  Apache startup console output:

[Tue Mar 04 16:45:09 2003] [error] Global $r object is not available. Set:
PerlOptions +GlobalRequest
in httpd.conf at /usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm
line 573.
Compilation failed in require at (eval 3) line 1.
[...]

  HTML::Mason::ApacheHandler revelant lines:

 my $allowed_params = $class-allowed_params(%defaults, %params);

573: if ( exists $allowed_params-{comp_root} and
  my $req = $r || Apache-request )  # DocumentRoot is only available
why does Mason needs $r at the server startup? There is no request object at 
the server startup, so it's only fair that mp reports the error.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


RE: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-04 Thread Beau E. Cox
Hi Stas -

 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 04, 2003 6:18 PM
 To: Beau E. Cox
 Cc: Modperl
 Subject: Re: [mp2] apache/mod_perl starup failure using cvs 09


 Beau E. Cox wrote:
  -8-- Start Bug Report 8--
  1. Problem Description:
 
Sorry - is this mason's problem?
 
Apache does not start using latest mod_perl2 (cvs) when
using a mason startup script.
 
Failure matrix:
 
mod_perl version   mason version  using startup.pl  using
 simple-mason.pl
  OK?
 
 --
  
08-source  1.16   yes   yes
  OK
08-source  1.19   yes   yes
  OK
09-cvs 1.19   yes   yes
  FAIL
09-cvs 1.16   yes   yes
  FAIL
09-cvs 1.19   no-in httpd   no mason
  OK
09-cvs 1.19   no-in httpd   no-in httpd
  OK
 
Apache startup console output:
 
  [Tue Mar 04 16:45:09 2003] [error] Global $r object is not
 available. Set:
  PerlOptions +GlobalRequest
  in httpd.conf at
 /usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm
  line 573.
  Compilation failed in require at (eval 3) line 1.

 [...]

HTML::Mason::ApacheHandler revelant lines:
 
   my $allowed_params = $class-allowed_params(%defaults, %params);
 
  573: if ( exists $allowed_params-{comp_root} and
my $req = $r || Apache-request )  # DocumentRoot is only
 available

 why does Mason needs $r at the server startup? There is no
 request object at
 the server startup, so it's only fair that mp reports the error.

 __
 Stas BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com



Good point. However, I seemed to have given you the code of
mason's ApacheHandler out of context; the snip above is from the
'new' method which I use in setting up the mason handler routine:

# Create ApacheHandler object at startup.
my $ah =
  HTML::Mason::ApacheHandler-new (
args_method = CGI,
comp_root   = /srv/www/htdocs,
data_dir= /srv/www/mason,
error_mode  = 'output',
  );

In this trivial case it doesn't seem worthwhile to go to all
that trouble, but, as in my production server, when working
with a lot of (possible dynamic) vhosts, it works well.

If the Apache-request (or a request passed as the last -
odd - parameter to new) is defined, some further processing
occurs; but at startup, the request is neither expected to
be there nor needed.

I guess (looking at my result matrix) that some change was made
to mod_perl to prohibit even querying the presence of
Apache-request at startup. So now I (and other mason folks)
must find another way to instantiate handlers.

Would you have and suggestions from the mod_perl perspective?
I will take this query over to mason if you feel that is where
it belongs - but I'll need some further insight into the mod_perl
changes.

Aloha = Beau;




Re: [mp2] apache/mod_perl starup failure using cvs 09

2003-03-04 Thread Stas Bekman
[...]

why does Mason needs $r at the server startup? There is no
request object at
the server startup, so it's only fair that mp reports the error.
[...]

Good point. However, I seemed to have given you the code of
mason's ApacheHandler out of context; the snip above is from the
'new' method which I use in setting up the mason handler routine:
# Create ApacheHandler object at startup.
my $ah =
  HTML::Mason::ApacheHandler-new (
args_method = CGI,
comp_root   = /srv/www/htdocs,
data_dir= /srv/www/mason,
error_mode  = 'output',
  );
In this trivial case it doesn't seem worthwhile to go to all
that trouble, but, as in my production server, when working
with a lot of (possible dynamic) vhosts, it works well.
If the Apache-request (or a request passed as the last -
odd - parameter to new) is defined, some further processing
occurs; but at startup, the request is neither expected to
be there nor needed.
I guess (looking at my result matrix) that some change was made
to mod_perl to prohibit even querying the presence of
Apache-request at startup. So now I (and other mason folks)
must find another way to instantiate handlers.
Would you have and suggestions from the mod_perl perspective?
I will take this query over to mason if you feel that is where
it belongs - but I'll need some further insight into the mod_perl
changes.
I see what you mean. In mp1 you relied on Apache-request's not being defined 
as a side-effect to test whether you are inside request or not.

I will explain why I've chosen to croak, rather than return 'undef'.

In mp1 Apache-request was either undef (outside of request) or $r (during the 
request). You couldn't control that. In mp2 in order to optimize things, 
keeping the global request around is optional. So if you don't need it you get 
some speed improvement.

So if the user has the global request setting off and Apache-request returns 
undef, he may think that he is not inside the request phases (precisely what 
mason does), which is wrong.

Therefore if you still wish to rely on this (which is no longer always valid 
under mp2), you can do:

  eval { $r = Apache-request}

to trap the croak.

may be you should use something else as a predicate to calling 
Apache-request. For example you could use:

ModPerl::Util::current_callback() to figure out where you are. Though it'll 
incur a checking of several options. So perhaps we need a new method or may be 
not. Ideas are welcome.

Philippe has agreed with my reasoning when I've suggested the change and 
nobody else has objected (or had any opinion at all), so it went in. Since 
nothing is cast is stone (yet) on the mp2 API, you may suggest your 
explanation why it should behave differently if you think that my idea is wrong.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


cvs commit: modperl-2.0/lib/ModPerl BuildOptions.pm

2003-02-20 Thread randyk
randyk  2003/02/19 21:19:14

  Modified:lib/ModPerl BuildOptions.pm
  Log:
  Reviewed by: stas
  
  Revision  ChangesPath
  1.17  +7 -0  modperl-2.0/lib/ModPerl/BuildOptions.pm
  
  Index: BuildOptions.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildOptions.pm,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BuildOptions.pm   21 May 2002 16:48:29 -  1.16
  +++ BuildOptions.pm   20 Feb 2003 05:19:14 -  1.17
  @@ -3,6 +3,7 @@
   use strict;
   use warnings;
   
  +use Apache::Build ();
   my $param_qr = qr([\s=]+);
   
   use constant VERBOSE = 1;
  @@ -66,6 +67,12 @@
   if($key eq 'MP_APXS') {
   $val = File::Spec-canonpath(File::Spec-rel2abs($val));
   }
  +
  + # MP_AP_PREFIX may not contain spaces
  + if ($key eq 'MP_AP_PREFIX'  Apache::Build::WIN32()) {
  +require Win32;
  + $val = Win32::GetShortPathName($val);
  + }
   
   if ($self-{$key}) {
   $self-{$key} .= ' ';
  
  
  



cvs commit: modperl Makefile.PL

2003-02-20 Thread randyk
randyk  2003/02/20 08:34:35

  Modified:.Makefile.PL
  Log:
  Reviewed by:  stas
  
  Enable PERL_SECTIONS for Win32
  
  Revision  ChangesPath
  1.207 +2 -1  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.206
  retrieving revision 1.207
  diff -u -r1.206 -r1.207
  --- Makefile.PL   20 Feb 2003 16:28:35 -  1.206
  +++ Makefile.PL   20 Feb 2003 16:34:35 -  1.207
  @@ -792,7 +792,8 @@
(need 1.2.0 or higher);
   }
   
  -$PERL_SECTIONS = $PERL_SSI = 0 if $Is_Win32;
  +#$PERL_SECTIONS = $PERL_SSI = 0 if $Is_Win32;
  +$PERL_SSI = 0 if $Is_Win32;
   unless ($Is_Win32) {
 for (qw(PERL_SECTIONS PERL_SSI), keys %experimental) {
$k = $_;
  
  
  



cvs commit: modperl Makefile.PL

2003-02-20 Thread randyk
randyk  2003/02/20 08:42:46

  Modified:.Makefile.PL
  Log:
  Reviewed by:  stas
  
  Use Perl's touch(), in case a system touch() isn't available.
  
  Revision  ChangesPath
  1.208 +5 -1  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.207
  retrieving revision 1.208
  diff -u -r1.207 -r1.208
  --- Makefile.PL   20 Feb 2003 16:34:35 -  1.207
  +++ Makefile.PL   20 Feb 2003 16:42:46 -  1.208
  @@ -1602,7 +1602,11 @@
my $to = '$(INST_ARCHLIB)/' . auto/Apache/include/$_;
unless ($self-{PM}-{$from}) {
$self-{PM}-{$from} = $to;
  - system $Config{touch} $from;
  +#system $Config{touch} $from;
  + my @args = ($Config{perlpath}, '-MExtUtils::Command', 
  + '-e', 'touch', $from);
  + system(@args) == 0
  + or die system @args failed: $?;
}
   }
   
  
  
  



Re: cvs commit: modperl Makefile.PL

2003-02-20 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
randyk  2003/02/20 08:42:46

  Modified:.Makefile.PL
  Log:
  Reviewed by:	stas
  
  Use Perl's touch(), in case a system touch() isn't available.
  
  Revision  ChangesPath
  1.208 +5 -1  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.207
  retrieving revision 1.208
  diff -u -r1.207 -r1.208
  --- Makefile.PL	20 Feb 2003 16:34:35 -	1.207
  +++ Makefile.PL	20 Feb 2003 16:42:46 -	1.208
   -1602,7 +1602,11 
   	my $to = '$(INST_ARCHLIB)/' . auto/Apache/include/$_;
   	unless ($self-{PM}-{$from}) {
   	$self-{PM}-{$from} = $to;
  -	system $Config{touch} $from;
  +#	system $Config{touch} $from;
  +	my args = ($Config{perlpath}, '-MExtUtils::Command', 
  +		'-e', 'touch', $from);
  +	system(args) == 0
  +	or die system args failed: $?;
   	}
   }
since we use cvs, we don't commented out snippets of the older code that was 
replaced with the new one. If in the future we realize the the recent change 
broke something we can always revert to the previous version. So please remove 
this commented out line and the same in your other commit on PERL_SECTIONS. 
Thanks.

BTW, in case you were wondering. the style guide doesn't apply to the modperl 
(1.0) rep, since it's all a mess. We try to keep it clean for 2.0 from the 
very beginning.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


cvs commit: modperl-2.0/t/response/TestCompat conn_authen.pm

2003-02-19 Thread geoff
geoff   2003/02/19 06:14:36

  Modified:.Changes
   lib/Apache compat.pm
   t/response/TestCompat conn_authen.pm
  Log:
  fixes to Apache::compat. make $r-connection-auth_type interface
  with r-ap_auth_type. make both $r-connection-auth_type and
  $r-connection-user writable
  Submitted by: geoff
  Reviewed by:  stas
  
  Revision  ChangesPath
  1.129 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- Changes   19 Feb 2003 14:12:01 -  1.128
  +++ Changes   19 Feb 2003 14:14:35 -  1.129
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +fixes to Apache::compat. make $r-connection-auth_type interface
  +with r-ap_auth_type. make both $r-connection-auth_type and
  +$r-connection-user writable. [Geoffrey Young]
  +
   Open up r-ap_auth_type, making it possible to write custom
   authen handlers that don't rely on Basic authentication or
   it's associated ap_* functions.
  
  
  
  1.80  +2 -2  modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- compat.pm 17 Feb 2003 09:47:31 -  1.79
  +++ compat.pm 19 Feb 2003 14:14:36 -  1.80
  @@ -538,8 +538,8 @@
   
   # auth_type and user records don't exist in 2.0 conn_rec struct
   # 'PerlOptions +GlobalRequest' is required
  -sub auth_type { Apache-request-auth_type }
  -sub user  { Apache-request-user  }
  +sub auth_type { shift; Apache-request-ap_auth_type(@_) }
  +sub user  { shift; Apache-request-user(@_)  }
   
   1;
   __END__
  
  
  
  1.2   +33 -5 modperl-2.0/t/response/TestCompat/conn_authen.pm
  
  Index: conn_authen.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/conn_authen.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- conn_authen.pm12 Feb 2003 23:42:23 -  1.1
  +++ conn_authen.pm19 Feb 2003 14:14:36 -  1.2
  @@ -1,6 +1,6 @@
   package TestCompat::conn_authen;
   
  -# simply check that we can retrieve:
  +# compat checks for
   #   $r-connection-auth_type
   #   $r-connection-user
   # both records don't exist in 2.0 conn_rec and therefore require
  @@ -16,19 +16,47 @@
   use Apache::Constants qw(OK REMOTE_HOST);
   
   sub handler {
  +
   my $r = shift;
   
  +my $req_auth_type = $r-connection-auth_type || '';
  +
  +die request auth_type is '$req_auth_type', should be empty
  +if $req_auth_type;
  +
  +# get_basic_auth_pw populates $r-user and $r-ap_auth_type
   my($rc, $sent_pw) = $r-get_basic_auth_pw;
   
   return $rc if $rc != Apache::OK;
   
  -my $auth_type = $r-connection-auth_type || '';
  -die auth_type is '$auth_type', should be 'Basic' 
  -unless $auth_type eq 'Basic';
  +$req_auth_type = $r-connection-auth_type || '';
  +
  +die request auth_type is '$req_auth_type', should be 'Basic'
  +unless $req_auth_type eq 'Basic';
  +
  +my $config_auth_type = $r-auth_type || '';
  +
  +die httpd.conf auth_type is '$config_auth_type', should be 'Basic'
  +unless $config_auth_type eq 'Basic';
   
   my $user = $r-connection-user || '';
  -die user is '$user', while expecting 'dougm'
  +
  +die user is '$user', should be 'dougm'
   unless $user eq 'dougm';
  +
  +# make sure we can set both
  +$r-connection-auth_type('sailboat');
  +$r-connection-user('geoff');
  +
  +$user = $r-connection-user || '';
  +
  +die user is '$user', should be 'geoff'
  +unless $user eq 'geoff';
  +
  +$req_auth_type = $r-connection-auth_type || '';
  +
  +die request auth_type is '$req_auth_type', should be 'sailboat'
  +unless $req_auth_type eq 'sailboat';
   
   OK;
   }
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-02-19 Thread stas
stas2003/02/19 15:55:23

  Modified:.Changes
   lib/Apache compat.pm
   t/response/TestCompat apache.pm
   xs/Apache/Response Apache__Response.h
   xs/maps  modperl_functions.map
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  move $r-send_http_header implementation to Apache::compat.  This
  allows the 1.0 code to run unmodified if $r-send_http_header is
  called before the response change. we already handle the check whether
  content_type was set, when deciding whether the headers are to be
  parsed inside modperl_wbucket_pass().
  
  Revision  ChangesPath
  1.130 +6 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- Changes   19 Feb 2003 14:14:35 -  1.129
  +++ Changes   19 Feb 2003 23:55:22 -  1.130
  @@ -10,6 +10,12 @@
   
   =item 1.99_09-dev
   
  +move $r-send_http_header implementation to Apache::compat.  This
  +allows the 1.0 code to run unmodified if $r-send_http_header is
  +called before the response change. we already handle the check whether
  +content_type was set, when deciding whether the headers are to be
  +parsed inside modperl_wbucket_pass(). [Stas]
  +
   fixes to Apache::compat. make $r-connection-auth_type interface
   with r-ap_auth_type. make both $r-connection-auth_type and
   $r-connection-user writable. [Geoffrey Young]
  
  
  
  1.81  +5 -0  modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- compat.pm 19 Feb 2003 14:14:36 -  1.80
  +++ compat.pm 19 Feb 2003 23:55:23 -  1.81
  @@ -154,6 +154,11 @@
   return Apache::current_callback();
   }
   
  +sub send_http_header {
  +my ($r, $type) = @_;
  +$r-content_type($type) if defined $type;
  +}
  +
   #to support $r-server_root_relative
   *server_root_relative = \Apache::server_root_relative;
   
  
  
  
  1.5   +3 -0  modperl-2.0/t/response/TestCompat/apache.pm
  
  Index: apache.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apache.pm 17 Feb 2003 09:03:17 -  1.4
  +++ apache.pm 19 Feb 2003 23:55:23 -  1.5
  @@ -55,3 +55,6 @@
   
   1;
   
  +__END__
  +# so we can test whether send_httpd_header() works fine
  +PerlOptions +ParseHeaders
  
  
  
  1.9   +0 -22 modperl-2.0/xs/Apache/Response/Apache__Response.h
  
  Index: Apache__Response.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Response/Apache__Response.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Apache__Response.h17 Jan 2003 02:26:31 -  1.8
  +++ Apache__Response.h19 Feb 2003 23:55:23 -  1.9
  @@ -13,28 +13,6 @@
   rcfg-wbucket-header_parse = 0; \
   }
   
  -/* XXX: should only be part of Apache::compat */
  -static MP_INLINE void
  -mpxs_Apache__RequestRec_send_http_header(pTHX_ request_rec *r,
  - const char *type)
  -{
  -MP_dRCFG;
  -
  -if (type) {
  -ap_set_content_type(r, apr_pstrdup(r-pool, type));
  -}
  -
  -if (rcfg-wbucket) {
  -/* turn off PerlOptions +ParseHeaders */
  -rcfg-wbucket-header_parse = 0; 
  -}
  -else {
  -/* the response is not initialized yet */
  -Perl_croak(aTHX_ send_http_header() can't be called before 
  -   the response phase);
  -}
  -}
  -
   static MP_INLINE void
   mpxs_Apache__RequestRec_set_last_modified(request_rec *r, apr_time_t mtime)
   {
  
  
  
  1.54  +0 -1  modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- modperl_functions.map 17 Feb 2003 09:03:17 -  1.53
  +++ modperl_functions.map 19 Feb 2003 23:55:23 -  1.54
  @@ -56,7 +56,6 @@
   
   MODULE=Apache::Response   PACKAGE=Apache::RequestRec
   DEFINE_send_cgi_header | | request_rec *:r, SV *:buffer
  - mpxs_Apache__RequestRec_send_http_header | | r, type=NULL
mpxs_Apache__RequestRec_set_last_modified | | r, mtime=0
   
   
  
  
  
  1.105 +0 -18 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm

cvs commit: modperl-2.0 STATUS

2003-02-19 Thread stas
stas2003/02/19 16:41:51

  Modified:.STATUS
  Log:
  need to resolve the issue with END blocks
  
  Revision  ChangesPath
  1.34  +5 -1  modperl-2.0/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/modperl-2.0/STATUS,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- STATUS15 Jan 2003 05:22:53 -  1.33
  +++ STATUS20 Feb 2003 00:41:51 -  1.34
  @@ -50,6 +50,10 @@
   Needs Patch or Further Investigation:
   -
   
  +* child processes never run END blocks. a good example is
  +  Apache::TestUtil, which doesn't cleanup files and dirs it has
  +  created, because the END block is not run.
  +
   * Currently modperl_filter_add_{connection|request} check the filter
 handler function attrs before accepting the filter. If the module
 wasn't preloaded the check fails and filter handler is skipped. We
  
  
  



cvs commit: modperl-2.0 Changes

2003-02-19 Thread stas
stas2003/02/19 17:28:25

  Modified:t/response/TestAPI uri.pm
   xs/APR/URI APR__URI.h
   .Changes
  Log:
  fix a bug for apr  0.9.3, where it segfaults in apr_uri_unparse, if
  hostname is set, but not the scheme.
  
  Revision  ChangesPath
  1.9   +13 -1 modperl-2.0/t/response/TestAPI/uri.pm
  
  Index: uri.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/uri.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- uri.pm14 May 2002 01:32:50 -  1.8
  +++ uri.pm20 Feb 2003 01:28:24 -  1.9
  @@ -4,6 +4,7 @@
   use warnings FATAL = 'all';
   
   use Apache::Test;
  +use Apache::TestUtil;
   
   use APR::URI ();
   use Apache::URI ();
  @@ -17,7 +18,7 @@
   sub handler {
   my $r = shift;
   
  -plan $r, tests = 14;
  +plan $r, tests = 15;
   
   $r-args('query');
   
  @@ -49,6 +50,17 @@
   $parsed-path($path);
   
   ok $parsed-path eq $path;
  +
  +{
  +# test the segfault in apr  0.9.3 (fixed on mod_perl side)
  +# passing only the /path
  +my $parsed = APR::URI-parse($r-pool, $r-uri);
  +# set hostname, but not the scheme
  +$parsed-hostname($r-get_server_name);
  +$parsed-port($r-get_server_port);
  +#$parsed-scheme('http'); 
  +ok t_cmp($r-construct_url, $parsed-unparse);
  +}
   
   my $newr = Apache::RequestRec-new($r-connection, $r-pool);
   my $url_string = $path?query;
  
  
  
  1.5   +9 -0  modperl-2.0/xs/APR/URI/APR__URI.h
  
  Index: APR__URI.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/URI/APR__URI.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- APR__URI.h14 May 2002 01:32:50 -  1.4
  +++ APR__URI.h20 Feb 2003 01:28:24 -  1.5
  @@ -3,6 +3,15 @@
  apr_uri_t *uptr,
  unsigned flags)
   {
  +
  +/* XXX: check that my patch was actually applied in apr v9.3 */
  +#if APR_MINOR_VERSION == 9  APR_PATCH_VERSION  3
  +/* apr  0.9.3 segfaults if hostname is set, but scheme is not */
  +if (uptr-hostname  !uptr-scheme) {
  +uptr-scheme = http;
  +}
  +#endif
  +
   return apr_uri_unparse(((modperl_uri_t *)uptr)-pool,
  uptr, flags);
   }
  
  
  
  1.131 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- Changes   19 Feb 2003 23:55:22 -  1.130
  +++ Changes   20 Feb 2003 01:28:25 -  1.131
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +fix a bug for apr  0.9.3, where it segfaults in apr_uri_unparse, if
  +hostname is set, but not the scheme. [Stas]
  +
   move $r-send_http_header implementation to Apache::compat.  This
   allows the 1.0 code to run unmodified if $r-send_http_header is
   called before the response change. we already handle the check whether
  
  
  



cvs commit: modperl Changes

2003-02-19 Thread stas
stas2003/02/19 21:21:56

  Modified:src/modules/perl Apache.xs
   .Changes
  Log:
  can't let the default typemap rule to convert sv into char* in
  unescape_url, since it doesn't handle correctly undefs (returns an
  unallocated  string, which then causes a segfault in
  ap_unescape_url. use SvPV_force, instead, which does the right
  thing.
  
  Revision  ChangesPath
  1.126 +5 -2  modperl/src/modules/perl/Apache.xs
  
  Index: Apache.xs
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- Apache.xs 6 Jul 2001 20:33:35 -   1.125
  +++ Apache.xs 20 Feb 2003 05:21:55 -  1.126
  @@ -655,8 +655,11 @@
   Apache r
   
   char *
  -unescape_url(string)
  -char *string
  +unescape_url(sv)
  +SV *sv
  +
  +INIT:
  +char *string = SvPV_force(sv, PL_na);
   
   CODE:
   unescape_url(string);
  
  
  
  1.662 +6 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.661
  retrieving revision 1.662
  diff -u -r1.661 -r1.662
  --- Changes   19 Feb 2003 02:38:21 -  1.661
  +++ Changes   20 Feb 2003 05:21:55 -  1.662
  @@ -10,6 +10,12 @@
   
   =item 1.27_01-dev
   
  +can't let the default typemap rule to convert sv into char* in
  +unescape_url, since it doesn't handle correctly undefs (returns an
  +unallocated  string, which then causes a segfault in
  +ap_unescape_url. use SvPV_force, instead, which does the right
  +thing. [Stas Bekman]
  +
   Make sure to start perl, if it's not running, before processing Perl*
   directives, with threaded perl and PERL_STACKED_HANDLERS=0 [Stas
   Bekman]
  
  
  



cvs commit: modperl/t/net/perl util.pl

2003-02-19 Thread stas
stas2003/02/19 22:48:05

  Modified:t/net/perl util.pl
  Log:
  add tests for Apache::unescape_url
  
  Revision  ChangesPath
  1.16  +20 -1 modperl/t/net/perl/util.pl
  
  Index: util.pl
  ===
  RCS file: /home/cvs/modperl/t/net/perl/util.pl,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- util.pl   19 Jun 2002 16:31:52 -  1.15
  +++ util.pl   20 Feb 2003 06:48:04 -  1.16
  @@ -3,7 +3,7 @@
   use Apache::test;
   $|++;
   my $i = 0;
  -my $tests = 7;
  +my $tests = 9;
   
   my $r = shift;
   $r-send_http_header('text/plain');
  @@ -100,6 +100,25 @@
   Perl = sub { my $esc = URI::Escape::uri_escape($uri) },
   });  
   =cut
  +
  +{
  +my $str = aa%20dd%2epl;
  +my $expected = aa dd.pl;
  +my $received = Apache::unescape_url($str);
  +test ++$i, $received eq $expected;
  +print expected: $expected\n;
  +print received: $received\n;
  +}
  +
  +{
  +my $str = undef;
  +my $expected = ;
  +no warnings;
  +my $received = Apache::unescape_url($str);
  +test ++$i, $received eq $expected;
  +print expected: $expected\n;
  +print received: $received\n;
  +}
   
   $C = Apache::Util::ht_time();
   $Perl = HTTP::Date::time2str();
  
  
  



cvs commit: modperl/Apache Apache.pm

2003-02-19 Thread stas
stas2003/02/19 22:52:10

  Modified:Apache   Apache.pm
  Log:
  add a note that the original string passed to Apache::unescape_url is
  mangled, so only the return value should be used.
  
  Revision  ChangesPath
  1.73  +6 -1  modperl/Apache/Apache.pm
  
  Index: Apache.pm
  ===
  RCS file: /home/cvs/modperl/Apache/Apache.pm,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- Apache.pm 13 Aug 2002 03:18:48 -  1.72
  +++ Apache.pm 20 Feb 2003 06:52:10 -  1.73
  @@ -1209,7 +1209,12 @@
   
   =item Apache::unescape_url($string)
   
  -Handy function for unescapes.  Use this one for filenames/paths.
  +  $unescaped_url = Apache::unescape_url($string)
  +
  +Handy function for unescapes.  Use this one for
  +filenames/paths. Notice that the original C$string is mangled in the
  +process (because it shrinks).
  +
   Use unescape_url_info for the result of submitted form data.
   
   =item Apache::unescape_url_info($string)
  
  
  



cvs commit: modperl/Apache Apache.pm

2003-02-19 Thread stas
stas2003/02/19 22:54:23

  Modified:Apache   Apache.pm
  Log:
  add the reason why the variable gets rendered invalid on
  Apache::unescape_url
  
  Revision  ChangesPath
  1.74  +2 -1  modperl/Apache/Apache.pm
  
  Index: Apache.pm
  ===
  RCS file: /home/cvs/modperl/Apache/Apache.pm,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- Apache.pm 20 Feb 2003 06:52:10 -  1.73
  +++ Apache.pm 20 Feb 2003 06:54:23 -  1.74
  @@ -1213,7 +1213,8 @@
   
   Handy function for unescapes.  Use this one for
   filenames/paths. Notice that the original C$string is mangled in the
  -process (because it shrinks).
  +process (because the string part of PV shrinks, but the variable is
  +not updated, to speed things up).
   
   Use unescape_url_info for the result of submitted form data.
   
  
  
  



cvs commit: modperl/t/net/perl util.pl

2003-02-19 Thread stas
stas2003/02/19 23:09:14

  Modified:t/net/perl util.pl
  Log:
  s/no warnings/local $^W = 0/, I forgot that we have to deal with perl 
  5.6 on the mod_perl 1.0 land.
  
  Revision  ChangesPath
  1.17  +1 -1  modperl/t/net/perl/util.pl
  
  Index: util.pl
  ===
  RCS file: /home/cvs/modperl/t/net/perl/util.pl,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- util.pl   20 Feb 2003 06:48:04 -  1.16
  +++ util.pl   20 Feb 2003 07:09:14 -  1.17
  @@ -113,7 +113,7 @@
   {
   my $str = undef;
   my $expected = ;
  -no warnings;
  +local $^W = 0;
   my $received = Apache::unescape_url($str);
   test ++$i, $received eq $expected;
   print expected: $expected\n;
  
  
  



cvs commit: modperl-2.0/lib/Bundle - New directory

2003-02-18 Thread stas
stas2003/02/18 16:32:14

  modperl-2.0/lib/Bundle - New directory



cvs commit: modperl-2.0 Changes

2003-02-18 Thread stas
stas2003/02/18 16:32:45

  Modified:.Changes
  Added:   lib/Bundle Apache2.pm
  Log:
  add Apache::Bundle2
  
  Revision  ChangesPath
  1.1  modperl-2.0/lib/Bundle/Apache2.pm
  
  Index: Apache2.pm
  ===
  package Bundle::Apache2;
  
  $VERSION = '1.00';
  
  1;
  
  __END__
  
  =head1 NAME
  
  Bundle::Apache2 - Install Apache mod_perl2 and related modules
  
  =head1 SYNOPSIS
  
  Cperl -MCPAN -e 'install Bundle::Apache2'
  
  =head1 CONTENTS
  
  LWP   - Used in testing
  
  Chatbot::Eliza- Used in testing
  
  Devel::Symdump- Symbol table browsing with Apache::Status
  
  CGI   - Used in testing (it's in core, but some vendors exclude it)
  
  =head1 DESCRIPTION
  
  This bundle contains modules used by Apache mod_perl2.
  
  Asking CPAN.pm to install a bundle means to install the bundle itself
  along with all the modules contained in the CONTENTS section
  above. Modules that are up to date are not installed, of course.
  
  =head1 AUTHOR
  
  Doug MacEachern, Stas Bekman
  
  
  
  1.127 +2 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- Changes   17 Feb 2003 09:39:54 -  1.126
  +++ Changes   19 Feb 2003 00:32:45 -  1.127
  @@ -10,6 +10,8 @@
   
   =item 1.99_09-dev
   
  +add Apache::Bundle2 [Stas]
  +
   Apache::Reload now supports the PerlPreConnectionHandler invocation
   mode, so connection filter and protocol modules can be automatically
   reloaded on change. [Stas]
  
  
  



cvs commit: modperl-2.0/todo api.txt

2003-02-18 Thread stas
stas2003/02/18 20:07:17

  Modified:todo api.txt
  Log:
  $uri-rpath is missing from APR::URI
  
  Revision  ChangesPath
  1.33  +3 -0  modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- api.txt   17 Feb 2003 09:03:17 -  1.32
  +++ api.txt   19 Feb 2003 04:07:17 -  1.33
  @@ -28,6 +28,9 @@
   needs to default to current pool (pconf at startup, r-pool at request
   time)
   
  +APR::URI
  +missing $uri-rpath
  +
   Apache::Util::*
   escape_path() - (was escape_uri) can be changed in apache not to require a
   pool
  
  
  



cvs commit: modperl Changes

2003-02-18 Thread stas
stas2003/02/18 18:38:22

  Modified:src/modules/perl perl_config.c
   .Changes
  Log:
  Make sure to start perl, if it's not running, before processing Perl*
  directives, with threaded perl and PERL_STACKED_HANDLERS=0
  
  Revision  ChangesPath
  1.115 +9 -5  modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- perl_config.c 24 Mar 2002 22:51:04 -  1.114
  +++ perl_config.c 19 Feb 2003 02:38:21 -  1.115
  @@ -437,6 +437,13 @@
   }
   #endif
   
  +#define STARTUP_PERL_IF_NOT_RUNNING \
  +if(!PERL_RUNNING()) { \
  +perl_startup(parms-server, parms-pool); \
  +require_Apache(parms-server); \
  +MP_TRACE_g(fprintf(stderr, mod_perl: calling perl_startup()\n)); \
  +}
  +
   #ifdef PERL_STACKED_HANDLERS
   
   CHAR_P perl_cmd_push_handlers(char *hook, PERL_CMD_TYPE **cmd, char *arg, pool *p)
  @@ -456,16 +463,13 @@
   }
   
   #define PERL_CMD_PUSH_HANDLERS(hook, cmd) \
  -if(!PERL_RUNNING()) { \
  -perl_startup(parms-server, parms-pool); \
  -require_Apache(parms-server); \
  -MP_TRACE_g(fprintf(stderr, mod_perl: calling perl_startup()\n)); \
  -} \
  +STARTUP_PERL_IF_NOT_RUNNING \
   return perl_cmd_push_handlers(hook,cmd,arg,parms-pool)
   
   #else
   
   #define PERL_CMD_PUSH_HANDLERS(hook, cmd) \
  +STARTUP_PERL_IF_NOT_RUNNING \
   mp_preload_module(arg); \
   cmd = arg; \
   return NULL
  
  
  
  1.661 +6 -2  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.660
  retrieving revision 1.661
  diff -u -r1.660 -r1.661
  --- Changes   28 Jan 2003 00:30:22 -  1.660
  +++ Changes   19 Feb 2003 02:38:21 -  1.661
  @@ -10,6 +10,10 @@
   
   =item 1.27_01-dev
   
  +Make sure to start perl, if it's not running, before processing Perl*
  +directives, with threaded perl and PERL_STACKED_HANDLERS=0 [Stas
  +Bekman]
  +
   Add Apache::Module to Bundle::Apache [Stas Bekman]
   
   use $Config{'installstyle'} instead of hardcoded 'lib', to handle
  @@ -19,8 +23,8 @@
   prevent segfaults in mod_perl_mark_where() when a sub can't get
   resolved [Gerald Richter [EMAIL PROTECTED]]
   
  -Need to load B::Terse/TerseSize if it wasn't loaded yet in that child
  -before using it.  [Dan Sully [EMAIL PROTECTED]]
  +Apache::Status: Need to load B::Terse/TerseSize if it wasn't loaded
  +yet in that child before using it.  [Dan Sully [EMAIL PROTECTED]]
   
   document the server_root_relative() method [Stas Bekman [EMAIL PROTECTED]]
   
  
  
  



cvs commit: modperl-2.0/xs/maps modperl_functions.map

2003-02-17 Thread stas
stas2003/02/17 01:03:17

  Modified:.Changes
   lib/Apache compat.pm
   src/modules/perl modperl_callback.c modperl_callback.h
modperl_handler.c
   t/htdocs .cvsignore
   t/modperl .cvsignore
   t/response/TestCompat apache.pm
   todo api.txt
   xs/ModPerl/Util ModPerl__Util.h
   xs/maps  modperl_functions.map
  Added:   t/response/TestModperl current_callback.pm
  Log:
  - implement Apache::current_callback
  - $r-current_callback goes into Apache::compat, since now we have a way
too many callbacks unrelated to $r
  - add some tests
  
  Revision  ChangesPath
  1.125 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- Changes   12 Feb 2003 23:42:23 -  1.124
  +++ Changes   17 Feb 2003 09:03:16 -  1.125
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +implement Apache::current_callback + $r-current_callback goes into
  +Apache::compat, since now we have a way too many callbacks unrelated
  +to $r [Stas]
  +
   Add Apache::compat methods: $r-connection-auth_type and
   $r-connection-user (requires 'PerlOptions +GlobalRequest') + tests
   [Stas]
  
  
  
  1.78  +4 -0  modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- compat.pm 12 Feb 2003 23:42:23 -  1.77
  +++ compat.pm 17 Feb 2003 09:03:16 -  1.78
  @@ -125,6 +125,10 @@
   die $err if $err;
   }
   
  +sub current_callback {
  +return Apache::current_callback();
  +}
  +
   package Apache::Constants;
   
   use Apache::Const ();
  
  
  
  1.54  +2 -0  modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- modperl_callback.c29 Jan 2003 01:04:33 -  1.53
  +++ modperl_callback.c17 Feb 2003 09:03:16 -  1.54
  @@ -172,6 +172,8 @@
   break;
   };
   
  +modperl_callback_current_callback_set(desc);
  +
   /* XXX: deal with {push,set}_handler of the phase we're currently in */
   /* for now avoid the segfault by not letting av-nelts grow if
* somebody push_handlers to the phase we are currently in, but
  
  
  
  1.22  +9 -0  modperl-2.0/src/modules/perl/modperl_callback.h
  
  Index: modperl_callback.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- modperl_callback.h21 Feb 2002 01:45:34 -  1.21
  +++ modperl_callback.h17 Feb 2003 09:03:16 -  1.22
  @@ -10,6 +10,15 @@
   #define ap_hook_fixup  ap_hook_fixups
   #define ap_hook_logap_hook_log_transaction
   
  +#define modperl_callback_current_callback_sv \
  +get_sv(Apache::__CurrentCallback, TRUE)
  +
  +#define modperl_callback_current_callback_set(desc) \
  +sv_setpv(modperl_callback_current_callback_sv, desc)
  +
  +#define modperl_callback_current_callback_get() \
  +SvPVX(modperl_callback_current_callback_sv)
  +
   int modperl_callback(pTHX_ modperl_handler_t *handler, apr_pool_t *p,
request_rec *r, server_rec *s, AV *args);
   
  
  
  
  1.16  +1 -1  modperl-2.0/src/modules/perl/modperl_handler.c
  
  Index: modperl_handler.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_handler.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- modperl_handler.c 1 Jan 2003 03:45:54 -   1.15
  +++ modperl_handler.c 17 Feb 2003 09:03:16 -  1.16
  @@ -175,7 +175,7 @@
   }
   
   #define set_desc(dtype) \
  -MP_TRACE_a_do(if (desc) *desc = modperl_handler_desc_##dtype(idx))
  +if (desc) *desc = modperl_handler_desc_##dtype(idx)
   
   #define check_modify(dtype) \
   if ((action  MP_HANDLER_ACTION_GET)  rcfg) { \
  
  
  
  1.2   +1 -0  modperl-2.0/t/htdocs/.cvsignore
  
  Index: .cvsignore
  ===
  RCS file: /home/cvs/modperl-2.0/t/htdocs/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .cvsignore26 Feb 2002 19:09:10 -  1.1
  +++ .cvsignore17

cvs commit: modperl-2.0/xs/maps apache_functions.map

2003-02-17 Thread stas
stas2003/02/17 01:49:05

  Modified:xs/maps  apache_functions.map
  Log:
  by removing previous section (with functions that have moved elsewhere),
  the 'guess' functionality went broken. Correct by adding an explicit
  MODULE declaration.
  
  Revision  ChangesPath
  1.62  +1 -1  modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- apache_functions.map  24 Jan 2003 07:39:29 -  1.61
  +++ apache_functions.map  17 Feb 2003 09:49:05 -  1.62
  @@ -211,7 +211,7 @@
ap_walk_config
   ap_process_config_tree
   
  -PACKAGE=guess
  +MODULE=Apache::Filter PACKAGE=guess
   ~ap_add_output_filter
   ~ap_add_input_filter
   -ap_add_input_filter_handle
  
  
  



cvs commit: modperl-2.0/lib/Apache Reload.pm

2003-02-16 Thread stas
stas2003/02/16 16:54:49

  Modified:lib/Apache Reload.pm
  Log:
  - get rid of dependency on mod_perl 1.0 (Apache-gensym)
  - require 1.99
  
  Revision  ChangesPath
  1.6   +4 -3  modperl-2.0/lib/Apache/Reload.pm
  
  Index: Reload.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Reload.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Reload.pm 29 Nov 2002 05:36:56 -  1.5
  +++ Reload.pm 17 Feb 2003 00:54:49 -  1.6
  @@ -3,6 +3,8 @@
   use strict;
   use warnings FATAL = 'all';
   
  +use mod_perl 1.99;
  +
   our $VERSION = '0.08';
   
   require Apache::RequestUtil;
  @@ -60,9 +62,8 @@
   my $touch_mtime = (stat($TouchFile))[9] || return 1;
   return 1 unless $touch_mtime  $TouchTime;
   $TouchTime = $touch_mtime;
  -my $sym = Apache-gensym;
  -open($sym, $TouchFile) || die Can't open '$TouchFile': $!;
  -$TouchModules = $sym;
  +open my $fh, $TouchFile or die Can't open '$TouchFile': $!;
  +$TouchModules = $fh;
   chomp $TouchModules;
   }
   
  
  
  



Re: cvs commit: modperl-2.0 Changes

2003-02-13 Thread Geoffrey Young


  +package Apache::Connection;
  +
  +# auth_type and user records don't exist in 2.0 conn_rec struct
  +# 'PerlOptions +GlobalRequest' is required
  +sub auth_type { Apache-request-auth_type }
  +sub user  { Apache-request-user  }
  +
   1;
   __END__
  

I think this may need a bit more thought (or at least more explanation).

in 1.0 there is both $r-auth_type and $c-auth_type, and they have 
different meanings.

$r-auth_type represents the AuthType from the config (via 
r-per_dir_config).  when you get $r-auth_type, you're asking what kind of 
authentication is configured for the request.

$c-auth_type is populated by authen handlers, after the user has been 
authenticated, with whatever authentication method was used.  I'm not sure 
about the history of this, but I suppose in theory it is possible for a 
client to request Digest auth, but the server fall back to Basic.

at any rate, I don't know how the current 2.0 or 2.1 aaa stuff handles this 
difference, if at all, but we (well, I :) need to be clear on how that works 
before agreeing that $r-connection-auth_type in Apache::Compat is the same 
as $r-auth_type.

--Geoff





cvs commit: modperl-2.0 Changes

2003-02-12 Thread stas
stas2003/02/12 15:42:23

  Modified:lib/Apache compat.pm
   .Changes
  Added:   t/compat conn_authen.t
   t/response/TestCompat conn_authen.pm
  Log:
  Add Apache::compat methods: $r-connection-auth_type and
  $r-connection-user (requires 'PerlOptions +GlobalRequest') + tests
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/compat/conn_authen.t
  
  Index: conn_authen.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  
  plan tests = 1, \have_lwp;
  
  my $location = /TestCompat::conn_authen;
  
  ok GET_OK $location, username = 'dougm', password = 'foo';
  
  
  
  
  1.1  modperl-2.0/t/response/TestCompat/conn_authen.pm
  
  Index: conn_authen.pm
  ===
  package TestCompat::conn_authen;
  
  # simply check that we can retrieve:
  #   $r-connection-auth_type
  #   $r-connection-user
  # both records don't exist in 2.0 conn_rec and therefore require
  # 'PerlOptions +GlobalRequest' to retrieve those via Apache-request
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::TestUtil;
  use Apache::Test;
  
  use Apache::compat ();
  use Apache::Constants qw(OK REMOTE_HOST);
  
  sub handler {
  my $r = shift;
  
  my($rc, $sent_pw) = $r-get_basic_auth_pw;
  
  return $rc if $rc != Apache::OK;
  
  my $auth_type = $r-connection-auth_type || '';
  die auth_type is '$auth_type', should be 'Basic' 
  unless $auth_type eq 'Basic';
  
  my $user = $r-connection-user || '';
  die user is '$user', while expecting 'dougm'
  unless $user eq 'dougm';
  
  OK;
  }
  
  1;
  
  __DATA__
  require valid-user
  AuthType Basic
  AuthName simple
  SetHandler modperl
  PerlOptions +GlobalRequest
  PerlAuthenHandler TestCompat::conn_authen
  PerlResponseHandler Apache::TestHandler::ok1
  
  
  
  
  1.77  +7 -0  modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- compat.pm 31 Jan 2003 04:37:06 -  1.76
  +++ compat.pm 12 Feb 2003 23:42:23 -  1.77
  @@ -530,5 +530,12 @@
   return Apache::DECLINED;
   }
   
  +package Apache::Connection;
  +
  +# auth_type and user records don't exist in 2.0 conn_rec struct
  +# 'PerlOptions +GlobalRequest' is required
  +sub auth_type { Apache-request-auth_type }
  +sub user  { Apache-request-user  }
  +
   1;
   __END__
  
  
  
  1.124 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- Changes   7 Feb 2003 02:58:30 -   1.123
  +++ Changes   12 Feb 2003 23:42:23 -  1.124
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +Add Apache::compat methods: $r-connection-auth_type and
  +$r-connection-user (requires 'PerlOptions +GlobalRequest') + tests
  +[Stas]
  +
   Several issues resolved with parsing headers, including making work
   the handlers calling $r-content_type() and not sending raw headers,
   when the headers scanning is turned on. Lots of tests added to
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_filter.c

2003-02-07 Thread stas
stas2003/02/07 20:36:35

  Modified:src/modules/perl modperl_filter.c
  Log:
  use a faster way to check whether we need to use a truncated buffer,
  strlen on an 8k buffer is not cool.
  
  Revision  ChangesPath
  1.52  +2 -1  modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- modperl_filter.c  7 Feb 2003 02:49:01 -   1.51
  +++ modperl_filter.c  8 Feb 2003 04:36:35 -   1.52
  @@ -25,7 +25,8 @@
* XXX: if buf wasn't 'const char *buf' we could simply do
* buf[len] = '\0'
*/
  -if (len  strlen(buf)) {
  +/* MP_IOBUFSIZE is the size of wb-outbuf */
  +if (buf == wb-outbuf  len  MP_IOBUFSIZE) {
   work_buf = (char *)apr_pcalloc(wb-pool, sizeof(char*)*len);
   memcpy((void*)work_buf, buf, len);
   }
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t/conf extra.conf.in

2003-02-06 Thread stas
stas2003/02/06 15:57:08

  Modified:ModPerl-Registry/t/conf extra.conf.in
  Log:
  add ScriptAlias so we can do tests against mod_cgi
  
  Revision  ChangesPath
  1.9   +2 -0  modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in
  
  Index: extra.conf.in
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- extra.conf.in 24 Dec 2002 01:51:40 -  1.8
  +++ extra.conf.in 6 Feb 2003 23:57:08 -   1.9
  @@ -35,6 +35,8 @@
   Alias /registry_oo_conf/ @ServerRoot@/cgi-bin/
   Alias /perlrun/  @ServerRoot@/cgi-bin/
   
  +ScriptAlias /cgi-bin/ @ServerRoot@/cgi-bin/
  +
   PerlModule ModPerl::RegistryBB
   Location /registry_bb
   PerlOptions +GlobalRequest
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry Makefile.PL

2003-02-06 Thread stas
stas2003/02/06 16:08:34

  Modified:ModPerl-Registry Makefile.PL
  Log:
  enable SMOKE script creation for ModPerl-Registry
  
  Revision  ChangesPath
  1.7   +4 -0  modperl-2.0/ModPerl-Registry/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/Makefile.PL,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Makefile.PL   14 May 2002 15:57:14 -  1.6
  +++ Makefile.PL   7 Feb 2003 00:08:34 -   1.7
  @@ -5,6 +5,7 @@
   use lib map {($_, ../$_) } qw(lib Apache-Test/lib);
   
   use ModPerl::MM ();
  +use Apache::TestSmokePerl ();
   
   # enable 'make test|clean'
   use Apache::TestMM qw(test clean);
  @@ -19,6 +20,9 @@
   # accept the configs from comman line
   Apache::TestMM::filter_args();
   Apache::TestMM::generate_script('t/TEST');
  +
  +# t/SMOKE
  +Apache::TestSmokePerl-generate_script;
   
   ModPerl::MM::WriteMakefile(
   NAME = 'ModPerl::Registry',
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm

2003-02-06 Thread stas
stas2003/02/06 16:12:25

  Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm
  Log:
  always return the run's return status if it's not Apache::OK
  
  Revision  ChangesPath
  1.31  +5 -7  modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
  
  Index: RegistryCooker.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- RegistryCooker.pm 5 Feb 2003 04:06:27 -   1.30
  +++ RegistryCooker.pm 7 Feb 2003 00:12:25 -   1.31
  @@ -159,15 +159,13 @@
   return $rc unless $rc == Apache::OK;
   }
   
  -# handlers shouldn't set $r-status but return it
  +# handlers shouldn't set $r-status but return it, so we reset the
  +# status after running it
   my $old_status = $self-[REQ]-status;
   my $rc = $self-run;
  -my $new_status = $self-[REQ]-status;
  -
  -# only if the script has changed the status, reset to the old
  -# status and return the new status
  -return $old_status != $new_status 
  -? $self-[REQ]-status($old_status)
  +my $new_status = $self-[REQ]-status($old_status);
  +return ($rc == Apache::OK  $old_status != $new_status)
  +? $new_status
   : $rc;
   }
   
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin runtime_error_n_status_change.pl runtime_error_plus_body.pl runtime_error.pl

2003-02-06 Thread stas
stas2003/02/06 16:15:39

  Modified:ModPerl-Registry/t .cvsignore 500.t
   ModPerl-Registry/t/cgi-bin runtime_error.pl
  Added:   ModPerl-Registry/t/cgi-bin runtime_error_n_status_change.pl
runtime_error_plus_body.pl
  Log:
  add several more tests which explore various situations when runtime
  errors happen
  
  Revision  ChangesPath
  1.3   +1 -0  modperl-2.0/ModPerl-Registry/t/.cvsignore
  
  Index: .cvsignore
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/.cvsignore,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- .cvsignore18 Oct 2001 04:25:12 -  1.2
  +++ .cvsignore7 Feb 2003 00:15:39 -   1.3
  @@ -1,3 +1,4 @@
   logs
   htdocs
   TEST
  +SMOKE
  
  
  
  1.3   +44 -4 modperl-2.0/ModPerl-Registry/t/500.t
  
  Index: 500.t
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/500.t,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- 500.t 23 Jan 2003 01:12:01 -  1.2
  +++ 500.t 7 Feb 2003 00:15:39 -   1.3
  @@ -5,7 +5,21 @@
   use Apache::TestUtil;
   use Apache::TestRequest qw(GET);
   
  -plan tests = 3;
  +plan tests = 6;
  +
  +{
  +# the script changes the status before the run-time error happens,
  +# this status change should be ignored
  +my $url = /registry/runtime_error_n_status_change.pl;
  +my $res = GET($url);
  +#t_debug($res-content);
  +ok t_cmp(
  +500,
  +$res-code,
  +500 error on runtime error (when the script changes the status),
  +   );
  +}
  +
   
   
   {
  @@ -20,6 +34,21 @@
   }
   
   {
  +my $url = /registry/missing_headers.pl;
  +my $res = GET($url);
  +#t_debug($res-content);
  +ok t_cmp(
  +500,
  +$res-code,
  +500 error on missing HTTP headers,
  +   );
  +}
  +
  +{
  +# since we have a runtime error before any body is sent, mod_perl
  +# has a chance to communicate the return status of the script to
  +# Apache before headers are sent, so we get the code 500 in the
  +# HTTP headers
   my $url = /registry/runtime_error.pl;
   my $res = GET($url);
   #t_debug($res-content);
  @@ -31,12 +60,23 @@
   }
   
   {
  -my $url = /registry/missing_headers.pl;
  +# even though we have a runtime error here, the scripts succeeds
  +# to send some body before the error happens and since by that
  +# time Apache has already sent the headers, they will include 
  +# 200 OK
  +my $url = /registry/runtime_error_plus_body.pl;
   my $res = GET($url);
   #t_debug($res-content);
   ok t_cmp(
  -500,
  +200,
   $res-code,
  -500 error on missing HTTP headers,
  +200, followed by a runtime error,
  +   );
  +
  +# the error message is attached after the body
  +ok t_cmp(
  +qr/some body.*The server encountered an internal error/ms,
  +$res-content,
  +200, followed by a runtime error,
  );
   }
  
  
  
  1.2   +3 -0  modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error.pl
  
  Index: runtime_error.pl
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- runtime_error.pl  23 Jan 2003 01:12:01 -  1.1
  +++ runtime_error.pl  7 Feb 2003 00:15:39 -   1.2
  @@ -1,2 +1,5 @@
  +# this script sends no body at all, and since the error happens
  +# the script will return 500
  +
   print Content-type: text/plain\n\n;
   print no_such_func();
  
  
  
  1.1  
modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl
  
  Index: runtime_error_n_status_change.pl
  ===
  my $r = shift;
  $r-status(404);
  $r-send_http_header('text/plain');
  $r-print(no_such_func());
  
  
  
  1.1  
modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error_plus_body.pl
  
  Index: runtime_error_plus_body.pl
  ===
  # this script sends some body before the error happens,
  # so 200 OK is expected, followed by an error
  print Content-type: text/plain\n\n;
  print some body;
  print no_such_func();
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin runtime_error_n_status_change.pl status_change.pl

2003-02-06 Thread stas
stas2003/02/06 16:23:31

  Modified:ModPerl-Registry/t/cgi-bin runtime_error_n_status_change.pl
status_change.pl
  Log:
  don't use the 1.x compat api
  
  Revision  ChangesPath
  1.2   +1 -1  
modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl
  
  Index: runtime_error_n_status_change.pl
  ===
  RCS file: 
/home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- runtime_error_n_status_change.pl  7 Feb 2003 00:15:39 -   1.1
  +++ runtime_error_n_status_change.pl  7 Feb 2003 00:23:31 -   1.2
  @@ -1,4 +1,4 @@
   my $r = shift;
   $r-status(404);
  -$r-send_http_header('text/plain');
  +$r-print(Content-type: text/plain\n\n);
   $r-print(no_such_func());
  
  
  
  1.2   +1 -1  modperl-2.0/ModPerl-Registry/t/cgi-bin/status_change.pl
  
  Index: status_change.pl
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/status_change.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- status_change.pl  7 Feb 2003 00:13:40 -   1.1
  +++ status_change.pl  7 Feb 2003 00:23:31 -   1.2
  @@ -1,3 +1,3 @@
   my $r = shift;
   $r-status(404);
  -$r-send_http_header('text/plain');
  +$r-print(Content-type: text/plain\n\n);
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t closure.t

2003-02-06 Thread stas
stas2003/02/06 16:40:32

  Modified:ModPerl-Registry/t closure.t
  Log:
  correct the explanation
  
  Revision  ChangesPath
  1.6   +3 -2  modperl-2.0/ModPerl-Registry/t/closure.t
  
  Index: closure.t
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/closure.t,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- closure.t 22 May 2002 05:40:48 -  1.5
  +++ closure.t 7 Feb 2003 00:40:32 -   1.6
  @@ -118,9 +118,10 @@
   
   sub sleep_and_touch_file {
   my $file = shift;
  -# need to wait at least 1 whole sec, so -M will notice the
  +# need to wait at least 1 whole sec, so utime() will notice the
   # difference. select() has better resolution than 1 sec as in
  -# sleep()
  +# sleep() so we are more likely to have the minimal waiting time,
  +# while fullfilling the purpose
   select undef, undef, undef, 1.00; # sure 1 sec
   my $now = time;
   utime $now, $now, $file;
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t closure.t

2003-02-06 Thread stas
stas2003/02/06 16:51:08

  Modified:ModPerl-Registry/t closure.t
  Log:
  spel
  
  Revision  ChangesPath
  1.7   +1 -1  modperl-2.0/ModPerl-Registry/t/closure.t
  
  Index: closure.t
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/closure.t,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- closure.t 7 Feb 2003 00:40:32 -   1.6
  +++ closure.t 7 Feb 2003 00:51:08 -   1.7
  @@ -121,7 +121,7 @@
   # need to wait at least 1 whole sec, so utime() will notice the
   # difference. select() has better resolution than 1 sec as in
   # sleep() so we are more likely to have the minimal waiting time,
  -# while fullfilling the purpose
  +# while fulfilling the purpose
   select undef, undef, undef, 1.00; # sure 1 sec
   my $now = time;
   utime $now, $now, $file;
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_filter.c

2003-02-06 Thread stas
stas2003/02/06 18:30:53

  Modified:src/modules/perl modperl_filter.c
  Log:
  we have no choice but to truncate wb-outbuf to the size of 'len'. All
  kind of weird problems pop-up when the previous request was proper and the
  current request has messed up with headers, because
  modperl_cgi_header_parse (actually the ap_scan_script_header_err_strs)
  will get things messed up because it expects a buffer with real data only.
  
  Revision  ChangesPath
  1.50  +24 -23modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- modperl_filter.c  7 Feb 2003 00:07:42 -   1.49
  +++ modperl_filter.c  7 Feb 2003 02:30:52 -   1.50
  @@ -8,11 +8,28 @@
   apr_bucket_alloc_t *ba = (*wb-filters)-c-bucket_alloc;
   apr_bucket_brigade *bb;
   apr_bucket *bucket;
  -
  +const char *work_buf = buf;
  +
   if (wb-header_parse) {
   request_rec *r = wb-r;
   const char *bodytext = NULL;
  -int status = modperl_cgi_header_parse(r, (char *)buf, bodytext);
  +int status;
  +/*
  + * since wb-outcnt is persistent between requests, if the
  + * current response is shorter than the size of wb-outcnt
  + * it may include data from the previous request at the
  + * end. When this function receives a pointer to
  + * wb-outbuf as 'buf', modperl_cgi_header_parse may
  + * return that irrelevant data as part of 'bodytext'. So
  + * to avoid this risk, we create a new buffer of size 'len'
  + * XXX: if buf wasn't 'const char *buf' we could simply do
  + * buf[len] = '\0'
  + */
  +if (len  strlen(buf)) {
  +work_buf = (char *)apr_pcalloc(wb-pool, sizeof(char*)*len);
  +memcpy((void*)work_buf, buf, len);
  +}
  +status = modperl_cgi_header_parse(r, (char *)work_buf, bodytext);
   
   wb-header_parse = 0; /* only once per-request */
   
  @@ -26,32 +43,16 @@
   /* XXX: bodytext == NULL here */
   return status;
   }
  -
  -if (!bodytext) {
  +else if (!bodytext) {
   return APR_SUCCESS;
   }
  -else {
  -len -= (bodytext - buf);
  -buf = bodytext;
  -/*
  - * since wb-outbuf is persistent between requests, if the
  - * current response is shorter than the size of wb-outbuf
  - * it may include data from the previous request at the
  - * end. When this function receives a pointer to
  - * wb-outbuf as 'buf', modperl_cgi_header_parse may
  - * return that irrelevant data as part of 'bodytext'. So
  - * to avoid this risk, we check whether there is any real
  - * data to send and if not return.
  - */
  -if (!len) {
  -return APR_SUCCESS;
  -}
  -}
  -
  +
  +len -= (bodytext - work_buf);
  +work_buf = bodytext;
   }
   
   bb = apr_brigade_create(wb-pool, ba);
  -bucket = apr_bucket_transient_create(buf, len, ba);
  +bucket = apr_bucket_transient_create(work_buf, len, ba);
   APR_BRIGADE_INSERT_TAIL(bb, bucket);
   
   MP_TRACE_f(MP_FUNC, buffer length=%d\n, len);
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin content_type.pl

2003-02-06 Thread stas
stas2003/02/06 18:49:01

  Modified:src/modules/perl modperl_filter.c
   ModPerl-Registry/t basic.t
  Added:   ModPerl-Registry/t/cgi-bin content_type.pl
  Log:
  if the handler sets the content-type, don't parse the headers because
  there most likely there will be none
  
  Revision  ChangesPath
  1.51  +3 -3  modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- modperl_filter.c  7 Feb 2003 02:30:52 -   1.50
  +++ modperl_filter.c  7 Feb 2003 02:49:01 -   1.51
  @@ -10,13 +10,13 @@
   apr_bucket *bucket;
   const char *work_buf = buf;
   
  -if (wb-header_parse) {
  +if (wb-header_parse  !wb-r-content_type) {
   request_rec *r = wb-r;
   const char *bodytext = NULL;
   int status;
   /*
  - * since wb-outcnt is persistent between requests, if the
  - * current response is shorter than the size of wb-outcnt
  + * since wb-outbuf is persistent between requests, if the
  + * current response is shorter than the size of wb-outbuf
* it may include data from the previous request at the
* end. When this function receives a pointer to
* wb-outbuf as 'buf', modperl_cgi_header_parse may
  
  
  
  1.9   +53 -42modperl-2.0/ModPerl-Registry/t/basic.t
  
  Index: basic.t
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/basic.t,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- basic.t   6 Jan 2003 10:39:43 -   1.8
  +++ basic.t   7 Feb 2003 02:49:01 -   1.9
  @@ -13,58 +13,69 @@
   
   my @aliases = sort keys %modules;
   
  -plan tests = @aliases * 4 + 1;
  +plan tests = 2;
  +#plan tests = @aliases * 4 + 2;
   
  -# very basic compilation/response test
  -for my $alias (@aliases) {
  -my $url = /$alias/basic.pl;
  -
  -ok t_cmp(
  -ok,
  -GET_BODY($url),
  -$modules{$alias} basic cgi test,
  -);
  -}
  -
  -# test non-executable bit
  -for my $alias (@aliases) {
  -my $url = /$alias/not_executable.pl;
  -
  -ok t_cmp(
  -403 Forbidden,
  -HEAD($url)-status_line(),
  -$modules{$alias} non-executable file,
  -);
  -}
  -
  -# test environment pre-set
  -for my $alias (@aliases) {
  -my $url = /$alias/env.pl?foo=bar;
  +## very basic compilation/response test
  +#for my $alias (@aliases) {
  +#my $url = /$alias/basic.pl;
  +
  +#ok t_cmp(
  +#ok,
  +#GET_BODY($url),
  +#$modules{$alias} basic cgi test,
  +#);
  +#}
  +
  +## test non-executable bit
  +#for my $alias (@aliases) {
  +#my $url = /$alias/not_executable.pl;
  +
  +#ok t_cmp(
  +#403 Forbidden,
  +#HEAD($url)-status_line(),
  +#$modules{$alias} non-executable file,
  +#);
  +#}
  +
  +## test environment pre-set
  +#for my $alias (@aliases) {
  +#my $url = /$alias/env.pl?foo=bar;
  +
  +#ok t_cmp(
  +#foo=bar,
  +#GET_BODY($url),
  +#$modules{$alias} mod_cgi-like environment pre-set,
  +#);
  +#}
  +
  +## require (actually chdir test)
  +#for my $alias (@aliases) {
  +#my $url = /$alias/require.pl;
  +
  +#ok t_cmp(
  +#it works,
  +#GET_BODY($url),
  +#$modules{$alias} mod_cgi-like environment pre-set,
  +#);
  +#}
   
  +# test method handlers
  +{
  +my $url = /registry_oo_conf/env.pl?foo=bar;
   ok t_cmp(
   foo=bar,
   GET_BODY($url),
  -$modules{$alias} mod_cgi-like environment pre-set,
  -);
  -}
  -
  -# require (actually chdir test)
  -for my $alias (@aliases) {
  -my $url = /$alias/require.pl;
  -
  -ok t_cmp(
  -it works,
  -GET_BODY($url),
  -$modules{$alias} mod_cgi-like environment pre-set,
  +ModPerl::Registry-handler mod_cgi-like environment pre-set,
   );
   }
   
  -# test method handlers
  +# test mod_perl api usage
   {
  -my $url = /registry_oo_conf/env.pl?foo=bar;
  +my $url = /registry/content_type.pl;
   ok t_cmp(
  -foo=bar,
  +ok,
   GET_BODY($url),
  -ModPerl::Registry-handler mod_cgi-like environment pre-set,
  +\$r-content_type('text/plain'),
   );
   }
  
  
  
  1.1  modperl-2.0/ModPerl-Registry/t/cgi-bin/content_type.pl
  
  Index: content_type.pl
  ===
  my $r = shift;
  $r-content_type('text/plain');
  $r-print('ok');
  
  
  



cvs commit: modperl-2.0 Changes

2003-02-06 Thread stas
stas2003/02/06 18:58:30

  Modified:.Changes
  Log:
  log the recent changes
  
  Revision  ChangesPath
  1.123 +5 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- Changes   5 Feb 2003 04:06:27 -   1.122
  +++ Changes   7 Feb 2003 02:58:30 -   1.123
  @@ -10,6 +10,11 @@
   
   =item 1.99_09-dev
   
  +Several issues resolved with parsing headers, including making work
  +the handlers calling $r-content_type() and not sending raw headers,
  +when the headers scanning is turned on. Lots of tests added to
  +exercise different situations. [Stas]
  +
   warn on using -T in ModPerl::Registry scripts when mod_perl is not
   running with -T [Stas]
   
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry TODO

2003-02-04 Thread stas
stas2003/02/04 20:06:28

  Modified:.Changes
   ModPerl-Registry/lib/ModPerl RegistryCooker.pm
   ModPerl-Registry TODO
  Log:
  warn on using -T in ModPerl::Registry scripts when mod_perl is not
  running with -T
  
  Revision  ChangesPath
  1.122 +7 -4  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- Changes   4 Feb 2003 06:52:15 -   1.121
  +++ Changes   5 Feb 2003 04:06:27 -   1.122
  @@ -10,10 +10,13 @@
   
   =item 1.99_09-dev
   
  -perl 5.7.3+ has a built-in ${^TAINT} to test whether running under
  --(T|t). Backport ${^TAINT} for mod_perl running under 5.6.0-5.7.3,
  -(what used to be $Apache::__T.  $Apache::__T is available too, but
  -deprecated. [Stas]
  +warn on using -T in ModPerl::Registry scripts when mod_perl is not
  +running with -T [Stas]
  +
  +perl 5.7.3+ has a built-in ${^TAINT} to test whether it's running
  +under -(T|t). Backport ${^TAINT} for mod_perl running under
  +5.6.0-5.7.3, (what used to be $Apache::__T.  $Apache::__T is available
  +too, but deprecated. [Stas]
   
   add PerlChildExitHandler implementation [Stas]
   
  
  
  
  1.30  +4 -5  modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
  
  Index: RegistryCooker.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- RegistryCooker.pm 18 Jan 2003 02:04:32 -  1.29
  +++ RegistryCooker.pm 5 Feb 2003 04:06:27 -   1.30
  @@ -552,10 +552,9 @@
   
   my %switches = (
  'T' = sub {
  -# XXX: need to have $Apache::__T set by the core on PerlSwitches -T
  -#   Apache::warn(T switch is ignored, ,
  -#enable with 'PerlSwitches -T' in httpd.conf\n)
  -# unless $Apache::__T; 
  +   Apache::warn(-T switch is ignored,  .
  +enable with 'PerlSwitches -T' in httpd.conf\n)
  + unless ${^TAINT};
  ;
  },
  'w' = sub { use warnings;\n },
  @@ -574,7 +573,7 @@
last if substr($s,0,1) eq -;
for (split //, $s) {
next unless exists $switches{$_};
  - $prepend .= {$switches{$_}};
  + $prepend .= $switches{$_}-();
}
   }
   ${ $self-[CODE] } =~ s/^/$prepend/ if $prepend;
  
  
  
  1.12  +0 -2  modperl-2.0/ModPerl-Registry/TODO
  
  Index: TODO
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/TODO,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TODO  29 Dec 2002 10:11:49 -  1.11
  +++ TODO  5 Feb 2003 04:06:27 -   1.12
  @@ -14,8 +14,6 @@
   
   ### missing features ###
   
  -- need to port $Apache::__T, to test against when user supplies -T flag.
  -
   - port Apache::PerlRunXS
   
   - replace the local implementation of slurp_filename() and finfo(),
  
  
  



cvs commit: modperl-2.0/lib/Apache Status.pm

2003-02-03 Thread stas
stas2003/02/03 23:00:52

  Modified:lib/Apache Status.pm
  Log:
  of course we don't have 2.00 yet, use 1.99
  
  Revision  ChangesPath
  1.6   +1 -4  modperl-2.0/lib/Apache/Status.pm
  
  Index: Status.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Status.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Status.pm 28 Jan 2003 07:27:48 -  1.5
  +++ Status.pm 4 Feb 2003 07:00:52 -   1.6
  @@ -9,10 +9,7 @@
   # when used with 'no warnings' it still barks on redefinining the
   # constants
   
  -
  -
  -# XXX
  -# use mod_perl 2.0;
  +use mod_perl 1.99;
   
   use Apache::RequestRec ();
   use Apache::RequestUtil ();
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2003-02-02 Thread stas
stas2003/02/02 17:18:15

  Modified:lib/ModPerl Code.pm
  Log:
  fix the indentation for the autogenerated files
  
  Revision  ChangesPath
  1.90  +1 -1  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Code.pm   11 Jan 2003 03:20:54 -  1.89
  +++ Code.pm   3 Feb 2003 01:18:15 -   1.90
  @@ -62,7 +62,7 @@
   my $scfg_get = 'MP_dSCFG(parms-server)';
   
   my $dcfg_get = $scfg_get;\n .
  -  'modperl_config_dir_t *dcfg = (modperl_config_dir_t *)dummy';
  +  'modperl_config_dir_t *dcfg = (modperl_config_dir_t *)dummy';
   
   my %directive_proto = (
   PerSrv = {
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_config.c

2003-02-02 Thread stas
stas2003/02/02 22:40:33

  Modified:.Changes
   src/modules/perl modperl_config.c
  Added:   t/hooks  cleanup.t
   t/hooks/TestHooks cleanup.pm
  Log:
  PerlCleanupHandler implementation + tests
  
  Revision  ChangesPath
  1.119 +8 -1  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- Changes   31 Jan 2003 03:15:24 -  1.118
  +++ Changes   3 Feb 2003 06:40:33 -   1.119
  @@ -10,8 +10,15 @@
   
   =item 1.99_09-dev
   
  +add PerlCleanupHandler implementation + test [Stas]
  +
  +Apache::Test now can run 'make test' under 'root', without permission
  +problems (e.g. when files need to be written), it'll chown all the
  +files under t/ to the user chosen to run the server with, before
  +running the tests and will restore the permissions at the end. [Stas]
  +
   die when Apache-request returns nothing ('PerlOptions -GlobalRequest'
  -or 'SetHandler modperl' [Stas]
  +or 'SetHandler modperl') [Stas]
   
   New Apache::Directive methods: as_hash(), lookup() + tests + docs
   [Philippe M. Chiasson [EMAIL PROTECTED]]
  
  
  
  1.1  modperl-2.0/t/hooks/cleanup.t
  
  Index: cleanup.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  use File::Spec::Functions qw(catfile catdir);
  
  my $vars = Apache::Test::config-{vars};
  my $dir  = catdir $vars-{documentroot}, hooks;
  my $file = catfile $dir, cleanup;
  
  plan tests = 2;
  
  {
  # this registers and performs cleanups, but we test whether the
  # cleanup was run only in the next sub-test
  my $location = /TestHooks::cleanup;
  my $expected = 'ok';
  my $received = GET_BODY $location;
  ok t_cmp($expected, $received, register req cleanup);
  }
  
  {
  # this sub-tests checks that the cleanup stage was run successfully
  
  # since Apache destroys the request rec after the logging has been
  # finished, we have to give it some time  to get there
  # and fill in the file. (wait 0.25 .. 5 sec)
  my $t = 0;
  select undef, undef, undef, 0.25
  until -e $file  -s _ == 10 || $t++ == 20;
  
  unless (-e $file) {
  t_debug(can't find $file);
  ok 0;
  }
  else {
  open my $fh, $file or die Can't open $file: $!;
  my $received = $fh || '';
  close $fh;
  my $expected = cleanup ok;
  ok t_cmp($expected, $received, verify req cleanup execution);
  
  # XXX: while Apache::TestUtil fails to cleanup by itself
  unlink $file;
  }
  
  }
  
  
  
  
  
  
  1.1  modperl-2.0/t/hooks/TestHooks/cleanup.pm
  
  Index: cleanup.pm
  ===
  package TestHooks::cleanup;
  
  # test various ways to push handlers
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use File::Spec::Functions qw(catfile catdir);
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use Apache::RequestUtil ();
  
  use Apache::Const -compile = qw(OK DECLINED);
  
  sub get_file {
  catdir Apache::Test::config-{vars}-{documentroot}, hooks, cleanup;
  }
  
  sub handler {
  my $r = shift;
  
  $r-content_type('text/plain');
  $r-print('ok');
  
  $r-push_handlers(PerlCleanupHandler = \cleanup2);
  
  return Apache::OK;
  }
  
  sub cleanup1 {
  my $r = shift;
  
  #warn cleanup CALLED\n;
  t_write_file(get_file(), cleanup);
  
  return Apache::OK;
  }
  
  sub cleanup2 {
  my $r = shift;
  
  #warn cleanup2 CALLED\n;
  t_append_file(get_file(),  ok);
  
  return Apache::OK;
  }
  
  1;
  __DATA__
  NoAutoConfig
Location /TestHooks::cleanup
SetHandler modperl
PerlCleanupHandler  TestHooks::cleanup::cleanup1
PerlResponseHandler TestHooks::cleanup
/Location
  /NoAutoConfig
  
  
  
  
  1.62  +4 -1  modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- modperl_config.c  1 Jan 2003 03:45:54 -   1.61
  +++ modperl_config.c  3 Feb 2003 06:40:33 -   1.62
  @@ -278,6 +278,7 @@
   
   apr_status_t modperl_config_request_cleanup(pTHX_ request_rec *r)
   {
  +apr_status_t retval;
   MP_dRCFG;
   
   if (rcfg-pnotes) {
  @@ -285,7 +286,9 @@
   rcfg-pnotes = Nullhv;
   }
   
  -return APR_SUCCESS;
  +retval = modperl_callback_per_dir

cvs commit: modperl-2.0/lib/Apache Build.pm

2003-01-31 Thread stas
stas2003/01/31 23:39:43

  Modified:lib/Apache Build.pm
  Log:
  - create MKPATH make variable as we are going to use it more than once
there is no need to test for the existance of the path, before calling
mkpath(), it does no harm if the dir already exists
  - use the MKPATH variable
  
  Revision  ChangesPath
  1.110 +3 -3  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Build.pm  14 Dec 2002 17:29:34 -  1.109
  +++ Build.pm  1 Feb 2003 07:39:43 -   1.110
  @@ -1052,14 +1052,14 @@
   
   MODPERL_PIC_OBJS = $(MODPERL_O_PIC_FILES) $(MODPERL_XS_O_PIC_FILES)
   
  +MKPATH = $(MODPERL_PERLPATH) -MExtUtils::Command -e mkpath
  +
   all: lib
   
   lib: $(MODPERL_LIB)
   
   install:
  - $(MODPERL_PERLPATH) -e exit ! -d qq{$(MODPERL_AP_LIBEXECDIR)} || \
  - $(MODPERL_PERLPATH) -MExtUtils::Command  \
  - -e mkpath $(MODPERL_AP_LIBEXECDIR)
  + @$(MKPATH) $(MODPERL_AP_LIBEXECDIR)
$(MODPERL_TEST_F) $(MODPERL_LIB_DSO)  \
$(MODPERL_CP) $(MODPERL_LIB_DSO) $(MODPERL_AP_LIBEXECDIR)
   
  
  
  



cvs commit: modperl-2.0 Makefile.PL

2003-01-30 Thread stas
stas2003/01/30 16:52:22

  Modified:.Makefile.PL
  Log:
  use a portable $(MAKE) instead of just 'make'
  
  Revision  ChangesPath
  1.91  +1 -1  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- Makefile.PL   23 Jan 2003 05:16:30 -  1.90
  +++ Makefile.PL   31 Jan 2003 00:52:21 -  1.91
  @@ -460,7 +460,7 @@
$(PASSENV) \
$(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
t/TEST
  - cd ModPerl-Registry  make test
  + cd ModPerl-Registry  $(MAKE) test
   
   test :: pure_all run_tests test_clean
   EOF
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-30 Thread stas
stas2003/01/30 20:20:20

  Modified:src/modules/perl modperl_global.c modperl_global.h
   xs/Apache/RequestUtil Apache__RequestUtil.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  expose modperl_global_request (needed in external apps written in XS )
  
  Revision  ChangesPath
  1.7   +24 -0 modperl-2.0/src/modules/perl/modperl_global.c
  
  Index: modperl_global.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- modperl_global.c  22 May 2002 18:53:33 -  1.6
  +++ modperl_global.c  31 Jan 2003 04:20:20 -  1.7
  @@ -26,6 +26,30 @@
   MpReqSET_GLOBAL_REQUEST_On(rcfg);
   }
   
  +/* get/set */
  +request_rec *modperl_global_request(pTHX_ SV *svr)
  +{
  +request_rec *cur = NULL;
  +apr_status_t status = modperl_tls_get_request_rec(cur);
  +
  +if (status != APR_SUCCESS) {
  +/* an internal problem */
  +Perl_croak(aTHX_ failed to retrieve the request object);
  +}
  +
  +if (!cur) {
  +/* wrong configuration */
  +Perl_croak(aTHX_ Global $r object is not available. Set:\n
  +   \tPerlOptions +GlobalRequest\nin httpd.conf);
  +}
  +
  +if (svr) {
  +modperl_global_request_obj_set(aTHX_ svr);
  +}
  +
  +return cur;
  +}
  +
   void modperl_global_request_obj_set(pTHX_ SV *svr)
   {
   /* XXX: support sublassing */
  
  
  
  1.4   +2 -0  modperl-2.0/src/modules/perl/modperl_global.h
  
  Index: modperl_global.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_global.h  4 May 2001 05:49:19 -   1.3
  +++ modperl_global.h  31 Jan 2003 04:20:20 -  1.4
  @@ -18,6 +18,8 @@
   
   void modperl_global_request_cfg_set(request_rec *r);
   
  +request_rec *modperl_global_request(pTHX_ SV *svr);
  +
   void modperl_global_request_set(request_rec *r);
   
   void modperl_global_request_obj_set(pTHX_ SV *svr);
  
  
  
  1.17  +2 -19 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Apache__RequestUtil.h 31 Jan 2003 03:15:23 -  1.16
  +++ Apache__RequestUtil.h 31 Jan 2003 04:20:20 -  1.17
  @@ -85,25 +85,8 @@
   static MP_INLINE
   request_rec *mpxs_Apache_request(pTHX_ SV *classname, SV *svr)
   {
  -request_rec *cur = NULL;
  -apr_status_t status = modperl_tls_get_request_rec(cur);
  -
  -if (status != APR_SUCCESS) {
  -/* an internal problem */
  -Perl_croak(aTHX_ failed to retrieve the request object);
  -}
  -
  -if (!cur) {
  -/* wrong configuration */
  -Perl_croak(aTHX_ Global $r object is not available. Set:\n
  -   \tPerlOptions +GlobalRequest\nin httpd.conf);
  -}
  -
  -if (svr) {
  -modperl_global_request_obj_set(aTHX_ svr);
  -}
  -
  -return cur;
  +/* ignore classname */
  +return modperl_global_request(aTHX_ svr);
   }
   
   static MP_INLINE
  
  
  
  1.104 +14 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- FunctionTable.pm  29 Jan 2003 03:56:00 -  1.103
  +++ FunctionTable.pm  31 Jan 2003 04:20:20 -  1.104
  @@ -1494,6 +1494,20 @@
   'args' = []
 },
 {
  +'return_type' = 'request_rec *',
  +'name' = 'modperl_global_request',
  +'args' = [
  +  {
  +'type' = 'PerlInterpreter *',
  +'name' = 'my_perl'
  +  },
  +  {
  +'type' = 'SV *',
  +'name' = 'svr'
  +  }
  +]
  +  },
  +  {
   'return_type' = 'SV *',
   'name' = 'modperl_dir_config',
   'attr' = [
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_callback.c

2003-01-28 Thread stas
stas2003/01/28 17:04:34

  Modified:.Changes
   src/modules/perl modperl_callback.c
  Added:   t/hooks  stacked_handlers.t
   t/hooks/TestHooks stacked_handlers.pm
  Log:
  Stacked handlers chain execution is now aborted when a handler returns
  something other than OK or DECLINED
  
  Revision  ChangesPath
  1.116 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- Changes   25 Jan 2003 03:08:04 -  1.115
  +++ Changes   29 Jan 2003 01:04:33 -  1.116
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +Stacked handlers chain execution is now aborted when a handler returns
  +something other than OK or DECLINED [Stas]
  +
   make $filter-read() in input streaming filters, use the same number
   of arguments as read() in the output filters. [Stas]
   
  
  
  
  1.1  modperl-2.0/t/hooks/stacked_handlers.t
  
  Index: stacked_handlers.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my $location = /TestHooks::stacked_handlers;
  my $expected = join \n, qw(one two three), '';
  my $received = GET_BODY $location;
  
  ok t_cmp($expected, $received, stacked_handlers);
  
  
  
  1.1  modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm
  
  Index: stacked_handlers.pm
  ===
  package TestHooks::stacked_handlers;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  
  use Apache::Const -compile = qw(OK DECLINED);
  
  sub handler {
  my $r = shift;
  
  $r-handler(modperl);
  $r-push_handlers(PerlResponseHandler = [\one, \two, \three, \four]);
  
  return Apache::OK;
  }
  
  sub one {
  my $r = shift;
  
  $r-content_type('text/plain');
  $r-print(one\n);
  
  return Apache::OK;
  }
  
  sub two {
  my $r = shift;
  
  $r-print(two\n);
  
  return Apache::OK;
  }
  
  sub three {
  my $r = shift;
  
  $r-print(three\n);
  
  return Apache::DONE;
  }
  
  # this one shouldn't get called, because the three has returned DONE
  sub four {
  my $r = shift;
  
  $r-print(four\n);
  
  return Apache::OK;
  }
  
  
  1;
  __DATA__
  NoAutoConfig
Location /TestHooks::stacked_handlers
SetHandler modperl
PerlHeaderParserHandler TestHooks::stacked_handlers
/Location
  /NoAutoConfig
  
  
  
  
  1.53  +12 -3 modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- modperl_callback.c14 Jan 2003 06:42:43 -  1.52
  +++ modperl_callback.c29 Jan 2003 01:04:33 -  1.53
  @@ -182,12 +182,21 @@
   handlers = (modperl_handler_t **)av-elts;
   
   for (i=0; inelts; i++) {
  -if ((status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args)) != OK) 
{
  +status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args);
  +
  +MP_TRACE_h(MP_FUNC, %s returned %d\n, handlers[i]-name, status);
  +
  +if ((status != OK)  (status != DECLINED)) {
   status = modperl_errsv(aTHX_ status, r, s);
  +#ifdef MP_TRACE
  +if (i+1 != nelts) {
  +MP_TRACE_h(MP_FUNC, there were %d uncalled handlers\n,
  +   nelts-i-1);
  +}
  +#endif
  +break;
   }
   
  -MP_TRACE_h(MP_FUNC, %s returned %d\n,
  -   handlers[i]-name, status);
   }
   
   SvREFCNT_dec((SV*)av_args);
  
  
  



cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm

2003-01-28 Thread stas
stas2003/01/28 17:25:46

  Added:   t/hooks  push_handlers.t
   t/hooks/TestHooks push_handlers.pm
  Log:
  - add a test to exercise push_handlers in different ways
  - prepare for supporting anon handlers
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/hooks/push_handlers.t
  
  Index: push_handlers.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my @refs = qw(coderef full_coderef coderef1 coderef2 coderef3);
  my @anon = qw(anonymous anonymous1 coderef4 anonymous3);
  
  my @strings = @refs;
  
  # XXX: anon-handlers unsupported yet
  # push @strings, @anon
  
  my $location = /TestHooks::push_handlers;
  my $expected = join \n, @strings, '';
  my $received = GET_BODY $location;
  
  ok t_cmp($expected, $received, push_handlers ways);
  
  
  
  1.1  modperl-2.0/t/hooks/TestHooks/push_handlers.pm
  
  Index: push_handlers.pm
  ===
  package TestHooks::push_handlers;
  
  # test various ways to push handlers
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  
  use Apache::Const -compile = qw(OK DECLINED DONE);
  
  sub handler {
  my $r = shift;
  
  $r-handler(modperl);
  $r-push_handlers(PerlResponseHandler = \start);
  
  $r-push_handlers(PerlResponseHandler = \coderef);
  $r-push_handlers(PerlResponseHandler = 
  \TestHooks::push_handlers::full_coderef);
  
  $r-push_handlers(PerlResponseHandler =
  [\coderef1, \coderef2, \coderef3]);
  
  # XXX: anon-handlers unsupported yet
  #$r-push_handlers(PerlResponseHandler =
  #sub { return say(shift, anonymous) });
  
  #$r-push_handlers(PerlResponseHandler =
  #[sub { return say(shift, anonymous1) },
  # \coderef4,
  # sub { return say(shift, anonymous3) },
  #]);
  
  $r-push_handlers(PerlResponseHandler = \end);
  
  return Apache::DECLINED;
  }
  
  
  sub start { shift-content_type('text/plain'); return Apache::OK }
  sub end   { return Apache::DONE }
  sub say   { shift-print(shift,\n); return Apache::OK }
  
  sub coderef  { return say(shift, coderef)  }
  sub coderef1 { return say(shift, coderef1) }
  sub coderef2 { return say(shift, coderef2) }
  sub coderef3 { return say(shift, coderef3) }
  sub coderef4 { return say(shift, coderef4) }
  sub full_coderef { return say(shift, full_coderef) }
  
  1;
  __DATA__
  NoAutoConfig
Location /TestHooks::push_handlers
SetHandler modperl
PerlHeaderParserHandler TestHooks::push_handlers
/Location
  /NoAutoConfig
  
  
  
  



cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm

2003-01-28 Thread stas
stas2003/01/28 17:33:17

  Modified:t/hooks  push_handlers.t
   t/hooks/TestHooks push_handlers.pm
  Log:
  mix in the handlers configured from httpd.conf
  
  Revision  ChangesPath
  1.2   +2 -1  modperl-2.0/t/hooks/push_handlers.t
  
  Index: push_handlers.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/hooks/push_handlers.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- push_handlers.t   29 Jan 2003 01:25:45 -  1.1
  +++ push_handlers.t   29 Jan 2003 01:33:17 -  1.2
  @@ -7,7 +7,8 @@
   
   plan tests = 1;
   
  -my @refs = qw(coderef full_coderef coderef1 coderef2 coderef3);
  +my @refs = qw(conf conf1 conf2 coderef 
  + full_coderef coderef1 coderef2 coderef3);
   my @anon = qw(anonymous anonymous1 coderef4 anonymous3);
   
   my @strings = @refs;
  
  
  
  1.2   +12 -4 modperl-2.0/t/hooks/TestHooks/push_handlers.pm
  
  Index: push_handlers.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/push_handlers.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- push_handlers.pm  29 Jan 2003 01:25:45 -  1.1
  +++ push_handlers.pm  29 Jan 2003 01:33:17 -  1.2
  @@ -14,7 +14,6 @@
   my $r = shift;
   
   $r-handler(modperl);
  -$r-push_handlers(PerlResponseHandler = \start);
   
   $r-push_handlers(PerlResponseHandler = \coderef);
   $r-push_handlers(PerlResponseHandler = 
  @@ -38,11 +37,18 @@
   return Apache::DECLINED;
   }
   
  +sub end { return Apache::DONE }
  +sub say { shift-print(shift,\n); return Apache::OK }
   
  -sub start { shift-content_type('text/plain'); return Apache::OK }
  -sub end   { return Apache::DONE }
  -sub say   { shift-print(shift,\n); return Apache::OK }
  +sub conf {
  +# this one is configured from httpd.conf
  +my $r= shift;
  +$r-content_type('text/plain');
  +return say($r, conf);
  +}
   
  +sub conf1{ return say(shift, conf1)}
  +sub conf2{ return say(shift, conf2)}
   sub coderef  { return say(shift, coderef)  }
   sub coderef1 { return say(shift, coderef1) }
   sub coderef2 { return say(shift, coderef2) }
  @@ -56,6 +62,8 @@
 Location /TestHooks::push_handlers
 SetHandler modperl
 PerlHeaderParserHandler TestHooks::push_handlers
  +  PerlResponseHandler TestHooks::push_handlers::conf
  +  PerlResponseHandler TestHooks::push_handlers::conf1 
TestHooks::push_handlers::conf2
 /Location
   /NoAutoConfig
   
  
  
  



cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm stacked_handlers.pm

2003-01-28 Thread stas
stas2003/01/28 18:36:25

  Modified:t/hooks/TestHooks push_handlers.pm stacked_handlers.pm
  Log:
  add the missing Apache::ServerUtil
  
  Revision  ChangesPath
  1.3   +1 -0  modperl-2.0/t/hooks/TestHooks/push_handlers.pm
  
  Index: push_handlers.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/push_handlers.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- push_handlers.pm  29 Jan 2003 01:33:17 -  1.2
  +++ push_handlers.pm  29 Jan 2003 02:36:25 -  1.3
  @@ -7,6 +7,7 @@
   
   use Apache::RequestRec ();
   use Apache::RequestIO ();
  +use Apache::ServerUtil ();
   
   use Apache::Const -compile = qw(OK DECLINED DONE);
   
  
  
  
  1.3   +1 -0  modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm
  
  Index: stacked_handlers.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- stacked_handlers.pm   29 Jan 2003 01:09:06 -  1.2
  +++ stacked_handlers.pm   29 Jan 2003 02:36:25 -  1.3
  @@ -9,6 +9,7 @@
   
   use Apache::RequestRec ();
   use Apache::RequestIO ();
  +use Apache::ServerUtil ();
   
   use Apache::Const -compile = qw(OK DECLINED DONE);
   
  
  
  



cvs commit: modperl-2.0/lib/Apache Status.pm

2003-01-27 Thread stas
stas2003/01/27 20:53:15

  Modified:lib/Apache Status.pm
  Log:
  - CGI.pm's script_name() appears to be broken, use $r-location instead
  - handle gracefully the stash dump for a child that doesn't have that
  stash
  
  Revision  ChangesPath
  1.2   +15 -12modperl-2.0/lib/Apache/Status.pm
  
  Index: Status.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Status.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Status.pm 25 Jan 2003 13:26:11 -  1.1
  +++ Status.pm 28 Jan 2003 04:53:15 -  1.2
  @@ -312,7 +312,6 @@
   my($r, $q) = @_;
   
   my($name, $type) = (split /, $r-uri)[-2,-1];
  -my $script = $q-script_name;
   
   no strict 'refs';
   my @retval = Data Dump of $name $type pre\n;
  @@ -336,17 +335,21 @@
   
   no strict 'refs';
   my($name, $type) = (split /, $r-uri)[-2,-1];
  +# could be another child, which doesn't have this symbol table?
  +return unless *$name{CODE}; 
  +
   my @retval = Subroutine info for b$name/b pre\n;
  -my $script = $q-script_name;
   my $obj= B::svref_2object(*$name{CODE});
   my $file   = cv_file($obj);
   my $stash  = $obj-GV-STASH-NAME;
  +my $script = $r-location;
   
   push @retval, File: , 
   (-e $file ? qq(a href=file:$file$file/a) : $file), \n;
   
   my $cv= $obj-GV-CV;
   my $proto = $cv-PV if $cv-can('PV');
  +
   push @retval, qq(Package: a href=$script?$stash$stash/a\n);
   push @retval, Line: ,  $obj-GV-LINE, \n;
   push @retval, Prototype: , $proto || none, \n;
  @@ -376,7 +379,7 @@
   return unless eval { require B::Graph };
   
   B::Graph-UNIVERSAL::VERSION('0.03');
  -my $script = $q-script_name;
  +my $script = $r-location;
   return qq(\na href=$script/$name?noh_b_graphOP Tree Graph/a\n);
   }
   
  @@ -386,7 +389,7 @@
   return unless status_config($r, StatusLexInfo);
   return unless eval { require B::LexInfo };
   
  -my $script = $q-script_name;
  +my $script = $q-location;
   return qq(\na href=$script/$name?noh_b_lexinfoLexical Info/a\n);
   }
   
  @@ -411,7 +414,7 @@
   return unless status_config($r, StatusTerse);
   return unless eval { require B::Terse };
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   my @retval;
   for (qw(exec slow)) {
my $exp = $b_terse_exp{$_} order;
  @@ -440,7 +443,7 @@
   return unless status_config($r, StatusTerseSize);
   return unless eval { require B::TerseSize };
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   my @retval;
   for (qw(exec slow)) {
my $exp = $b_terse_exp{$_} order;
  @@ -471,7 +474,7 @@
   return unless status_config($r, StatusPackageSize);
   return unless eval { require B::TerseSize };
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   qq(a href=$script/$name?noh_b_package_sizeMemory Usage/a\n);
   }
   
  @@ -485,7 +488,7 @@
   
   no strict 'refs';
   my($package) = (split /, $r-uri)[-1];
  -my $script = $q-script_name;
  +my $script = $r-location;
   $r-print(Memory Usage for package $package\n\n);
   my($subs, $opcount, $opsize) = B::TerseSize::package_size($package);
   $r-print(Totals: $opsize bytes | $opcount OPs\n\n);
  @@ -525,7 +528,7 @@
   return unless eval { require B::Deparse };
   return unless $B::Deparse::VERSION = 0.59;
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   return qq(\na href=$script/$name?noh_b_deparseDeparse/a\n);
   }
   
  @@ -549,7 +552,7 @@
   return unless eval { require B::Fathom };
   return unless $B::Fathom::VERSION = 0.05;
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   return qq(\na href=$script/$name?noh_b_fathomFathom Score/a\n);
   }
   
  @@ -571,7 +574,7 @@
   return unless status_config($r, StatusPeek);
   return unless $is_installed{Apache::Peek};
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   return qq(\na href=$script/$name/$type?noh_peekPeek Dump/a\n);
   }
   
  @@ -592,7 +595,7 @@
   
   return unless $is_installed{B::Xref};
   
  -my $script = $q-script_name;
  +my $script = $r-location;
   return qq(\na href=$script/$name?noh_xrefCross Reference Report/a\n);
   }
   
  
  
  



cvs commit: modperl-2.0/lib/Apache Status.pm

2003-01-25 Thread stas
stas2003/01/25 05:26:11

  Added:   lib/Apache Status.pm
  Log:
  started porting Apache::Status to 2.0:
  - adjust style
  - use mod_perl 2.0 api (trying to get away from using compat.pm)
  - adjust the 'registry scripts' logic to work with the new registry cache
  (present scripts by the handler they are compiled in)
  
  Revision  ChangesPath
  1.1  modperl-2.0/lib/Apache/Status.pm
  
  Index: Status.pm
  ===
  package Apache::Status;
  
  use strict;
  #use warnings; #XXX FATAL = 'all'; 
  no warnings; # 'redefine';
  
  # XXX: something is wrong with bleadperl, it warns about redefine
  # warnings, when no warnings 'redefine' is set (test with 5.8.0). even
  # when used with 'no warnings' it still barks on redefinining the
  # constants
  
  
  
  # XXX
  # use mod_perl 2.0;
  
  use Apache::RequestRec ();
  use Apache::RequestUtil ();
  use Apache::ServerUtil ();
  
  $Apache::Status::VERSION = '3.00'; # mod_perl 2.0
  
  use constant IS_WIN32 = ($^O eq MSWin32);
  my $Is_Win32 = ($^O eq MSWin32);
  
  my %is_installed = ();
  {
  local $SIG{__DIE__};
  %is_installed = map {
$_, (eval(require $_) || 0);
  } qw (Data::Dumper Devel::Symdump B Apache::Request 
  Apache::Peek Apache::Symbol);
  }
  
  our $newQ;
  
  if ($is_installed{Apache::Request}) {
  $newQ ||= sub { Apache::Request-new(@_) };
  }
  else {
  $is_installed{CGI} = eval(require CGI) || 0;
  $newQ ||= sub { CGI-new; };
  }
  
  my $CPAN_base = http://cpan.org/modules/by-module/;;
  
  my $install_symdump = EOF;
  Please install the a href=$CPAN_base/Devel/Devel::Symdump/a module.
  EOF
  
  my %status = (
  script= PerlRequire'd Files,
  inc   = Loaded Modules,
  rgysubs   = Compiled Registry Scripts,
  'symdump' = Symbol Table Dump,
  inh_tree  = Inheritance Tree,
  isa_tree  = ISA Tree,  
  env   = Environment,
  sig   = Signal Handlers,
  myconfig  = Perl Configuration,
  hooks = Enabled mod_perl Hooks,
  );
  
  delete $status{'hooks'} if $mod_perl::VERSION = 1.9901;
  delete $status{'sig'} if IS_WIN32;
  
  # XXX: needs porting
  if ($Apache::Server::SaveConfig) {
  $status{section_config} = Perl Section Configuration;
  }
  
  sub menu_item {
  my($self, $key, $val, $sub) = @_;
  $status{$key} = $val;
  no strict;
  *{status_${key}} = $sub if $sub and ref $sub eq 'CODE';
  }
  
  sub handler {
  my($r) = @_;
  Apache-request($r); #for Apache::CGI
  my $qs = $r-args || ;
  my $sub = status_$qs;
  no strict 'refs';
  
  if ($qs =~ s/^(noh_\w+).*/$1/) {
return {$qs}($r, $newQ-($r));
  }
  
  header($r);
  if (defined $sub) {
$r-print(@{ {$sub}($r, $newQ-($r)) });
  }
  elsif ($qs and %{$qs.::}) {
$r-print(symdump($r, $newQ-($r), $qs));
  }
  else {
my $uri = $r-uri;
$r-print(
map { qq[a href=$uri?$_$status{$_}/abr\n] } keys %status
  );
  }
  $r-print(/body/html);
  
  1;
  }
  
  sub header {
  my $r = shift;
  my $start = scalar localtime $^T;
  my $srv = Apache::get_server_version();
  $r-content_type(text/html);
  my $v = $^V ? sprintf v%vd, $^V : $];
  $r-print(EOF);
  html
  headtitleApache::Status/title/head
  body
  Embedded Perl version b$v/b for b$srv/b process b$$/b, 
  br running since $starthr
  EOF
  
  }
  
  sub symdump {
  my($r, $q, $package) = @_;
  
  return $install_symdump unless $is_installed{Devel::Symdump};
  
  my $meth = new;
  $meth = rnew if lc($r-dir_config(StatusRdump)) eq on;
  my $sob = Devel::Symdump-$meth($package);
  return $sob-Apache::Status::as_HTML($package, $r, $q);
  }
  
  sub status_symdump {
  my($r, $q) = @_;
  [symdump($r, $q, 'main')];
  }
  
  sub status_section_config {
  my($r, $q) = @_;
  require Apache::PerlSections;
  [pre, Apache::PerlSections-dump, /pre];
  }
  
  sub status_hooks {
  my($r, $q) = @_;
  # XXX: hooks list access doesn't exist yet in 2.0
  require mod_perl;
  require mod_perl_hooks;
  my @retval = qw(table);
  my @list = mod_perl::hooks();
  for my $hook (sort @list) {
my $on_off = 
  mod_perl::hook($hook) ? bEnabled/b : iDisabled/i;
push @retval, trtd$hook/tdtd$on_off/td/tr\n;
  }
  push @retval, qw(/table);
  \@retval;
  }
  
  sub status_inc {
  my($r, $q) = @_;
  
  my $uri = $r-uri;
  my @retval = (
  table border=1,
  tr, 
  (map tdb$_/b/td, qw(Package Version Modified File)),
  /tr\n
  );
  
  foreach my $file (sort keys %INC) {
local $^W = 0;
next if $file =~ m:^/:;
next unless $file =~ m:\.pm:;
next unless $INC{$file}; #e.g. fake Apache/TieHandle.pm
  
no strict 'refs';
(my $module = $file) =~ 

cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-22 Thread stas
stas2003/01/22 16:31:28

  Modified:src/modules/perl mod_perl.c mod_perl.h modperl_filter.c
modperl_util.h
   .Changes
   xs/Apache/RequestIO Apache__RequestIO.h
   xs/Apache/SubRequest Apache__SubRequest.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  - add a new MP_FAILURE_CROAK macro to handle failures
  - all response functions are now returning status and the callers check
  and croak on failure or progate them further.
  
  Revision  ChangesPath
  1.147 +10 -4 modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- mod_perl.c12 Jan 2003 02:15:58 -  1.146
  +++ mod_perl.c23 Jan 2003 00:31:28 -  1.147
  @@ -709,12 +709,12 @@
   wb-r = r;
   }
   
  -void modperl_response_finish(request_rec *r)
  +apr_status_t modperl_response_finish(request_rec *r)
   {
   MP_dRCFG;
   
   /* flush output buffer */
  -modperl_wbucket_flush(rcfg-wbucket);
  +return modperl_wbucket_flush(rcfg-wbucket);
   }
   
   static int modperl_response_handler_run(request_rec *r, int finish)
  @@ -730,7 +730,10 @@
   }
   
   if (finish) {
  -modperl_response_finish(r);
  +apr_status_t rc = modperl_response_finish(r);
  +if (rc != APR_SUCCESS) {
  +retval = rc;
  +}
   }
   
   return retval;
  @@ -803,7 +806,10 @@
   #endif
   
   /* flush output buffer after interpreter is putback */
  -modperl_response_finish(r);
  +apr_status_t rc = modperl_response_finish(r);
  +if (rc != APR_SUCCESS) {
  +retval = rc;
  +}
   
   switch (rcfg-status) {
 case HTTP_MOVED_TEMPORARILY:
  
  
  
  1.56  +1 -1  modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- mod_perl.h12 Dec 2002 10:05:08 -  1.55
  +++ mod_perl.h23 Jan 2003 00:31:28 -  1.56
  @@ -88,7 +88,7 @@
   void xs_init(pTHX);
   
   void modperl_response_init(request_rec *r);
  -void modperl_response_finish(request_rec *r);
  +apr_status_t modperl_response_finish(request_rec *r);
   int modperl_response_handler(request_rec *r);
   int modperl_response_handler_cgi(request_rec *r);
   
  
  
  
  1.45  +5 -6  modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- modperl_filter.c  17 Jan 2003 03:08:31 -  1.44
  +++ modperl_filter.c  23 Jan 2003 00:31:28 -  1.45
  @@ -23,6 +23,8 @@
   ap_log_error(APLOG_MARK, APLOG_WARNING,
0, r-server, %s did not send an HTTP header,
r-uri);
  +/* XXX: bodytext == NULL here */
  +return status;
   }
   else if (!bodytext) {
   return APR_SUCCESS;
  @@ -190,17 +192,14 @@
* first modperl_input_filter_read, so it must be
* destroyed at the end of the filter invocation
*/
  -/* XXX: may be the filter must consume all the data? add a
  - * test to check */
   apr_brigade_destroy(filter-bb_in);
   filter-bb_in = NULL;
   }
  -modperl_input_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_input_filter_flush(filter));
   }
   else {
  -modperl_output_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
   }
  -
   
   return status;
   }
  @@ -457,7 +456,7 @@
   
   if (filter-flush  len == 0) {
   /* if len  0 then $filter-write will flush */
  -modperl_output_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
   }
   
   return len;
  
  
  
  1.38  +7 -0  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- modperl_util.h11 Jan 2003 00:02:16 -  1.37
  +++ modperl_util.h23 Jan 2003 00:31:28 -  1.38
  @@ -50,6 +50,13 @@
   #define MP_magical_tie(sv, mg_flags) \
   SvFLAGS((SV*)sv) |= mg_flags
   
  +#define

cvs commit: modperl-2.0 Makefile.PL Changes

2003-01-22 Thread stas
stas2003/01/22 21:16:30

  Modified:.Makefile.PL Changes
  Log:
  the top level 'make test' now descends into the ModPerl-Registry dir
  to run 'make test' there
  
  Revision  ChangesPath
  1.90  +24 -1 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Makefile.PL   11 Jan 2003 03:20:54 -  1.89
  +++ Makefile.PL   23 Jan 2003 05:16:30 -  1.90
  @@ -29,7 +29,6 @@
   use Apache::TestReportPerl ();
   use Apache::TestSmokePerl ();
   use Apache::TestTrace;
  -use Apache::TestMM qw(test);
   use ModPerl::TestRun ();
   use ModPerl::Code ();
   use ModPerl::MM ();
  @@ -442,6 +441,30 @@
   ModPerl::MM::add_dep(\$string, clean = 'modperl_src_clean');
   ModPerl::MM::add_dep(\$string, clean = 'test_clean');
   $string;
  +}
  +
  +sub MY::test {
  +
  +my $env = Apache::TestConfig-passenv_makestr();
  +
  +my $preamble = Apache::TestConfig::WIN32 ?  : EOF;
  +PASSENV = $env
  +EOF
  +
  +return $preamble . 'EOF';
  +test_clean :
  + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
  + t/TEST -clean
  + 
  +run_tests : test_clean
  + $(PASSENV) \
  + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
  + t/TEST
  + cd ModPerl-Registry  make test
  +
  +test :: pure_all run_tests test_clean
  +EOF
  +
   }
   
   sub MY::postamble {
  
  
  
  1.112 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- Changes   23 Jan 2003 04:06:38 -  1.111
  +++ Changes   23 Jan 2003 05:16:30 -  1.112
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +the top level 'make test' now descend into the ModPerl-Registry dir
  +to run 'make test' there [Stas]
  +
   Apache::Test: don't inherit loading of the mod_perl object from the
   system-wide config, since we already add it [Stas]
   
  
  
  



cvs commit: modperl Makefile.PL Changes

2003-01-22 Thread stas
stas2003/01/22 20:25:05

  Modified:.Makefile.PL Changes
  Log:
  use $Config{'installstyle'} instead of hardcoded 'lib', to handle
  Makefile.PL's PREFIX option correctly
  Submitted by: Philippe M. Chiasson [EMAIL PROTECTED]
  Reviewed by:  stas
  
  Revision  ChangesPath
  1.205 +1 -1  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.204
  retrieving revision 1.205
  diff -u -r1.204 -r1.205
  --- Makefile.PL   19 Jun 2002 16:31:52 -  1.204
  +++ Makefile.PL   23 Jan 2003 04:25:04 -  1.205
  @@ -347,7 +347,7 @@
   if ($k eq 'PREFIX') {
   require File::Spec;
   $MOD_PERL_PREFIX =
  -  File::Spec-catfile($v, 'lib', 'site_perl',
  +  File::Spec-catfile($v, $Config{'installstyle'}, 'site_perl',
 $Config{'version'}, $Config{'archname'});
   }

  
  
  
  1.659 +4 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.658
  retrieving revision 1.659
  diff -u -r1.658 -r1.659
  --- Changes   25 Dec 2002 01:46:09 -  1.658
  +++ Changes   23 Jan 2003 04:25:04 -  1.659
  @@ -10,6 +10,10 @@
   
   =item 1.27_01-dev
   
  +use $Config{'installstyle'} instead of hardcoded 'lib', to handle
  +Makefile.PL's PREFIX option correctly [Philippe M. Chiasson
  +[EMAIL PROTECTED]]
  +
   prevent segfaults in mod_perl_mark_where() when a sub can't get
   resolved [Gerald Richter [EMAIL PROTECTED]]
   
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-21 Thread stas
stas2003/01/21 19:19:43

  Modified:.Changes
   src/modules/perl modperl_io.c modperl_io.h
   t/modperl .cvsignore
   todo api.txt
   xs/Apache/RequestIO Apache__RequestIO.h
   xs/maps  modperl_functions.map
   xs/tables/current/ModPerl FunctionTable.pm
  Added:   t/response/TestModperl request_rec_tie_api.pm
  Log:
  - expose useful macros from modperl_io.c via modperl_io.h
  - add $r-FILENO implementation
  - add a test
  
  Revision  ChangesPath
  1.107 +2 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- Changes   20 Jan 2003 07:54:52 -  1.106
  +++ Changes   22 Jan 2003 03:19:43 -  1.107
  @@ -10,6 +10,8 @@
   
   =item 1.99_09-dev
   
  +Add $r-FILENO implementation [Stas]
  +
   Apache::Test: Support NoAutoConfig /NoAutoConfig blocks in .pm
   files, so we can have a full manual control over generated config
   sections. These sections are fully parsed and variables are
  
  
  
  1.1  modperl-2.0/t/response/TestModperl/request_rec_tie_api.pm
  
  Index: request_rec_tie_api.pm
  ===
  package TestModperl::request_rec_tie_api;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::RequestIO ();
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile = 'OK';
  
  sub handler {
  my $r = shift;
  
  plan $r, tests = 1;
  
  ok t_cmp(fileno(STDOUT), $r-FILENO(), FILENO);
  
  return Apache::OK;
  }
  
  1;
  
  
  
  1.9   +0 -13 modperl-2.0/src/modules/perl/modperl_io.c
  
  Index: modperl_io.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- modperl_io.c  24 Mar 2002 02:41:29 -  1.8
  +++ modperl_io.c  22 Jan 2003 03:19:43 -  1.9
  @@ -1,18 +1,5 @@
   #include mod_perl.h
   
  -/*
  - * bleedperl change #11639 switch tied handle magic
  - * from living in the gv to the GvIOp(gv), so we have to deal
  - * with both to support 5.6.x
  - */
  -#if ((PERL_REVISION == 5)  (PERL_VERSION = 7))
  -#   define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle)
  -#else
  -#   define TIEHANDLE_SV(handle) (SV*)handle
  -#endif
  -
  -#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO)
  -
   #define TIEHANDLE(handle,r) \
   modperl_io_handle_tie(aTHX_ handle, Apache::RequestRec, (void *)r)
   
  
  
  
  1.2   +13 -0 modperl-2.0/src/modules/perl/modperl_io.h
  
  Index: modperl_io.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_io.h  5 May 2001 22:06:41 -   1.1
  +++ modperl_io.h  22 Jan 2003 03:19:43 -  1.2
  @@ -1,6 +1,19 @@
   #ifndef MODPERL_IO_H
   #define MODPERL_IO_H
   
  +/*
  + * bleedperl change #11639 switch tied handle magic
  + * from living in the gv to the GvIOp(gv), so we have to deal
  + * with both to support 5.6.x
  + */
  +#if ((PERL_REVISION == 5)  (PERL_VERSION = 7))
  +#   define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle)
  +#else
  +#   define TIEHANDLE_SV(handle) (SV*)handle
  +#endif
  +
  +#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO)
  +
   #define IoFLUSH_off(gv) \
   IoFLAGS(GvIOp((gv))) = ~IOf_FLUSH
   
  
  
  
  1.11  +1 -0  modperl-2.0/t/modperl/.cvsignore
  
  Index: .cvsignore
  ===
  RCS file: /home/cvs/modperl-2.0/t/modperl/.cvsignore,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- .cvsignore22 Oct 2002 15:13:22 -  1.10
  +++ .cvsignore22 Jan 2003 03:19:43 -  1.11
  @@ -10,3 +10,4 @@
   methodobj.t
   method.t
   setauth.t
  +request_rec_tie_api.t
  
  
  
  1.30  +1 -1  modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- api.txt   6 Dec 2002 16:19:36 -   1.29
  +++ api.txt   22 Jan 2003 03:19:43 -  1.30
  @@ -3,7 +3,7 @@
   --
   
   tied filehandle interface:
  - -CLOSE, OPEN, EOF, TELL, SEEK, FILENO
  + -CLOSE, OPEN, EOF, TELL, SEEK
-READLINE - proper implementation (see comment in Apache::compat)
   
   $r-finfo:
  
  
  
  1.31  +7 -0  modperl-2.0/xs/Apache/RequestIO

cvs commit: modperl-2.0/t/error push_handlers.t

2003-01-21 Thread stas
stas2003/01/21 23:00:29

  Modified:t/error  push_handlers.t
  Log:
  use the new under_construction test to print a descriptive skip reason
  
  Revision  ChangesPath
  1.3   +1 -1  modperl-2.0/t/error/push_handlers.t
  
  Index: push_handlers.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/error/push_handlers.t,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- push_handlers.t   21 Jan 2003 06:30:23 -  1.2
  +++ push_handlers.t   22 Jan 2003 07:00:29 -  1.3
  @@ -7,7 +7,7 @@
   
   # XXX: the misuse of push_handlers exercised by this test is different
   # at least on FreeBSD, so it fails, skip for now.
  -plan tests = 1, have { ignore = sub { 0 } };
  +plan tests = 1, under_construction;
   
   my $location = /TestError::push_handlers;
   my $expected = ok;
  
  
  



cvs commit: modperl-2.0 Changes

2003-01-21 Thread stas
stas2003/01/21 23:02:14

  Modified:.Changes
  Log:
  log the recent changes
  
  Revision  ChangesPath
  1.109 +5 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- Changes   22 Jan 2003 06:12:42 -  1.108
  +++ Changes   22 Jan 2003 07:02:14 -  1.109
  @@ -10,6 +10,11 @@
   
   =item 1.99_09-dev
   
  +Apache::Test: support two new shortcuts for skip functionality:
  + - have_threads: checks whether both Apache and Perl support threads
  + - under_construction: to print a consistent/clear skip reason
  +[Stas]
  +
   OPEN, CLOSE and FILENO implementation for Apache::RequestRec [Stas]
   
   Apache::Test: Support NoAutoConfig /NoAutoConfig blocks in .pm
  
  
  



cvs commit: modperl-2.0/t/filter .cvsignore

2003-01-20 Thread stas
stas2003/01/20 15:14:40

  Modified:t/filter .cvsignore
  Log:
  adjust the ignore list
  
  Revision  ChangesPath
  1.4   +2 -5  modperl-2.0/t/filter/.cvsignore
  
  Index: .cvsignore
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/.cvsignore,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- .cvsignore25 Nov 2002 22:46:29 -  1.3
  +++ .cvsignore20 Jan 2003 23:14:40 -  1.4
  @@ -1,6 +1,3 @@
  -api.t
  -buckets.t
  -input_body.t
  -input_msg.t
  -lc.t
  +out_bbs_basic.t
  +out_str_api.t
   
  
  
  



cvs commit: modperl-2.0/t/error push_handlers.t

2003-01-20 Thread stas
stas2003/01/20 22:30:23

  Modified:t/error  push_handlers.t
  Log:
  disable this test for now:
   the misuse of push_handlers exercised by this test is different
  at least on FreeBSD, so it fails, skip for now.
  
  Revision  ChangesPath
  1.2   +3 -1  modperl-2.0/t/error/push_handlers.t
  
  Index: push_handlers.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/error/push_handlers.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- push_handlers.t   14 Jan 2003 06:42:44 -  1.1
  +++ push_handlers.t   21 Jan 2003 06:30:23 -  1.2
  @@ -5,7 +5,9 @@
   use Apache::TestUtil;
   use Apache::TestRequest;
   
  -plan tests = 1;
  +# XXX: the misuse of push_handlers exercised by this test is different
  +# at least on FreeBSD, so it fails, skip for now.
  +plan tests = 1, have { ignore = sub { 0 } };
   
   my $location = /TestError::push_handlers;
   my $expected = ok;
  
  
  



cvs commit: modperl-2.0/t/response/TestAPR threadmutex.pm

2003-01-20 Thread stas
stas2003/01/20 22:54:22

  Modified:t/response/TestAPR threadmutex.pm
  Log:
  fix the plan skip condition, which wasn't skipping the test before
  
  Revision  ChangesPath
  1.3   +1 -1  modperl-2.0/t/response/TestAPR/threadmutex.pm
  
  Index: threadmutex.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/threadmutex.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- threadmutex.pm23 Jun 2002 22:14:26 -  1.2
  +++ threadmutex.pm21 Jan 2003 06:54:22 -  1.3
  @@ -12,7 +12,7 @@
   sub handler {
   my $r = shift;
   
  -plan $r, tests = 3, 'APR::ThreadMutex';
  +plan $r, tests = 3, have 'APR::ThreadMutex';
   
   require APR::ThreadMutex;
   
  
  
  



cvs commit: modperl-2.0/t/preconnection/TestPreConnection - New directory

2003-01-19 Thread stas
stas2003/01/19 23:55:35

  modperl-2.0/t/preconnection/TestPreConnection - New directory



cvs commit: modperl-2.0/t/preconnection/TestPreConnection note.pm

2003-01-19 Thread stas
stas2003/01/19 23:56:17

  Added:   t/preconnection note.t
   t/preconnection/TestPreConnection note.pm
  Log:
  add a simple test to verify that PreConnection handlers are working
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/preconnection/note.t
  
  Index: note.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  my $module = TestPreConnection::note;
  Apache::TestRequest::module($module);
  my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
  my $location = http://$hostport/$module;;
  t_debug(connecting to $location);
  plan tests = 1;
  
  ok t_cmp(
  'ok', 
  GET_BODY($location),
  connection notes);
  
  
  
  1.1  modperl-2.0/t/preconnection/TestPreConnection/note.pm
  
  Index: note.pm
  ===
  package TestPreConnection::note;
  
  use strict;
  use warnings;# FATAL = 'all';
  
  use Apache::Connection ();
  
  use Apache::Const -compile = qw(OK);
  
  sub handler {
  my Apache::Connection $c = shift;
  
  $c-notes-set(preconnection = 'ok');
  
  return Apache::OK;
  }
  
  use constant BUFF_LEN = 1024;
  
  sub response {
  my $r = shift;
  
  $r-content_type('text/plain');
  $r-print($r-connection-notes-get('preconnection') || '');
  
  return Apache::OK
  }
  
  1;
  __END__
  NoAutoConfig
VirtualHost TestPreConnection::note
  PerlPreConnectionHandler TestPreConnection::note

  Location /TestPreConnection::note
SetHandler modperl
PerlResponseHandler TestPreConnection::note::response
  /Location
/VirtualHost
  /NoAutoConfig
  
  
  
  
  



cvs commit: modperl-2.0/t/preconnection/TestPreConnection note.pm

2003-01-19 Thread stas
stas2003/01/19 23:59:44

  Modified:t/preconnection/TestPreConnection note.pm
  Log:
  cleanup
  
  Revision  ChangesPath
  1.2   +1 -3  modperl-2.0/t/preconnection/TestPreConnection/note.pm
  
  Index: note.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/preconnection/TestPreConnection/note.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- note.pm   20 Jan 2003 07:56:17 -  1.1
  +++ note.pm   20 Jan 2003 07:59:44 -  1.2
  @@ -1,7 +1,7 @@
   package TestPreConnection::note;
   
   use strict;
  -use warnings;# FATAL = 'all';
  +use warnings FATAL = 'all';
   
   use Apache::Connection ();
   
  @@ -14,8 +14,6 @@
   
   return Apache::OK;
   }
  -
  -use constant BUFF_LEN = 1024;
   
   sub response {
   my $r = shift;
  
  
  



cvs commit: modperl-2.0 Changes

2003-01-17 Thread stas
stas2003/01/17 17:59:22

  Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm
   .Changes
  Log:
  Another fix for the handling of the return status in
  ModPerl::RegistryCooker: reset the status to the original one only if
  it was changed by the script, otherwise return the execution status
  
  Revision  ChangesPath
  1.28  +6 -2  modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
  
  Index: RegistryCooker.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- RegistryCooker.pm 6 Jan 2003 10:42:38 -   1.27
  +++ RegistryCooker.pm 18 Jan 2003 01:59:21 -  1.28
  @@ -163,9 +163,13 @@
   # handlers shouldn't set $r-status but return it
   my $old_status = $self-[REQ]-status;
   my $rc = $self-run;
  -$self-[REQ]-status($old_status);
  +my $new_status = $self-[REQ]-status;
   
  -return ($rc != Apache::OK) ? $rc : $self-[STATUS];
  +# only if the script has changed the status, reset to the old
  +# status and return the new status
  +return $old_status != $new_status 
  +? $self-[REQ]-status($old_status)
  +: $rc;
   }
   
   #
  
  
  
  1.105 +5 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- Changes   17 Jan 2003 03:23:24 -  1.104
  +++ Changes   18 Jan 2003 01:59:22 -  1.105
  @@ -10,6 +10,11 @@
   
   =item 1.99_09-dev
   
  +Another fix for the handling of the return status in
  +ModPerl::RegistryCooker: reset the status to the original one only if
  +it was changed by the script, otherwise return the execution status
  +[Stas]
  +
   prevent segfault in $r-print / $filter-print (in output filter) and
   related functions when they are called before the response phase
   [Stas]
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm

2003-01-17 Thread stas
stas2003/01/17 18:04:32

  Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm
  Log:
  apparently there is not much use for the return status of eval
  
  Revision  ChangesPath
  1.29  +3 -6  modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
  
  Index: RegistryCooker.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- RegistryCooker.pm 18 Jan 2003 01:59:21 -  1.28
  +++ RegistryCooker.pm 18 Jan 2003 02:04:32 -  1.29
  @@ -64,7 +64,6 @@
   use constant MTIME = 3;
   use constant PACKAGE   = 4;
   use constant CODE  = 5;
  -use constant STATUS= 6;
   
   #
   # OS specific constants
  @@ -189,15 +188,13 @@
   $self-set_script_name;
   $self-chdir_file;
   
  -my $rc = Apache::OK;
   my $cv = \{$package\::handler};
   
   my %orig_inc = %INC;
   
   { # run the code and preserve warnings setup when it's done
   no warnings;
  -eval { $rc = $cv-($r, @_) };
  -$self-[STATUS] = $rc;
  +eval { $cv-($r, @_) };
   ModPerl::Global::special_list_call(END = $package);
   }
   
  @@ -212,8 +209,8 @@
   
   #XXX: $self-chdir_file($Apache::Server::CWD/);
   
  -if ( ($rc = $self-error_check) != Apache::OK) {
  -return $rc;
  +if ( (my $err_rc = $self-error_check) != Apache::OK) {
  +return $err_rc;
   }
   
   return Apache::OK;
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-16 Thread stas
stas2003/01/16 18:26:32

  Modified:.Changes
   xs/Apache/Response Apache__Response.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  fix segfault in send_http_header when it's called before the response
  phase
  
  Revision  ChangesPath
  1.102 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Changes   16 Jan 2003 02:38:09 -  1.101
  +++ Changes   17 Jan 2003 02:26:31 -  1.102
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +fix segfault in send_http_header when it's called before the response
  +phase [Stas]
  +
   input stream filtering support was added + tests (plus renaming filter
   tests so we can know from the test name what kind of filter is tested)
   [Stas]
  
  
  
  1.8   +11 -2 modperl-2.0/xs/Apache/Response/Apache__Response.h
  
  Index: Apache__Response.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Response/Apache__Response.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Apache__Response.h19 May 2002 23:01:12 -  1.7
  +++ Apache__Response.h17 Jan 2003 02:26:31 -  1.8
  @@ -15,7 +15,8 @@
   
   /* XXX: should only be part of Apache::compat */
   static MP_INLINE void
  -mpxs_Apache__RequestRec_send_http_header(request_rec *r, const char *type)
  +mpxs_Apache__RequestRec_send_http_header(pTHX_ request_rec *r,
  + const char *type)
   {
   MP_dRCFG;
   
  @@ -23,7 +24,15 @@
   ap_set_content_type(r, apr_pstrdup(r-pool, type));
   }
   
  -rcfg-wbucket-header_parse = 0; /* turn off PerlOptions +ParseHeaders */
  +if (rcfg-wbucket) {
  +/* turn off PerlOptions +ParseHeaders */
  +rcfg-wbucket-header_parse = 0; 
  +}
  +else {
  +/* the response is not initialized yet */
  +Perl_croak(aTHX_ send_http_header() can't be called before 
  +   the response phase);
  +}
   }
   
   static MP_INLINE void
  
  
  
  1.95  +4 -0  modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- FunctionTable.pm  15 Jan 2003 06:07:10 -  1.94
  +++ FunctionTable.pm  17 Jan 2003 02:26:32 -  1.95
  @@ -5370,6 +5370,10 @@
   'name' = 'mpxs_Apache__RequestRec_send_http_header',
   'args' = [
 {
  +'type' = 'PerlInterpreter *',
  +'name' = 'my_perl'
  +  },
  +  {
   'type' = 'request_rec *',
   'name' = 'r'
 },
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-16 Thread stas
stas2003/01/16 19:08:31

  Modified:src/modules/perl modperl_filter.c modperl_filter.h
   .Changes
   xs   modperl_xs_util.h
   xs/Apache/RequestIO Apache__RequestIO.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  prevent segfault in $r-print / $filter-print (in output filter) and
  related functions when they are called before the response phase
  
  Revision  ChangesPath
  1.44  +11 -4 modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- modperl_filter.c  15 Jan 2003 06:07:10 -  1.43
  +++ modperl_filter.c  17 Jan 2003 03:08:31 -  1.44
  @@ -55,13 +55,18 @@
   return rv;
   }
   
  -MP_INLINE apr_status_t modperl_wbucket_write(modperl_wbucket_t *wb,
  +MP_INLINE apr_status_t modperl_wbucket_write(pTHX_ modperl_wbucket_t *wb,
const char *buf,
apr_size_t *wlen)
   {
   apr_size_t len = *wlen;
   *wlen = 0;
   
  +if (!wb) {
  +/* the response is not initialized yet */
  +Perl_croak(aTHX_ can't be called before the response phase);
  +}
  +
   if ((len + wb-outcnt)  sizeof(wb-outbuf)) {
   apr_status_t rv;
   if ((rv = modperl_wbucket_flush(wb)) != APR_SUCCESS) {
  @@ -505,7 +510,8 @@
   return filter-rc;
   }
   
  -MP_INLINE apr_status_t modperl_input_filter_write(modperl_filter_t *filter,
  +MP_INLINE apr_status_t modperl_input_filter_write(pTHX_
  +  modperl_filter_t *filter,
 const char *buf,
 apr_size_t *len)
   {
  @@ -519,11 +525,12 @@
   return APR_SUCCESS;
   }
   
  -MP_INLINE apr_status_t modperl_output_filter_write(modperl_filter_t *filter,
  +MP_INLINE apr_status_t modperl_output_filter_write(pTHX_
  +   modperl_filter_t *filter,
  const char *buf,
  apr_size_t *len)
   {
  -return modperl_wbucket_write(filter-wbucket, buf, len);
  +return modperl_wbucket_write(aTHX_ filter-wbucket, buf, len);
   }
   
   apr_status_t modperl_output_filter_handler(ap_filter_t *f,
  
  
  
  1.17  +6 -3  modperl-2.0/src/modules/perl/modperl_filter.h
  
  Index: modperl_filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- modperl_filter.h  15 Jan 2003 06:07:10 -  1.16
  +++ modperl_filter.h  17 Jan 2003 03:08:31 -  1.17
  @@ -16,7 +16,8 @@
   
   MP_INLINE apr_status_t modperl_wbucket_flush(modperl_wbucket_t *b);
   
  -MP_INLINE apr_status_t modperl_wbucket_write(modperl_wbucket_t *b,
  +MP_INLINE apr_status_t modperl_wbucket_write(pTHX_
  + modperl_wbucket_t *b,
const char *buf,
apr_size_t *wlen);
   
  @@ -50,7 +51,8 @@
   SV *buffer,
   apr_size_t wanted);
   
  -MP_INLINE apr_status_t modperl_output_filter_write(modperl_filter_t *filter,
  +MP_INLINE apr_status_t modperl_output_filter_write(pTHX_
  +   modperl_filter_t *filter,
  const char *buf,
  apr_size_t *len);
   
  @@ -75,7 +77,8 @@
  SV *buffer,
  apr_size_t wanted);
   
  -MP_INLINE apr_status_t modperl_input_filter_write(modperl_filter_t *filter,
  +MP_INLINE apr_status_t modperl_input_filter_write(pTHX_
  +  modperl_filter_t *filter,
 const char *buf,
 apr_size_t *len);
   
  
  
  
  1.103 +5 -2  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- Changes   17 Jan 2003 02:26:31 -  1.102
  +++ Changes   17 Jan 2003 03:08:31 -  1.103
  @@ -10,8 +10,11 @@
   
   =item 1.99_09-dev
   
  -fix

cvs commit: modperl-2.0 Changes

2003-01-15 Thread stas
stas2003/01/15 18:38:09

  Modified:.Changes
  Log:
  log the recent changes
  
  Revision  ChangesPath
  1.101 +14 -2 modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- Changes   14 Jan 2003 06:42:44 -  1.100
  +++ Changes   16 Jan 2003 02:38:09 -  1.101
  @@ -10,9 +10,21 @@
   
   =item 1.99_09-dev
   
  -prevent a segfault when push_handlers are used to push a handler into
  -the currently phase and switching the handler (perl-script/modperl)
  +input stream filtering support was added + tests (plus renaming filter
  +tests so we can know from the test name what kind of filter is tested)
   [Stas]
  +
  +Add proper support for mis-behaved feeding filters that send more than
  +one EOS bucket in streaming filters + test. [Stas]
  +
  +implement a more robust autogenerated client .t test in
  +Apache::TestConfigPerl. Before this fix if the server side returned
  +500, the test would get skipped, not good. Now it will die a horrible
  +death. [Stas]
  +
  +prevent a segfault when push_handlers are used to push a handler into
  +the currently phase and switching the handler (perl-script/modperl) +
  +tests [Stas]
   
   Add $filter-seen_eos to the streaming filter api to know when eos has
   been seen, so special signatures can be passed and any data stored in
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter in_str_consume.pm

2003-01-15 Thread stas
stas2003/01/15 21:15:18

  Added:   t/filter in_str_consume.t
   t/filter/TestFilter in_str_consume.pm
  Log:
  add a faulty filter test, but keep the fault disabled for now
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/filter/in_str_consume.t
  
  Index: in_str_consume.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my $location = '/TestFilter::in_str_consume';
  
  # send a message bigger than 8k, so to make sure that the input filter
  # will get more than one bucket brigade with data.
  my $data = A 22 chars long string x 500; # about 11k
  my $received = POST_BODY $location, content = $data;
  my $expected = read just the first 1024b from the first brigade;
  
  ok t_cmp($expected, $received, input stream filter partial consume)
  
  
  
  1.1  modperl-2.0/t/filter/TestFilter/in_str_consume.pm
  
  Index: in_str_consume.pm
  ===
  package TestFilter::in_str_consume;
  
  # this test verifies that streaming filters framework handles
  # gracefully the case when a filter doesn't print anything at all to
  # the caller. I figure it's absolutely doesn't matter if the incoming
  # bb from the upstream is consumed or not. What matter is that the
  # filter sends something downstream (an empty bb will do).
  #
  # e.g. a filter that cleans up the incoming stream (extra spaces?)
  # might reduce the whole bb into nothing (e.g. if it was made of only
  # white spaces) then it should send  down.
  #
  # another problem with not reading in the while() loop, is that the
  # eos bucket won't be detected by the streaming framework and
  # consequently won't be sent downstream, probably breaking other
  # filters who rely on receiving the EOS bucket.
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Filter ();
  
  use Apache::Const -compile = qw(OK M_POST);
  
  sub handler {
  my($filter, $bb, $mode, $block, $readbytes) = @_;
  
  my $ctx = $filter-ctx;
  
  unless ($ctx) {
  # read a bit from the first brigade and leave the second
  # brigade completely unconsumed. we assume that there are two
  # brigades because the core input filter will split data in
  # 8kb chunks per brigade and we have sent 11k of data (1st bb:
  # 8kb, 2nd bb: ~3kb)
  my $len = $filter-read($mode, $block, $readbytes, my $buffer, 1024);
  warn FILTER READ: $len bytes\n;
  $filter-print(read just the first 1024b from the first brigade);
  
  $filter-ctx(1);
  }
  else {
  unless ($filter-seen_eos) {
  # XXX: comment out the next line to reproduce the segfault
  $filter-print();
  }
  }
  
  return Apache::OK;
  }
  
  sub response {
  my $r = shift;
  
  $r-content_type('text/plain');
  
  if ($r-method_number == Apache::M_POST) {
  my $data = ModPerl::Test::read_post($r);
  #warn HANDLER READ: $data\n;
  $r-print($data);
  }
  
  return Apache::OK;
  }
  1;
  __DATA__
  SetHandler modperl
  PerlResponseHandler TestFilter::in_str_consume::response
  
  
  



cvs commit: modperl-2.0 STATUS

2003-01-14 Thread stas
stas2003/01/14 21:22:53

  Modified:.STATUS
  Log:
  an issue to resolve
  
  Revision  ChangesPath
  1.33  +8 -1  modperl-2.0/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/modperl-2.0/STATUS,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- STATUS11 Jan 2003 04:14:55 -  1.32
  +++ STATUS15 Jan 2003 05:22:53 -  1.33
  @@ -50,6 +50,13 @@
   Needs Patch or Further Investigation:
   -
   
  +* Currently modperl_filter_add_{connection|request} check the filter
  +  handler function attrs before accepting the filter. If the module
  +  wasn't preloaded the check fails and filter handler is skipped. We
  +  could have this issue documented (which is OK, but might raise too
  +  many questions), but we could also always preload the filter
  +  handlers. To test see TestFilter::input_msg
  +
   * we still have a problem with mod_perl starting from a
 vhost. consider the following config:
   
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-14 Thread stas
stas2003/01/14 22:07:11

  Modified:src/modules/perl modperl_filter.c modperl_filter.h
modperl_types.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  - implementation of the input stream filtering support (1st phase)
  - code refactoring to be re-use for input and output filtering
  - proper support for mis-behaved feeding filters that send more than one
  EOS bucket
  
  Revision  ChangesPath
  1.43  +225 -66   modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- modperl_filter.c  12 Jan 2003 02:21:37 -  1.42
  +++ modperl_filter.c  15 Jan 2003 06:07:10 -  1.43
  @@ -94,15 +94,23 @@
   
   filter-mode = mode;
   filter-f = f;
  -filter-bb = bb;
   filter-pool = p;
   filter-wbucket.pool = p;
   filter-wbucket.filters = f-next;
   filter-wbucket.outcnt = 0;
   
  +if (mode == MP_INPUT_FILTER_MODE) {
  +filter-bb_in  = NULL;
  +filter-bb_out = bb;
  +}
  +else {
  +filter-bb_in  = bb;
  +filter-bb_out = NULL;
  +}
  +
   MP_TRACE_f(MP_FUNC, filter=0x%lx, mode=%s\n,
  -   (unsigned long)filter, mode == MP_OUTPUT_FILTER_MODE ?
  -   output : input);
  +   (unsigned long)filter,
  +   mode == MP_INPUT_FILTER_MODE ? input : output);
   
   return filter;
   }
  @@ -138,7 +146,10 @@
   
   modperl_handler_make_args(aTHX_ args,
 Apache::Filter, filter-f,
  -  APR::Brigade, filter-bb,
  +  APR::Brigade,
  +  (filter-mode == MP_INPUT_FILTER_MODE
  +   ? filter-bb_out
  +   : filter-bb_in),
 NULL);
   
   modperl_filter_mg_set(aTHX_ AvARRAY(args)[0], filter);
  @@ -168,26 +179,59 @@
   filter-seen_eos = 0;
   }
   
  -if (filter-mode == MP_OUTPUT_FILTER_MODE) {
  +if (filter-mode == MP_INPUT_FILTER_MODE) {
  +if (filter-bb_in) {
  +/* in the streaming mode filter-bb_in is populated on the
  + * first modperl_input_filter_read, so it must be
  + * destroyed at the end of the filter invocation
  + */
  +/* XXX: may be the filter must consume all the data? add a
  + * test to check */
  +apr_brigade_destroy(filter-bb_in);
  +filter-bb_in = NULL;
  +}
  +modperl_input_filter_flush(filter);
  +}
  +else {
   modperl_output_filter_flush(filter);
   }
  +
   
   return status;
   }
   
   /* output filters */
   
  -MP_INLINE static apr_status_t send_eos(ap_filter_t *f)
  +MP_INLINE static apr_status_t send_input_eos(modperl_filter_t *filter)
  +{
  +apr_bucket_alloc_t *ba = filter-f-c-bucket_alloc;
  +apr_bucket *b = apr_bucket_eos_create(ba);
  +APR_BRIGADE_INSERT_TAIL(filter-bb_out, b);
  +((modperl_filter_ctx_t *)filter-f-ctx)-sent_eos = 1;
  +return APR_SUCCESS;
  +
  +}
  +
  +MP_INLINE static apr_status_t send_input_flush(modperl_filter_t *filter)
  +{
  +apr_bucket_alloc_t *ba = filter-f-c-bucket_alloc;
  +apr_bucket *b = apr_bucket_flush_create(ba);
  +APR_BRIGADE_INSERT_TAIL(filter-bb_out, b);
  +return APR_SUCCESS;
  +}
  +
  +MP_INLINE static apr_status_t send_output_eos(ap_filter_t *f)
   {
   apr_bucket_alloc_t *ba = f-c-bucket_alloc;
   apr_bucket_brigade *bb = apr_brigade_create(MP_FILTER_POOL(f),
   ba);
   apr_bucket *b = apr_bucket_eos_create(ba);
   APR_BRIGADE_INSERT_TAIL(bb, b);
  +((modperl_filter_ctx_t *)f-ctx)-sent_eos = 1;
   return ap_pass_brigade(f-next, bb);
   }
   
  -MP_INLINE static apr_status_t send_flush(ap_filter_t *f)
  +MP_INLINE static apr_status_t send_output_flush(ap_filter_t *f)
   {
   apr_bucket_alloc_t *ba = f-c-bucket_alloc;
   apr_bucket_brigade *bb = apr_brigade_create(MP_FILTER_POOL(f),
  @@ -199,11 +243,14 @@
   
   /* unrolled APR_BRIGADE_FOREACH loop */
   
  +#define MP_FILTER_EMPTY(filter) \
  +APR_BRIGADE_EMPTY(filter-bb_in)
  +
   #define MP_FILTER_SENTINEL(filter) \
  -APR_BRIGADE_SENTINEL(filter-bb)
  +APR_BRIGADE_SENTINEL(filter-bb_in)
   
   #define MP_FILTER_FIRST(filter) \
  -APR_BRIGADE_FIRST(filter-bb)
  +APR_BRIGADE_FIRST(filter-bb_in)
   
   #define MP_FILTER_NEXT(filter) \
   APR_BUCKET_NEXT(filter-bucket)
  @@ -216,52 +263,83 @@
   
   MP_INLINE static int get_bucket(modperl_filter_t *filter)
   {
  -if (!filter-bb) {
  +if (!filter-bb_in || MP_FILTER_EMPTY(filter)) {
  +MP_TRACE_f(MP_FUNC, %s

cvs commit: modperl-2.0/t/filter input_body.t

2003-01-14 Thread stas
stas2003/01/14 22:08:16

  Modified:t/filter input_body.t
  Log:
  no more need for XXX
  
  Revision  ChangesPath
  1.5   +0 -1  modperl-2.0/t/filter/input_body.t
  
  Index: input_body.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/input_body.t,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- input_body.t  20 Dec 2001 03:54:41 -  1.4
  +++ input_body.t  15 Jan 2003 06:08:16 -  1.5
  @@ -4,7 +4,6 @@
   use Apache::Test;
   use Apache::TestRequest;
   
  -#XXX: skip input_body filter test until filter changes dust settles
   plan tests = 2;
   
   my $location = '/TestFilter::input_body';
  
  
  



cvs commit: modperl-2.0/xs/Apache/Filter Apache__Filter.h

2003-01-14 Thread stas
stas2003/01/14 22:11:09

  Modified:xs/Apache/Filter Apache__Filter.h
  Log:
  input filters are now supported
  
  Revision  ChangesPath
  1.22  +21 -8 modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Apache__Filter.h  12 Jan 2003 02:33:27 -  1.21
  +++ Apache__Filter.h  15 Jan 2003 06:11:08 -  1.22
  @@ -26,7 +26,7 @@
   mpxs_write_loop(modperl_output_filter_write, modperl_filter);
   }
   else {
  -Perl_croak(aTHX_ input filters not yet supported);
  +mpxs_write_loop(modperl_input_filter_write, modperl_filter);
   }
   
   /* XXX: ap_rflush if $| */
  @@ -38,23 +38,36 @@
SV **MARK, SV **SP)
   {
   modperl_filter_t *modperl_filter;
  +ap_input_mode_t mode = 0;
  +apr_read_type_e block = 0;
  +apr_off_t readbytes = 0;
   apr_size_t wanted, len=0;
   SV *buffer;
  -
  -mpxs_usage_va_2(modperl_filter, buffer, $filter-read(buf, [len]));
  -
  -if (items  2) {
  +
  +if (items  4) {
  +mpxs_usage_va_2(modperl_filter, buffer, $filter-read(buf, [len]));
  +}
  +else {
  +modperl_filter = mp_xs_sv2_modperl_filter(*MARK); MARK++;
  +mode   = (ap_input_mode_t)SvIV(*MARK); MARK++;
  +block  = (apr_read_type_e)SvIV(*MARK); MARK++;
  +readbytes  = (apr_off_t)SvIV(*MARK); MARK++;
  +buffer = *MARK++;
  +}
  +
  +if (items == 3 || items == 6) {
   wanted = SvIV(*MARK);
   }
   else {
   wanted = MP_IOBUFSIZE;
   }
   
  -if (modperl_filter-mode == MP_OUTPUT_FILTER_MODE) {
  -len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted);
  +if (modperl_filter-mode == MP_INPUT_FILTER_MODE) {
  +len = modperl_input_filter_read(aTHX_ modperl_filter, mode,
  +block, readbytes, buffer, wanted);
   }
   else {
  -Perl_croak(aTHX_ input filters not yet supported);
  +len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted);
   }
   
   return len;
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter in_bbs_body.pm in_bbs_msg.pm out_bbs_basic.pm out_bbs_ctx.pm out_str_api.pm out_str_ctx.pm out_str_lc.pm out_str_reverse.pm in_str_msg.pm api.pm buckets.pm context.pm context_stream.pm input_body.pm input_msg.pm lc.pm reverse.pm

2003-01-14 Thread stas
/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:569
  # 11: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:569
  # 12: t/TEST:19
  
  use Apache::TestRequest 'GET_BODY';
  print GET_BODY /TestFilter::out_str_api;
  
  
  
  1.1  modperl-2.0/t/filter/out_str_ctx.t
  
  Index: out_str_ctx.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests = 1;
  
  my $blocks  = 33;
  my $invoked = 100;
  my $sig = join \n, received $blocks complete blocks,
  filter invoked $invoked times\n;
  my $data = # x $blocks . x x $blocks;
  my $expected = join \n, $data, $sig;
  
  {
  # test the filtering of the mod_perl response handler
  my $location = '/TestFilter::out_str_ctx';
  my $response = GET_BODY $location;
  ok t_cmp($expected, $response, context stream filter);
  }
  
  
  
  1.1  modperl-2.0/t/filter/out_str_lc.t
  
  Index: out_str_lc.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my $location = /top_dir/Makefile;
  
  my $str = GET_BODY $location;
  
  ok $str !~ /[A-Z]/;
  
  
  
  1.1  modperl-2.0/t/filter/out_str_reverse.t
  
  Index: out_str_reverse.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests = 2;
  
  my @data = (join('', 'a'..'z'), join('', 0..9));
  
  my $reversed_data = join '', map { scalar(reverse $_) . \n } @data;
  #t_debug($reversed_data);
  my $sig = Reversed by mod_perl 2.0\n;
  my $expected = join \n, @data, $sig;
  
  {
  # test the filtering of the mod_perl response handler
  my $location = '/TestFilter::out_str_reverse';
  my $response = POST_BODY $location, content = $reversed_data;
  ok t_cmp($expected, $response, reverse filter);
  }
  
  {
  # test the filtering of the non-mod_perl response handler (file)
  my $location = '/filter/reverse.txt';
  my $response = GET_BODY $location;
  $response =~ s/\r//g;
  ok t_cmp($expected, $response, reverse filter);
  }
  
  
  
  1.2   +2 -2  modperl-2.0/t/filter/TestFilter/in_str_msg.pm
  
  Index: in_str_msg.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_str_msg.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- in_str_msg.pm 15 Jan 2003 06:19:25 -  1.1
  +++ in_str_msg.pm 15 Jan 2003 06:47:15 -  1.2
  @@ -18,11 +18,11 @@
   
   sub handler : FilterConnectionHandler {
   my($filter, $bb, $mode, $block, $readbytes) = @_;
  -warn FILTER CALLED\n;
  +#warn FILTER CALLED\n;
   my $ctx = $filter-ctx;
   
   while ($filter-read($mode, $block, $readbytes, my $buffer, 1024)) {
  -warn FILTER READ: $buffer\n;
  +#warn FILTER READ: $buffer\n;
   unless ($ctx) {
   $buffer =~ s|GET $from_url|GET $to_url|;
   $ctx = 1; # done
  
  
  
  1.1  modperl-2.0/t/filter/TestFilter/in_bbs_body.pm
  
  Index: in_bbs_body.pm
  ===
  package TestFilter::in_bbs_body;
  
  use strict;
  use warnings FATAL = 'all';
  
  use base qw(Apache::Filter); #so we inherit MODIFY_CODE_ATTRIBUTES
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use APR::Brigade ();
  use APR::Bucket ();
  
  use Apache::Const -compile = qw(OK M_POST);
  use APR::Const -compile = ':common';
  
  sub handler : FilterRequestHandler {
  my($filter, $bb, $mode, $block, $readbytes) = @_;
  
  #warn Called!;
  my $ba = $filter-r-connection-bucket_alloc;
  
  my $ctx_bb = APR::Brigade-new($filter-r-pool, $ba);
  
  my $rv = $filter-next-get_brigade($ctx_bb, $mode, $block, $readbytes);
  
  if ($rv != APR::SUCCESS) {
  return $rv;
  }
  
  while (!$ctx_bb-empty) {
  my $data;
  my $bucket = $ctx_bb-first;
  
  $bucket-remove;
  
  if ($bucket-is_eos) {
  #warn EOS;
  $bb-insert_tail($bucket);
  last;
  }
  
  my $status = $bucket-read($data);
  #warn DATA bucket;
  if ($status != APR::SUCCESS) {
  return $status;
  }
  
  if ($data) {
  #warn[$data]\n;
  $bucket = APR::Bucket-new(scalar reverse $data);
  }
  
  $bb-insert_tail($bucket);
  }
  
  Apache::OK;
  }
  
  sub response {
  my $r = shift;
  
  $r-content_type('text/plain');
  
  if ($r-method_number == Apache::M_POST

cvs commit: modperl-2.0/t/response/TestError - New directory

2003-01-13 Thread stas
stas2003/01/13 22:41:49

  modperl-2.0/t/response/TestError - New directory



cvs commit: modperl-2.0/t/error - New directory

2003-01-13 Thread stas
stas2003/01/13 22:41:49

  modperl-2.0/t/error - New directory



cvs commit: modperl-2.0/t/response/TestError push_handlers.pm

2003-01-13 Thread stas
stas2003/01/13 22:42:44

  Modified:src/modules/perl modperl_callback.c
   .Changes
  Added:   t/error  push_handlers.t
   t/response/TestError push_handlers.pm
  Log:
  prevent a segfault when push_handlers are used to push a handler into
  the currently phase and switching the handler (perl-script/modperl) +
  tests
  
  Revision  ChangesPath
  1.52  +8 -4  modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- modperl_callback.c1 Jan 2003 03:45:54 -   1.51
  +++ modperl_callback.c14 Jan 2003 06:42:43 -  1.52
  @@ -93,7 +93,7 @@
   modperl_handler_t **handlers;
   apr_pool_t *p = NULL;
   MpAV *av, **avp;
  -int i, status = OK;
  +int i, nelts, status = OK;
   const char *desc = NULL;
   AV *av_args = Nullav;
   
  @@ -173,11 +173,15 @@
   };
   
   /* XXX: deal with {push,set}_handler of the phase we're currently in */
  -MP_TRACE_h(MP_FUNC, running %d %s handlers\n,
  -   av-nelts, desc);
  +/* for now avoid the segfault by not letting av-nelts grow if
  + * somebody push_handlers to the phase we are currently in, but
  + * different handler e.g. jumping from 'modperl' to 'perl-script',
  + * before calling push_handler */
  +nelts = av-nelts;
  +MP_TRACE_h(MP_FUNC, running %d %s handlers\n, nelts, desc);
   handlers = (modperl_handler_t **)av-elts;
   
  -for (i=0; iav-nelts; i++) {
  +for (i=0; inelts; i++) {
   if ((status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args)) != OK) 
{
   status = modperl_errsv(aTHX_ status, r, s);
   }
  
  
  
  1.100 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- Changes   12 Jan 2003 04:05:48 -  1.99
  +++ Changes   14 Jan 2003 06:42:44 -  1.100
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +prevent a segfault when push_handlers are used to push a handler into
  +the currently phase and switching the handler (perl-script/modperl)
  +[Stas]
  +
   Add $filter-seen_eos to the streaming filter api to know when eos has
   been seen, so special signatures can be passed and any data stored in
   the context flushed + tests. [Stas]
  
  
  
  1.1  modperl-2.0/t/error/push_handlers.t
  
  Index: push_handlers.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my $location = /TestError::push_handlers;
  my $expected = ok;
  my $received = GET_BODY $location;
  
  ok t_cmp($expected, $received);
  
  
  
  1.1  modperl-2.0/t/response/TestError/push_handlers.pm
  
  Index: push_handlers.pm
  ===
  package TestError::push_handlers;
  
  # This test verifies that we don't segfault when push_handlers are
  # used incorrectly. Here the handler() is running under 
  #   SetHandler modperl
  # and it modifies its handler to be 'perl-script', plus pushes another
  # handler to run. The result is that the first time handler() is run
  # under the 'modperl' handler it returns declined, therefore Apache
  # runs the registered 'perl-script' handler (which handler() has
  # pushed in plus itself. So the handler() is executed again, followed
  # by real_response(). Notice that it pushes yet another real_response
  # callback onto the list of handlers. 
  #
  # suprisingly the response eventually works, but this is a wrong way
  # to accomplish that thing. And one of the earlier stages should be
  # used to push handlers. 
  #
  # Don't modify the handler (modperl|perl-script) during the response
  # handler run-time, because if OK is not returned, the handler will be
  # executed again.
  
  
  use strict;
  use warnings;# FATAL = 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use Apache::RequestUtil ();
  
  use Apache::Const -compile = qw(OK DECLINED);
  
  sub handler {
  my $r = shift;
  
  #warn handler called\n;
  
  $r-handler(perl-script);
  $r-push_handlers(PerlResponseHandler = \real_response);
  
  return Apache::DECLINED;
  }
  
  sub real_response {
  my $r = shift;
  
  #warn real_response called\n;
  
  $r-content_type('text/plain');
  $r-print('ok');
  
  return Apache::OK;
  }
  
  1;
  __END__
  
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_filter.h mod_perl.c modperl_filter.c

2003-01-11 Thread stas
stas2003/01/11 18:15:59

  Modified:xs/tables/current/ModPerl FunctionTable.pm
   src/modules/perl modperl_filter.h mod_perl.c
modperl_filter.c
  Log:
  improve the code readability by s/filter_register/filter_add/g because the
  filters are actually inserted, not just registered
  
  Revision  ChangesPath
  1.91  +4 -4  modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- FunctionTable.pm  11 Jan 2003 00:02:16 -  1.90
  +++ FunctionTable.pm  12 Jan 2003 02:15:58 -  1.91
  @@ -2322,7 +2322,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_input_filter_register_connection',
  +'name' = 'modperl_input_filter_add_connection',
   'args' = [
 {
   'type' = 'conn_rec *',
  @@ -2332,7 +2332,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_input_filter_register_request',
  +'name' = 'modperl_input_filter_add_request',
   'args' = [
 {
   'type' = 'request_rec *',
  @@ -3177,7 +3177,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_output_filter_register_connection',
  +'name' = 'modperl_output_filter_add_connection',
   'args' = [
 {
   'type' = 'conn_rec *',
  @@ -3187,7 +3187,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_output_filter_register_request',
  +'name' = 'modperl_output_filter_add_request',
   'args' = [
 {
   'type' = 'request_rec *',
  
  
  
  1.15  +4 -4  modperl-2.0/src/modules/perl/modperl_filter.h
  
  Index: modperl_filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- modperl_filter.h  30 May 2002 02:33:48 -  1.14
  +++ modperl_filter.h  12 Jan 2003 02:15:58 -  1.15
  @@ -37,9 +37,9 @@
   apr_status_t modperl_output_filter_handler(ap_filter_t *f,
  apr_bucket_brigade *bb);
   
  -void modperl_output_filter_register_connection(conn_rec *c);
  +void modperl_output_filter_add_connection(conn_rec *c);
   
  -void modperl_output_filter_register_request(request_rec *r);
  +void modperl_output_filter_add_request(request_rec *r);
   
   MP_INLINE apr_status_t modperl_output_filter_flush(modperl_filter_t *filter);
   
  @@ -61,8 +61,8 @@
 apr_read_type_e block,
 apr_off_t readbytes);
   
  -void modperl_input_filter_register_connection(conn_rec *c);
  +void modperl_input_filter_add_connection(conn_rec *c);
   
  -void modperl_input_filter_register_request(request_rec *r);
  +void modperl_input_filter_add_request(request_rec *r);
   
   #endif /* MODPERL_FILTER_H */
  
  
  
  1.146 +4 -4  modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- mod_perl.c12 Dec 2002 10:05:07 -  1.145
  +++ mod_perl.c12 Jan 2003 02:15:58 -  1.146
  @@ -481,8 +481,8 @@
   
   static int modperl_hook_pre_connection(conn_rec *c, void *csd)
   {
  -modperl_input_filter_register_connection(c);
  -modperl_output_filter_register_connection(c);
  +modperl_input_filter_add_connection(c);
  +modperl_output_filter_add_connection(c);
   return OK;
   }
   
  @@ -595,10 +595,10 @@
   ap_hook_handler(modperl_response_handler_cgi,
   NULL, NULL, APR_HOOK_MIDDLE);
   
  -ap_hook_insert_filter(modperl_output_filter_register_request,
  +ap_hook_insert_filter(modperl_output_filter_add_request,
 NULL, NULL, APR_HOOK_LAST);
   
  -ap_hook_insert_filter(modperl_input_filter_register_request,
  +ap_hook_insert_filter(modperl_input_filter_add_request,
 NULL, NULL, APR_HOOK_LAST);
   
   ap_register_output_filter(MP_FILTER_REQUEST_OUTPUT_NAME,
  
  
  
  1.41  +38 -38modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- modperl_filter.c  25 Nov 2002 22:47:39 -  1.40
  +++ modperl_filter.c  12 Jan 2003 02:15:58 -  1.41
  @@ -443,11

cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-11 Thread stas
stas2003/01/11 18:33:28

  Modified:xs/Apache/Filter Apache__Filter.h
   xs/maps  modperl_functions.map
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  add $filter-seen_eos flag for the streaming interface
  
  Revision  ChangesPath
  1.21  +8 -0  modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Apache__Filter.h  12 Jan 2003 02:31:54 -  1.20
  +++ Apache__Filter.h  12 Jan 2003 02:33:27 -  1.21
  @@ -125,3 +125,11 @@
   
   return ctx-data ? SvREFCNT_inc(ctx-data) : PL_sv_undef;
   }
  +
  +static MP_INLINE SV *mpxs_Apache__Filter_seen_eos(pTHX_ I32 items,
  +  SV **MARK, SV **SP)
  +{
  +modperl_filter_t *modperl_filter;
  +mpxs_usage_va_1(modperl_filter, $filter-seen_eos());
  +return modperl_filter-seen_eos ? PL_sv_yes : PL_sv_no;
  +}
  
  
  
  1.48  +1 -0  modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- modperl_functions.map 12 Jan 2003 02:31:54 -  1.47
  +++ modperl_functions.map 12 Jan 2003 02:33:27 -  1.48
  @@ -74,6 +74,7 @@
   
mpxs_Apache__Filter_print | | ...
mpxs_Apache__Filter_read  | | ...
  + mpxs_Apache__Filter_seen_eos | | ...
mpxs_Apache__Filter_ctx   | | filter, data=Nullsv
   
SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv
  
  
  
  1.93  +26 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- FunctionTable.pm  12 Jan 2003 02:31:55 -  1.92
  +++ FunctionTable.pm  12 Jan 2003 02:33:28 -  1.93
  @@ -4892,6 +4892,32 @@
   ]
 },
 {
  +'return_type' = 'SV *',
  +'name' = 'mpxs_Apache__Filter_seen_eos',
  +'attr' = [
  +  'static',
  +  '__inline__'
  +],
  +'args' = [
  +  {
  +'type' = 'PerlInterpreter *',
  +'name' = 'my_perl'
  +  },
  +  {
  +'type' = 'I32',
  +'name' = 'items'
  +  },
  +  {
  +'type' = 'SV **',
  +'name' = 'mark'
  +  },
  +  {
  +'type' = 'SV **',
  +'name' = 'sp'
  +  }
  +]
  +  },
  +  {
   'return_type' = 'void',
   'name' = 'mpxs_Apache__Log_BOOT',
   'attr' = [
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter reverse.pm

2003-01-11 Thread stas
stas2003/01/11 18:37:11

  Modified:t/filter/TestFilter reverse.pm
  Log:
  send the signature only when eos has been seen (the filter can be invoked
  many times during the same request)
  
  Revision  ChangesPath
  1.5   +4 -1  modperl-2.0/t/filter/TestFilter/reverse.pm
  
  Index: reverse.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/reverse.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- reverse.pm25 Nov 2002 22:46:29 -  1.4
  +++ reverse.pm12 Jan 2003 02:37:11 -  1.5
  @@ -18,7 +18,10 @@
   $filter-print(\n);
   }
   }
  -$filter-print(Reversed by mod_perl 2.0\n);
  +
  +if ($filter-seen_eos) {
  +$filter-print(Reversed by mod_perl 2.0\n);
  +}
   
   return Apache::OK;
   }
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter buckets.pm

2003-01-11 Thread stas
stas2003/01/11 20:00:42

  Modified:t/filter/TestFilter buckets.pm
  Log:
  make sure that the body of the filter is executed only once
  
  Revision  ChangesPath
  1.8   +22 -17modperl-2.0/t/filter/TestFilter/buckets.pm
  
  Index: buckets.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/buckets.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- buckets.pm11 Sep 2002 00:50:31 -  1.7
  +++ buckets.pm12 Jan 2003 04:00:42 -  1.8
  @@ -19,31 +19,36 @@
   sub handler {
   my($filter, $bb) = @_;
   
  -Apache::TestToString-start;
  +unless ($filter-ctx) {
   
  -plan tests = 4;
  +Apache::TestToString-start;
   
  -my $ba = $filter-r-connection-bucket_alloc;
  +plan tests = 4;
   
  -#should only have 1 bucket from the response() below
  -for (my $bucket = $bb-first; $bucket; $bucket = $bb-next($bucket)) {
  -ok $bucket-type-name;
  -ok $bucket-length == 2;
  -$bucket-read(my $data);
  -ok $data eq 'ok';
  -}
  +my $ba = $filter-r-connection-bucket_alloc;
  +
  +#should only have 1 bucket from the response() below
  +for (my $bucket = $bb-first; $bucket; $bucket = $bb-next($bucket)) {
  +ok $bucket-type-name;
  +ok $bucket-length == 2;
  +$bucket-read(my $data);
  +ok (defined $data and $data eq 'ok');
  +}
   
  -my $tests = Apache::TestToString-finish;
  +my $tests = Apache::TestToString-finish;
   
  -my $brigade = APR::Brigade-new($filter-r-pool, $ba);
  -my $bucket = APR::Bucket-new($tests);
  +my $brigade = APR::Brigade-new($filter-r-pool, $ba);
  +my $bucket = APR::Bucket-new($tests);
   
  -$brigade-insert_tail($bucket);
  +$brigade-insert_tail($bucket);
   
  -my $ok = $brigade-first-type-name =~ /mod_perl/ ? 4 : 0;
  -$brigade-insert_tail(APR::Bucket-new(ok $ok\n));
  +my $ok = $brigade-first-type-name =~ /mod_perl/ ? 4 : 0;
  +$brigade-insert_tail(APR::Bucket-new(ok $ok\n));
   
  -$filter-next-pass_brigade($brigade);
  +$filter-next-pass_brigade($brigade);
  +
  +$filter-ctx(1); # flag that we have run this already
  +}
   
   Apache::OK;
   }
  
  
  



cvs commit: modperl-2.0/t/apache scanhdrs2.t

2003-01-10 Thread stas
stas2003/01/10 23:41:04

  Modified:t/apache scanhdrs2.t
  Log:
  t_cmp's args are (expected, received, comment)
  not (received, expected, comment)
  (the debug info was confusing otherwise)
  
  Revision  ChangesPath
  1.2   +3 -3  modperl-2.0/t/apache/scanhdrs2.t
  
  Index: scanhdrs2.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/apache/scanhdrs2.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- scanhdrs2.t   29 Jun 2002 20:39:22 -  1.1
  +++ scanhdrs2.t   11 Jan 2003 07:41:04 -  1.2
  @@ -14,10 +14,10 @@
   
   my $res = GET $location?$redirect, redirect_ok = 0;
   
  -ok t_cmp($res-header('Location'), $redirect,
  +ok t_cmp($redirect, $res-header('Location'),
Location header);
   
  -ok t_cmp($res-code, 302,
  +ok t_cmp(302, $res-code,
status == 302);
   
   $redirect = '/index.html';
  @@ -27,7 +27,7 @@
   ok t_cmp(1, !$res-header('Location'),
no Location header);
   
  -ok t_cmp($res-code, 200,
  +ok t_cmp(200, $res-code,
status == 200);
   
   ok t_cmp(qr{welcome to}, $res-content,
  
  
  



cvs commit: modperl-2.0 STATUS

2003-01-01 Thread dougm
dougm   2003/01/01 10:43:51

  Modified:.STATUS
  Log:
  must be fixed before 1.99_08
  
  Revision  ChangesPath
  1.28  +3 -5  modperl-2.0/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/modperl-2.0/STATUS,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- STATUS1 Jan 2003 03:45:54 -   1.27
  +++ STATUS1 Jan 2003 18:43:51 -   1.28
  @@ -24,11 +24,9 @@
   Release Showstoppers:
   -
   
  - * 
  -   Report: 
  -   Status: 
  -
  + * current cvs does not work with vanilla 5.6.1 or 5.8.0 (CGI.pm version issue)
   
  + * Makefile.PL process ugly unknown typemap warnings must go away
   
   Available Patches:
   --
  
  
  



cvs commit: modperl-2.0 Changes

2002-12-31 Thread stas
stas2002/12/31 19:48:20

  Modified:.Changes
  Log:
  log the recent change
  
  Revision  ChangesPath
  1.92  +2 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- Changes   1 Jan 2003 03:45:54 -   1.91
  +++ Changes   1 Jan 2003 03:48:20 -   1.92
  @@ -10,6 +10,8 @@
   
   =item 1.99_08-dev
   
  +Add PerlPreConnectionHandler support in Apache::Test [Stas]
  +
   Enable PerlPreConnectionHandler [Stas]
   
   Support the Host: request header in Apache::TestClient [Stas]
  
  
  



cvs commit: modperl-2.0 README

2002-12-31 Thread stas
stas2002/12/31 20:10:49

  Modified:.README
  Log:
  shape up the README file:
  - most important mention up to which Apache version the released version
  is expected to work with, to reduce a number of questions on the mod_perl
  list, when people try the latest Apache.
  - do require Perl 5.6.1, to avoid faulty bug reports
  - give credits to TicketMaster
  
  Revision  ChangesPath
  1.8   +30 -6 modperl-2.0/README
  
  Index: README
  ===
  RCS file: /home/cvs/modperl-2.0/README,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- README27 Jun 2002 06:36:03 -  1.7
  +++ README1 Jan 2003 04:10:49 -   1.8
  @@ -1,9 +1,21 @@
   This is mod_perl version 2.0-tobe
   
  -Apache version 2.0.39 or higher is required.
  +*** Prerequisites ***
   
  -Perl version 5.6.0 or higher is required. Perl-5.8.0-RC2 if you build
  -with 5.8.0 series.
  +Apache:
  +  this version of mod_perl works with Apache versions 2.0.39 -
  +  2.0.43. Older Apache versions aren't supported. Newer Apache version
  +  may not work with this version of mod_perl, but only with the cvs
  +  version which can be obtained from:
  +  http://perl.apache.org/download/source.html#2_0_Development_Source_Distribution
  +
  +Perl: 
  +  version 5.6.1 or higher is required. mod_perl builds with 5.6.0,
  +  but it's likely that you will have problems using it.
  +
  +  Perl version 5.8.0 is required for threaded MPMs.
  +
  +*** Status ***
   
   mod_perl is currently considered beta when used with the prefork MPM.
   
  @@ -12,13 +24,20 @@
   Only DSO build of mod_perl-2.0 is currently supported, static builds
   will be support in the future.
   
  -docs are available in /docs. Currently they don't get installed on
  -'make install'. Certain API documentation can be found in docs/api/.
  -the online version is at http://perl.apache.org/release/docs).
  +*** Documentation ***
  +
  +Documentation are available in /docs. Currently they don't get
  +installed on 'make install'. Certain API documentation can be found in
  +/docs/api/.  the online version is at
  +http://perl.apache.org/release/docs).
  +
  +*** Todo ***
   
   mod_perl-2.0-tobe is not 100% feature complete with the 1.xx version.
   See the todo/ directory for what remains to be done.
   
  +*** Support ***
  +
   For comments, questions, bug-reports, etc., join the mod_perl users
   list by sending mail to [EMAIL PROTECTED]
   
  @@ -28,8 +47,13 @@
   For announcements join the mod_perl announce list by sending mail to
   [EMAIL PROTECTED]
   
  +*** Developers ***
  +
   mod_perl-2.0 was designed and written by Doug MacEachern, with
   contributions from many others (see the CREDITS and Changes files).
   
   Doug's mod_perl-2.0 development time is sponsored by
   Covalent Technologies: http://www.covalent.net/
  +
  +Stas Bekman's mod_perl-2.0 development time is sponsored by
  +TicketMaster: http://www.ticketmaster.com/
  \ No newline at end of file
  
  
  



cvs commit: modperl-2.0/build xs_generate.pl

2002-12-29 Thread stas
stas2002/12/29 00:21:03

  Modified:buildxs_generate.pl
  Log:
  unshift Apache-Test/lib into @INC, so the locate Apache::Test will be
  searched for first
  
  Revision  ChangesPath
  1.2   +1 -1  modperl-2.0/build/xs_generate.pl
  
  Index: xs_generate.pl
  ===
  RCS file: /home/cvs/modperl-2.0/build/xs_generate.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- xs_generate.pl5 Mar 2001 03:55:08 -   1.1
  +++ xs_generate.pl29 Dec 2002 08:21:03 -  1.2
  @@ -1,4 +1,4 @@
  -use lib qw(lib);
  +use lib qw(lib Apache-Test/lib);
   
   use ModPerl::WrapXS ();
   
  
  
  



cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm RegistryLoader.pm

2002-12-29 Thread stas
stas2002/12/29 02:08:08

  Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm
RegistryLoader.pm
  Log:
  support the NameWithVirtualHost setting in namespace_from_uri() as in 1.0
  (would be nice to add a test, but I'm not sure how to do that)
  
  Revision  ChangesPath
  1.26  +12 -0 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
  
  Index: RegistryCooker.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- RegistryCooker.pm 28 Dec 2002 07:13:26 -  1.25
  +++ RegistryCooker.pm 29 Dec 2002 10:08:08 -  1.26
  @@ -85,6 +85,12 @@
   
   
   #
  +
  +unless (defined $ModPerl::RegistryCooker::NameWithVirtualHost) {
  +$ModPerl::RegistryCooker::NameWithVirtualHost = 1;
  +}
  +
  +#
   # func: new
   # dflt: new
   # args: $class - class to bless into
  @@ -310,6 +316,12 @@
   my $script_name = $path_info  $self-[URI] =~ /$path_info$/ ?
substr($self-[URI], 0, length($self-[URI]) - length($path_info)) :
$self-[URI];
  +
  +if ($ModPerl::RegistryCooker::NameWithVirtualHost  
  +$self-[REQ]-server-is_virtual) {
  +my $name = $self-[REQ]-get_server_name;
  +$script_name = join , $name, $script_name if $name;
  +}
   
   $script_name =~ s:/+$:/__INDEX__:;
   
  
  
  
  1.7   +5 -1  modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm
  
  Index: RegistryLoader.pm
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RegistryLoader.pm 29 Dec 2002 09:18:50 -  1.6
  +++ RegistryLoader.pm 29 Dec 2002 10:08:08 -  1.7
  @@ -21,7 +21,7 @@
   }
   
   sub handler {
  -my($self, $uri, $filename) = @_;
  +my($self, $uri, $filename, $virthost) = @_;
   
   # set the inheritance rules at run time
   @ISA = $self-{package};
  @@ -73,6 +73,8 @@
   package  = $self-{package},
   } = ref($self) || $self;
   
  +$rl-{virthost} = $virthost if defined $virthost;
  +
   # can't call SUPER::handler here, because it usually calls new()
   # and then the ModPerlRegistryLoader::new() will get called,
   # instead of the super class' new, so we implement the super
  @@ -86,6 +88,7 @@
   # when when finfo() and slurp_filename() are ported to 2.0 and
   # RegistryCooker is starting to use them
   
  +sub get_server_name { return $_[0]-{virthost} if exists $_[0]-{virthost} }
   sub filename { shift-{filename} }
   sub status { Apache::HTTP_OK }
   sub my_finfo{ shift-{filename} }
  @@ -95,6 +98,7 @@
   sub log_error { shift; die @_ if $@; warn @_; }
   sub run { return Apache::OK } # don't run the script
   sub server { shift }
  +sub is_virtual { exists shift-{virthost} }
   
   # the preloaded file needs to be precompiled into the package
   # specified by the 'package' attribute, not RegistryLoader
  
  
  



cvs commit: modperl-2.0 Changes

2002-12-29 Thread stas
stas2002/12/29 02:11:49

  Modified:ModPerl-Registry TODO
   .Changes
  Log:
  document recent changes
  
  Revision  ChangesPath
  1.11  +0 -2  modperl-2.0/ModPerl-Registry/TODO
  
  Index: TODO
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/TODO,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TODO  26 Nov 2002 07:47:26 -  1.10
  +++ TODO  29 Dec 2002 10:11:49 -  1.11
  @@ -25,8 +25,6 @@
   
   - $Apache::Server::CWD doesn't exist
   
  -- NameWithVirtualHost is not handled
  -
   - need to figure out what's happening with
 ModPerl::Registry::MarkLine, why it's not on by default?
   
  
  
  
  1.89  +9 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- Changes   21 Dec 2002 03:46:07 -  1.88
  +++ Changes   29 Dec 2002 10:11:49 -  1.89
  @@ -10,6 +10,15 @@
   
   =item 1.99_08-dev
   
  +restore the ModPerl::RegistryLoader::new() method for backwards
  +compatibility  [Stas]
  +
  +port the support for NameWithVirtualHost in ModPerl::RegistryCooker
  +and ModPerl::RegistryLoader [Stas]
  +
  +fix the handling of the return status in ModPerl::RegistryCooker, add
  +a test to verify that [Stas]
  +
   under non-threaded perl need to check whether mod_perl is running,
   when modperl_vhost_is_running check is done. [Stas]
   
  
  
  



  1   2   3   4   5   6   7   8   9   10   >