URLs with path_info component cause segment violation in ModPerl::Registry and ModPerl::PerlRun

2004-08-08 Thread Stephan Wacker
Greetings,

I already searched Google and the list archives but could not find 
any explanation for my problem; therefore...


My website uses the PATH_INFO feature of CGI URLs, i.e. the URLs 
look like
http://my.server/some/path/cgi/my_script.pl/context/info
and /context/info should be visible in $query-path_info() 
[[where $query is a CGI object]]. This works fine with Apache and 
Perl.


After installing and configuring mod_perl, all requests of my Perl 
scripts caused a segment violation in the Apache handler. I was 
then able to reproduce the problem with only a copy of 
cgi-bin/printenv in perl/printenv.pl [[any other Perl CGI script 
would do]].

The software versions are 
Apache/2.0.50 (Gentoo/Linux)
mod_perl/1.99_11
Perl/v5.8.4

[[This info is taken from the output of printenv.pl without a 
path_info component - just to prove that the script is found and 
would normally work. When accessed via a ScriptAlias and an 
external Perl process, an optional path_info string shows up in 
the PATH_INFO environment variable.]]


This is the configuration section using ModPerl::Registry or 
ModPerl::PerlRun for different Locations. The LocationMatch will 
match URLs with or without path info.

8888888888
IfModule mod_alias.c
# [...]
IfModule mod_perl.c
#Provide two aliases to the same cgi-bin directory,
#to see the effects of the 2 different mod_perl modes
#for Apache::Registry Mode
Alias /perl/ /var/www/localhost/perl/
#for Apache::Perlrun Mode
Alias /cgi-perl/ /var/www/localhost/perl/
/IfModule
/IfModule

IfModule mod_perl.c
#set Apache::Registry Mode for /perl Alias
LocationMatch ^/perl/.*\.pl
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options -Indexes ExecCGI
PerlSendHeader On
/LocationMatch

#set Apache::PerlRun Mode for /cgi-perl Alias
LocationMatch ^/cgi-perl/.*\.pl
SetHandler perl-script
PerlResponseHandler ModPerl::PerlRun
PerlOptions +ParseHeaders
Options -Indexes ExecCGI
PerlSendHeader On
/LocationMatch
/IfModule
8888888888



This is what I got from a debugger session when I requested the 
URL http://localhost/perl/printenv.pl/xyz

8888888888
dwalin tmp # gdb /usr/sbin/apache2
GNU gdb 6.0
[...]
This GDB was configured as i686-pc-linux-gnu...Using host 
libthread_db library /lib/libthread_db.so.1.

(gdb) run -DONE_PROCESS -DNO_DETACH -D PHP4 -D PERL 
-f /etc/apache2/conf/my_master.conf
Starting program: /usr/sbin/apache2 -DONE_PROCESS -DNO_DETACH -D 
PHP4 -D PERL -f /etc/apache2/conf/my_master.conf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Detaching after fork from child process 30713.
Detaching [...].

Program received signal SIGSEGV, Segmentation fault.
apr_thread_mutex_lock (mutex=0xe4e1c0) at thread_mutex.c:71
71  thread_mutex.c: No such file or directory.
in thread_mutex.c
(gdb) where
#0  apr_thread_mutex_lock (mutex=0xe4e1c0) at thread_mutex.c:71
#1  0x40192d8c in apr_file_read (thefile=0x819a1e0, buf=0x80d6a68,
nbytes=0xb028) at readwrite.c:47
#2  0x40457593 in ?? ()
#3  0x0819a1e0 in ?? ()
#4  0x080d6a68 in ?? ()
#5  0xb028 in ?? ()
#6  0x080dead8 in ?? ()
#7  0xb078 in ?? ()
#8  0x0819a1e0 in ?? ()
#9  0x010c in ?? ()
#10 0x405b2363 in ?? ()
#11 0x08232db0 in ?? ()
#12 0x405b3cf0 in ?? ()
#13 0xb078 in ?? ()
#14 0x405b1a85 in ?? ()
#15 0x08302d50 in ?? ()
(gdb) p *mutex
Cannot access memory at address 0xe4e1c0
(gdb) up
#1  0x40192d8c in apr_file_read (thefile=0x819a1e0, buf=0x80d6a68,
nbytes=0xb028) at readwrite.c:47
47  readwrite.c: No such file or directory.
in readwrite.c
(gdb) p *thefile
$1 = {pool = 0x80a0168, filedes = 0,
  fname = 0x81751f8 /usr/lib/apache2/conf/my_local.conf, 
flags = 15,
  eof_hit = 135897424, is_pipe = 135899352, 
timeout = 583688357628870656,
  buffered = 135054568, blocking = 4, ungetchar = 1,
  buffer = 0x819a2a0 ð×\031\b, bufpos = 135911552, 
dataRead = 135898776,
  direction = 3, filePtr = 0, thlock = 0xe4e1c0}
(gdb)
8888888888


Although I had all programs (Perl, Apache, mod_perl) compiled with 
debug information, debug info was only available for the last two 
stack frames. :-(

To me this looks like a recycled thefile object that had once 
been used to read my base config file [[my_local.conf includes 
the distribution's apache2.conf and commonapache2.conf files plus 
additional files for my website]]. But most of the other entries 
are garbage, causing the segment violation when thefile-thlock 
is dereferenced in apr_thread_mutex_lock().

Another interesting detail: When I start another 

Re: URLs with path_info component cause segment violation in ModPerl::Registry and ModPerl::PerlRun

2004-08-08 Thread Stas Bekman
Stephan Wacker wrote:
Greetings,
I already searched Google and the list archives but could not find 
any explanation for my problem; therefore...

My website uses the PATH_INFO feature of CGI URLs, i.e. the URLs 
look like
	http://my.server/some/path/cgi/my_script.pl/context/info
and /context/info should be visible in $query-path_info() 
[[where $query is a CGI object]]. This works fine with Apache and 
Perl.

After installing and configuring mod_perl, all requests of my Perl 
scripts caused a segment violation in the Apache handler. I was 
then able to reproduce the problem with only a copy of 
cgi-bin/printenv in perl/printenv.pl [[any other Perl CGI script 
would do]].

The software versions are 
	Apache/2.0.50 (Gentoo/Linux)
	mod_perl/1.99_11
	Perl/v5.8.4
Stephan, please install the latest mod_perl version which is 1.99_14. If 
the problem persists, please submit a complete bug report as explained 
here: http://perl.apache.org/bugs/. Thank you.

--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] $r-method and $r-method_number set methods deprecated?

2004-08-08 Thread Fred Moyer
 Thanks for the spot Fred.

 The issue was is that we had almost all accessors settable, as I worked
through those I've made of them read-only, which wasn't always right.
Please try the current cvs or the patch below [1].

Current cvs did the trick, thanks.

 Now if you could go through the mp2 accessors and check if I've missed
some other (and which should be read/write), that would be a lot of help.
It's probably the easiest if you use the pod manpages from here:
http://perl.apache.org/download/docs.html

 The mp1 methods are documented here:
 modperl-docs/src/docs/1.0/api/Apache.pod

 The corresponding mp2 methods will be here:
 modperl-docs/src/docs/2.0/api/Apache/*

Sure I can do that no problem.  Will probably add tests to the TestAPI
packages to determine if any other read/write accessors missing unless
there is a more efficient way that I'm not seeing here.


 Thanks.

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: [mp2] $r-method and $r-method_number set methods deprecated?

2004-08-08 Thread Stas Bekman
Fred Moyer wrote:
Thanks for the spot Fred.
The issue was is that we had almost all accessors settable, as I worked
through those I've made of them read-only, which wasn't always right.
Please try the current cvs or the patch below [1].
Current cvs did the trick, thanks.
:)
Now if you could go through the mp2 accessors and check if I've missed
some other (and which should be read/write), that would be a lot of help.
It's probably the easiest if you use the pod manpages from here:
http://perl.apache.org/download/docs.html
The mp1 methods are documented here:
modperl-docs/src/docs/1.0/api/Apache.pod
The corresponding mp2 methods will be here:
modperl-docs/src/docs/2.0/api/Apache/*

Sure I can do that no problem.  Will probably add tests to the TestAPI
packages to determine if any other read/write accessors missing unless
there is a more efficient way that I'm not seeing here.
No, Fred, we don't want just any accessors to be settable, only those 
that make sense and those that were settable in mp1, if things haven't 
changed in Apache2.

More tests is always good, but if looking at the manpages:
modperl-docs/src/docs/2.0/api/Apache/*
is not good, for a few structures accessors you can check:
  modperl-2.0/xs/maps/apache_structures
accessors starting with  are read-only.
for the complete mapping legend see %ModPerl::MapUtil::disabled_map in
modperl-2.0/lib/ModPerl/MapUtil.pm
Thanks.
--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Multiple Aliases in Perl Section name virtual hosts

2004-08-08 Thread Philippe M. Chiasson
Kim Goldov wrote:
I'm using a Perl section to configure name virtual hosts. I would like to have 
multiple aliases defined in each virtual host, however I was only able to define a single 
alias in the virtual host.
[...]
This issue has been found and fixed. Thank you for reporting this 
problem Kim.

You can either wait for the next release, try mod_perl 2.0 from cvs or 
manually apply this patch :

http://marc.theaimsgroup.com/?l=apache-modperl-cvsm=109201063327941w=2
Gozer out.


signature.asc
Description: OpenPGP digital signature


[mp2 milestones] installment 2

2004-08-08 Thread Stas Bekman
Hi,
As we have mentioned several times on this list mod_perl 2.0 will be
released when a selected API will be reviewed, tested and documented
and the release todo file
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/todo/release gets
emptied.
This is the second installment of getting to the final goal of
releasing 2.0 and it requires your attention.
   
Here are the second 15 modules set, that have their API more or less
frozen, tested and documented. Make sure you read the man pages
thoroughly, since once 2.0.0 is released we will not be able to change
the existing API in the following 2.0.x releases, if the changes break
backwards compatibility with 2.0.0 release. At the moment we can still
change things, therefore please make sure that you review the
following man pages:
http://perl.apache.org/docs/2.0/api/Apache/Access.html
http://perl.apache.org/docs/2.0/api/Apache/Filter.html
http://perl.apache.org/docs/2.0/api/Apache/FilterRec.html
http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html
http://perl.apache.org/docs/2.0/api/Apache/Process.html
http://perl.apache.org/docs/2.0/api/Apache/Reload.html
http://perl.apache.org/docs/2.0/api/Apache/RequestIO.html
http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html
http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html
http://perl.apache.org/docs/2.0/api/Apache/Response.html
http://perl.apache.org/docs/2.0/api/Apache/ServerRec.html
http://perl.apache.org/docs/2.0/api/Apache/ServerUtil.html
http://perl.apache.org/docs/2.0/api/Apache/SubProcess.html
http://perl.apache.org/docs/2.0/api/ModPerl/Global.html
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html
These 15 modules include 208 functions and methods.
Quite a few methods have changed since 1.99_14 release. You will need
to use the current mod_perl cvs
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
in order to match the documentation if you try to code or port
things. You can refer to the Changes file to see what has changed
since the last release:
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/Changes
If you want to discuss a certain module or a function, please don't
reply to this email but start a separate thread using a relevant
subject name. For example:
  [mp2] Apache::Access::requires issues
Contributions in the form of patches to the code, tests and
documentations are more than welcome. Here is how you can contribute:
If you wish to send documentation fixes and improvements please use
the modperl-docs repository as explained here:
http://perl.apache.org/download/docs.html
http://perl.apache.org/contribute/cvs_howto.html#Sending_Patches
If you wish to help us and write more tests, please send patches
against the current mod_perl cvs:
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
Thank you.
   
If you've missed the first installment posted on May 27th, here is the
first 15 modules set:
http://perl.apache.org/docs/2.0/api/APR/Base64.html
http://perl.apache.org/docs/2.0/api/APR/Brigade.html
http://perl.apache.org/docs/2.0/api/APR/Bucket.html
http://perl.apache.org/docs/2.0/api/APR/BucketAlloc.html
http://perl.apache.org/docs/2.0/api/APR/BucketType.html
http://perl.apache.org/docs/2.0/api/APR/Date.html
http://perl.apache.org/docs/2.0/api/APR/Error.html
http://perl.apache.org/docs/2.0/api/APR/IpSubnet.html
http://perl.apache.org/docs/2.0/api/APR/Pool.html
http://perl.apache.org/docs/2.0/api/APR/SockAddr.html
http://perl.apache.org/docs/2.0/api/APR/Socket.html
http://perl.apache.org/docs/2.0/api/APR/Table.html
http://perl.apache.org/docs/2.0/api/APR/ThreadMutex.html
http://perl.apache.org/docs/2.0/api/APR/URI.html
http://perl.apache.org/docs/2.0/api/APR/Util.html
These 15 modules include 101 functions and methods.
   
The 3rd installment will include the last 15 api modules, which include 
the remaining 149 functions and methods.

   
So at the moment we plan to ship mod_perl 2.0 with an API of about 450 
functions and methods, all tested and documented.

--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: make test hangs

2004-08-08 Thread Stas Bekman
William, please followup on all the emails. I don't think I've seen your 
followup to this post:
http://marc.theaimsgroup.com/?l=apache-modperlm=108382020514594w=2
Did I miss it?

William Fulmer wrote:
The first test it hangs on is t/api/request_rec.  The line of code it
stops on is pretty uncomplicated:
my $mtime = (stat __FILE__)[9]; #line 124
adding the -T under perl doesn't change a thing.  I'm not quite sure
where to remove it for modperl so I haven't tried that.  '
remove -T from here
t/conf/extra.conf.in:PerlSwitches -wT
and now run it:
t/TEST -conf
t/TEST -v t/api/request_rec.t
I just realized that the bug report I sent was from the compile the
build without large file support in perl.  

I did recompile apache with large file support sort of.  There's no
configure option to enable it so I added -D_LARGEFILE_SOURCE in the
ccflags.  httpd still doesn't advertise that is supports large files. 
The other thing I notice is that modperl doesn't respect perl's ccflags
(as advertised by perl -V).  It drops the -D_LARGEFILE_SOURCE.  I forced
it in using MP_CCOPTS, but it didn't help.
it's not enough, you need -D_FILE_OFFSET_BITS=64 as well, but I think it 
still not enough.

Let me just clarify things a bit regarding what does and does not work
for make test.
my perl 5.8.2 install with LFS works fine with modperl.  compiles, test
and runs sucessfully.
perl 5.6.2  with LFS hangs in make test.
perl 5.6.2 without LFS finishes make test with errors.
The bug report that I sent earlier was from the  perl 5.6.2 without LFS.
This one is from perl 5.6.2 with LFS.  The apache doesn't advertise LFS
but it was compiled with -D_LARGEFILE_SOURCE:
Because it's more than that. If Apache doesn't enable it, neither you 
should try to do that. Instead mod_perl should be compiled with a common 
denominator, i.e. w/o LFS. which it tries to do already.

Anything else I should try? Any other useful info I should provide?
See the top of the email.
And of course the most important question,  is this a fight worth
fighting?  I expect most people are using MP2 with perl 5.8.x.  I
unfortunately have some legacy perl modules with binary components that
have no src (should say the vendor won't release the src ;) ) that will
only work with 5.6.x.  I'm happy to persue this, but I don't want to
waste too much of your time with this unless you see a benefit to the
community.  
It'd be nice to figure out what the problem is. We need to find some 
HPUX expert that can help you accomplish that.

If you can followup on the email mentioned above, I think we may find 
some leads.

--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] NetBSD-1.6.2 modperl snapshot build error

2004-08-08 Thread MGorbunov
  [Fri Aug 06 15:41:40 2004] [error] APR::Socket::recv: (35) Resource 
  temporarily unavailable at 
  
/usr/home/mgorb/mp-test/modperl-2.0/t/protocol/TestProtocol/echo_block.pm 
  line 34
  Out of memory!
  Callback called exit.
  Callback called exit.
 
 Hmm, out of memory? Do you have issues with RAM? Are you heavily 
swapping?
 
k714% top

load averages:  0.21,  0.20,  0.17 09:11:19
30 processes:  29 sleeping, 1 on processor
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% 
idle
Memory: 27M Act, 4K Inact, 1760K Wired, 7480K Exec, 13M File, 412M Free
Swap: 500M Total, 500M Free

k714% sudo /sbin/swapctl -l

Device  512-blocks UsedAvail Capacity  Priority
/dev/wd0b  10241280  1024128 0%0

k714%

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: [mp2] NetBSD-1.6.2 modperl snapshot build error

2004-08-08 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
[Fri Aug 06 15:41:40 2004] [error] APR::Socket::recv: (35) Resource 
temporarily unavailable at 

/usr/home/mgorb/mp-test/modperl-2.0/t/protocol/TestProtocol/echo_block.pm 

line 34
Out of memory!
Callback called exit.
Callback called exit.
Hmm, out of memory? Do you have issues with RAM? Are you heavily 
swapping?
k714% top
load averages:  0.21,  0.20,  0.17 09:11:19
30 processes:  29 sleeping, 1 on processor
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% 
idle
Memory: 27M Act, 4K Inact, 1760K Wired, 7480K Exec, 13M File, 412M Free
Swap: 500M Total, 500M Free

k714% sudo /sbin/swapctl -l
Device  512-blocks UsedAvail Capacity  Priority
/dev/wd0b  10241280  1024128 0%0
I mean when you run this test and get this error. Not at other times. 
Use some visual top tool, like gkrellm (not sure if it works on your OS).

--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


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

2004-08-08 Thread stas
stas2004/08/08 10:56:53

  Added:   t/hooks  authen_digest.t
   t/hooks/TestHooks authen_digest.pm
  Log:
  digest auth test
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/hooks/authen_digest.t
  
  Index: authen_digest.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  
  plan tests = 4, need need_lwp, need_auth, need_module('Digest::MD5');
  
  my $location = /TestHooks__authen_digest;
  
  sok {
  ! GET_OK $location;
  };
  
  sok {
  my $rc = GET_RC $location;
  $rc == 401;
  };
  
  sok {
  GET_OK $location, username = 'Joe', password = 'Smith';
  };
  
  sok {
  ! GET_OK $location, username = 'Joe', password = 'SMITH';
  };
  
  
  
  
  1.1  modperl-2.0/t/hooks/TestHooks/authen_digest.pm
  
  Index: authen_digest.pm
  ===
  package TestHooks::authen_digest;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Access ();
  use Apache::RequestRec ();
  use APR::Table ();
  
  use Digest::MD5 ();
  
  use Apache::Const -compile = qw(OK HTTP_UNAUTHORIZED);
  
  # a simple database
  my %passwd = (Joe = Smith);
  
  sub handler {
  my $r = shift;
  
  my($rc, $res) = get_digest_auth_data($r);
  return $rc if $rc != Apache::OK;
  
  my $passwd = $passwd{ $res-{username} } || '';
  my $digest = calc_digest($res, $passwd, $r-method);
  
  unless ($digest eq $res-{response}) {
  $r-note_digest_auth_failure;
  return Apache::HTTP_UNAUTHORIZED;
  }
  
  return Apache::OK;
  }
  
  sub get_digest_auth_data {
  my($r) = @_;
  
  # adopted from the modperl cookbook example
  
  my $auth_header = $r-headers_in-get('Authorization') || '';
  unless ($auth_header =~ m/^Digest/) {
  $r-note_digest_auth_failure;
  return Apache::HTTP_UNAUTHORIZED;
  }
  
  # Parse the response header into a hash.
  $auth_header =~ s/^Digest\s+//;
  $auth_header =~ s///g;
  
  my %res = map { split /=/, $_ } split /,\s*/, $auth_header;
  
  # Make sure that the response contained all the right info.
  for my $key (qw(username realm nonce uri response)) {
  next if $res{$key};
  $r-note_digest_auth_failure;
  return Apache::HTTP_UNAUTHORIZED;
  }
  
  return (Apache::OK, \%res);
  }
  
  sub calc_digest {
  my($res, $passwd, $method) = @_;
  
  # adopted from LWP/Authen/Digest.pm
  
  my $md5 = Digest::MD5-new;
  
  my(@digest);
  $md5-add(join :, $res-{username}, $res-{realm}, $passwd);
  push @digest, $md5-hexdigest;
  $md5-reset;
  
  push @digest, $res-{nonce};
  
  $md5-add(join :, $method, $res-{uri});
  push @digest, $md5-hexdigest;
  $md5-reset;
  
  $md5-add(join :, @digest);
  my $digest = $md5-hexdigest;
  $md5-reset;
  
  return $digest;
  }
  
  1;
  __DATA__
  NoAutoConfig
  Location /TestHooks__authen_digest
  require valid-user
  AuthType Digest
  AuthName Simple Digest
  PerlAuthenHandler TestHooks::authen_digest
  PerlResponseHandler Apache::TestHandler::ok1
  SetHandler modperl
  /Location
  /NoAutoConfig
  
  
  


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

2004-08-08 Thread stas
stas2004/08/08 10:57:57

  Added:   t/hooks  authen_basic.t
   t/hooks/TestHooks authen_basic.pm
  Removed: t/hooks  authen.t
   t/hooks/TestHooks authen.pm
  Log:
  s/authen/authen_basic/ as now we have authen_digest as well
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/hooks/authen_basic.t
  
  Index: authen_basic.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  
  plan tests = 4, need need_lwp, need_auth;
  
  my $location = /TestHooks__authen_basic;
  
  sok {
  ! GET_OK $location;
  };
  
  sok {
  my $rc = GET_RC $location;
  $rc == 401;
  };
  
  sok {
  GET_OK $location, username = 'dougm', password = 'foo';
  };
  
  sok {
  ! GET_OK $location, username = 'dougm', password = 'wrong';
  };
  
  
  
  
  
  
  1.1  modperl-2.0/t/hooks/TestHooks/authen_basic.pm
  
  Index: authen_basic.pm
  ===
  package TestHooks::authen_basic;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Access ();
  
  use Apache::Const -compile = qw(OK HTTP_UNAUTHORIZED SERVER_ERROR);
  
  sub handler {
  my $r = shift;
  
  my($rc, $sent_pw) = $r-get_basic_auth_pw;
  
  return $rc if $rc != Apache::OK;
  
  my $user = $r-user;
  
  my $requirement = $r-requires-[0]-{requirement};
  
  return Apache::SERVER_ERROR unless $requirement eq 'valid-user';
  
  unless ($user eq 'dougm' and $sent_pw eq 'foo') {
  $r-note_basic_auth_failure;
  return Apache::HTTP_UNAUTHORIZED;
  }
  
  Apache::OK;
  }
  
  1;
  __DATA__
  NoAutoConfig
  Location /TestHooks__authen_basic
  require valid-user
  AuthType Basic
  AuthName simple
  PerlAuthenHandler TestHooks::authen_basic
  PerlResponseHandler Apache::TestHandler::ok1
  SetHandler modperl
  /Location
  /NoAutoConfig
  
  
  


cvs commit: modperl-2.0 Changes

2004-08-08 Thread stas
stas2004/08/08 11:05:22

  Modified:.Changes
  Log:
  unchange method/method_number
  
  Revision  ChangesPath
  1.429 +3 -4  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.428
  retrieving revision 1.429
  diff -u -u -r1.428 -r1.429
  --- Changes   7 Aug 2004 02:52:07 -   1.428
  +++ Changes   8 Aug 2004 18:05:22 -   1.429
  @@ -25,10 +25,9 @@
   Apache::RequestRec methods changes [Stas]
   - readwrite = readonly:
   
  -method_number, connection, canonical_filename, header_only, main,
  -method, next, prev, pool, per_dir_config, request_config,
  -proto_num, protocol, request_time, server, the_request,
  -unparsed_uri
  +connection, canonical_filename, header_only, main, next, prev,
  +pool, per_dir_config, request_config, proto_num, protocol,
  +request_time, server, the_request, unparsed_uri
   
   - removed:
   
  
  
  


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

2004-08-08 Thread stas
stas2004/08/08 12:06:31

  Modified:t/hooks/TestHooks authz.pm
  Log:
  test: $r-note_auth_failure;
  
  Revision  ChangesPath
  1.5   +3 -1  modperl-2.0/t/hooks/TestHooks/authz.pm
  
  Index: authz.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/authz.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- authz.pm  18 Jun 2003 08:59:04 -  1.4
  +++ authz.pm  8 Aug 2004 19:06:31 -   1.5
  @@ -14,7 +14,9 @@
   return $res if $res != Apache::OK;
   
   unless($r-user and $sent_pw) {
  - $r-note_basic_auth_failure;
  +# testing $r-note_auth_failure:
  +# AuthType Basic + note_auth_failure == note_basic_auth_failure;
  + $r-note_auth_failure;
return Apache::HTTP_UNAUTHORIZED;
   }
   
  
  
  


cvs commit: modperl-2.0/t/response/TestAPI access2.pm

2004-08-08 Thread stas
stas2004/08/08 14:30:07

  Added:   t/apiaccess2.t
   t/response/TestAPI access2.pm
  Log:
  extensive $r-requires tests
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/api/access2.t
  
  Index: access2.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 6, need need_lwp, need_auth;
  
  my $location = /TestAPI__access2;
  
  ok !GET_OK $location;
  
  my $rc = GET_RC $location;
  ok t_cmp $rc, 401, no credentials passed;
  
  # bad user
  ok !GET_OK $location, username = 'root', password = '1234';
  
  # good user/bad pass
  ok !GET_OK $location, username = 'goo', password = 'foo';
  
  # good user/good pass
  ok GET_OK $location, username = 'goo', password = 'goopass';
  
  # any user/any pass POST works
  ok POST_OK $location, username = 'bar', password = 'goopass1',
  content = a;
  
  
  
  
  
  1.1  modperl-2.0/t/response/TestAPI/access2.pm
  
  Index: access2.pm
  ===
  package TestAPI::access2;
  
  # testing $r-requires
  # in the POST test it returns:
  #
  #  [
  #{
  #  'method_mask' = -1,
  #  'requirement' = 'user goo bar'
  #},
  #{
  #  'method_mask' = -1,
  #  'requirement' = 'group bar tar'
  #}
  #{
  #  'method_mask' = 4,
  #  'requirement' = 'valid-user'
  #}
  #  ];
  #
  # otherwise it returns the same, sans the 'valid-user' entry
  #
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Access ();
  
  use Apache::TestTrace;
  
  use Apache::Const -compile = qw(OK HTTP_UNAUTHORIZED SERVER_ERROR
   M_POST);
  
  my $users  = goo bar;
  my $groups = bar tar;
  my %users = (
  goo = goopass,
  bar = barpass,
  );
  
  sub handler {
  my $r = shift;
  
  my($rc, $sent_pw) = $r-get_basic_auth_pw;
  return $rc if $rc != Apache::OK;
  
  # extract just the requirement entries
  my %require = 
  map { my($k, $v) = split /\s+/, $_-{requirement}, 2; ($k, $v||'') }
  @{ $r-requires };
  debug \%require;
  
  # silly (we don't check user/pass here), just checking when
  # the Limit options are getting through
  if ($r-method_number == Apache::M_POST) {
  if (exists $require{valid-user}) {
  return Apache::OK;
  }
  else {
  return Apache::SERVER_ERROR;
  }
  }
  else {
  # non-POST requests shouldn't see the Limit enclosed entry
  return Apache::SERVER_ERROR if exists $require{valid-user};
  }
  
  return Apache::SERVER_ERROR unless $require{user}  eq $users;
  return Apache::SERVER_ERROR unless $require{group} eq $groups;
  
  my $user = $r-user;
  my $pass = $users{$user} || '';
  unless (defined $pass and $sent_pw eq $pass) {
  $r-note_basic_auth_failure;
  return Apache::HTTP_UNAUTHORIZED;
  }
  
  Apache::OK;
  }
  
  1;
  __DATA__
  NoAutoConfig
  Location /TestAPI__access2
  PerlAuthenHandler TestAPI::access2
  PerlResponseHandler Apache::TestHandler::ok1
  SetHandler modperl
  
  AuthType Basic
  AuthName Access
  Require user goo bar
  Require group bar tar
  Limit POST
 Require valid-user
  /Limit
  
  # htpasswd -mbc auth-users goo foo
  # htpasswd -mb auth-users bar mar
  # using md5 password so it'll work on win32 too
  AuthUserFile @DocumentRoot@/api/auth-users
  # group: user1 user2 ...
  AuthGroupFile @DocumentRoot@/api/auth-groups
  /Location
  /NoAutoConfig
  
  
  


cvs commit: modperl-2.0/t/response/TestAPI request_rec.pm

2004-08-08 Thread stas
stas2004/08/08 14:32:01

  Modified:t/response/TestAPI request_rec.pm
  Log:
  fix method name
  
  Revision  ChangesPath
  1.30  +1 -1  modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- request_rec.pm2 Aug 2004 05:36:34 -   1.29
  +++ request_rec.pm8 Aug 2004 21:32:00 -   1.30
  @@ -176,7 +176,7 @@
   # - request_config
   # - content_languages
   # - allowed_xmethods
  -# - allow_methods
  +# - allowed_methods
   
   Apache::OK;
   }
  
  
  


cvs commit: modperl-2.0/t/response/TestAPI access2.pm

2004-08-08 Thread stas
stas2004/08/08 14:34:18

  Modified:t/response/TestAPI access2.pm
  Log:
  missing use Apache::RequestRec ();
  
  Revision  ChangesPath
  1.2   +1 -0  modperl-2.0/t/response/TestAPI/access2.pm
  
  Index: access2.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/access2.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- access2.pm8 Aug 2004 21:30:07 -   1.1
  +++ access2.pm8 Aug 2004 21:34:18 -   1.2
  @@ -25,6 +25,7 @@
   use warnings FATAL = 'all';
   
   use Apache::Access ();
  +use Apache::RequestRec ();
   
   use Apache::TestTrace;
   
  
  
  


cvs commit: modperl-2.0/t/htdocs/api auth-groups auth-users

2004-08-08 Thread stas
stas2004/08/08 14:35:03

  Added:   t/htdocs/api auth-groups auth-users
  Log:
  missing files
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/htdocs/api/auth-groups
  
  Index: auth-groups
  ===
  bar: goo bar
  tar: mar far
  
  
  
  1.1  modperl-2.0/t/htdocs/api/auth-users
  
  Index: auth-users
  ===
  goo:$apr1$g.mxW/..$p8ILT9D4345OO6vtYt8mT0
  bar:$apr1$ALRiO/..$GxXWAshiDKPmFGUA7r66e/
  
  
  


cvs commit: modperl-2.0/t/response/TestAPI access2.pm

2004-08-08 Thread stas
stas2004/08/08 16:45:40

  Modified:t/apiaccess2.t
   t/response/TestAPI access2.pm
  Log:
  test $r-satisfies when Satisfy is set
  
  Revision  ChangesPath
  1.2   +1 -1  modperl-2.0/t/api/access2.t
  
  Index: access2.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/api/access2.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- access2.t 8 Aug 2004 21:30:06 -   1.1
  +++ access2.t 8 Aug 2004 23:45:40 -   1.2
  @@ -5,7 +5,7 @@
   use Apache::TestUtil;
   use Apache::TestRequest;
   
  -plan tests = 6, need need_lwp, need_auth;
  +plan tests = 6, need need_lwp, need_auth, need_access;
   
   my $location = /TestAPI__access2;
   
  
  
  
  1.4   +24 -10modperl-2.0/t/response/TestAPI/access2.pm
  
  Index: access2.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/access2.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- access2.pm8 Aug 2004 23:01:38 -   1.3
  +++ access2.pm8 Aug 2004 23:45:40 -   1.4
  @@ -20,6 +20,9 @@
   #
   # otherwise it returns the same, sans the 'valid-user' entry
   #
  +# also test:
  +# - $r-some_auth_required when it's required
  +# - $r-satisfies when Satisfy is set
   
   use strict;
   use warnings FATAL = 'all';
  @@ -30,7 +33,7 @@
   use Apache::TestTrace;
   
   use Apache::Const -compile = qw(OK HTTP_UNAUTHORIZED SERVER_ERROR
  - M_POST);
  + M_POST :satisfy);
   
   my $users  = goo bar;
   my $groups = bar tar;
  @@ -42,8 +45,11 @@
   sub handler {
   my $r = shift;
   
  -# test: $r-some_auth_required;
  -return Apache::SERVER_ERROR unless $r-some_auth_required;
  +die '$r-some_auth_required failed' unless $r-some_auth_required;
  +
  +my $satisfies = $r-satisfies;
  +die wanted satisfies= . Apache::SATISFY_ALL . , got $satisfies
  +unless $r-satisfies() == Apache::SATISFY_ALL;
   
   my($rc, $sent_pw) = $r-get_basic_auth_pw;
   return $rc if $rc != Apache::OK;
  @@ -90,6 +96,12 @@
   PerlResponseHandler Apache::TestHandler::ok1
   SetHandler modperl
   
  +IfModule @ACCESS_MODULE@
  +# needed to test $r-satisfies
  +Order Deny,Allow
  +Deny from all
  +Allow from @servername@
  +/IfModule
   AuthType Basic
   AuthName Access
   Require user goo bar
  @@ -97,12 +109,14 @@
   Limit POST
  Require valid-user
   /Limit
  -
  -# htpasswd -mbc auth-users goo foo
  -# htpasswd -mb auth-users bar mar
  -# using md5 password so it'll work on win32 too
  -AuthUserFile @DocumentRoot@/api/auth-users
  -# group: user1 user2 ...
  -AuthGroupFile @DocumentRoot@/api/auth-groups
  +Satisfy All
  +IfModule @AUTH_MODULE@
  +# htpasswd -mbc auth-users goo foo
  +# htpasswd -mb auth-users bar mar
  +# using md5 password so it'll work on win32 too
  +AuthUserFile @DocumentRoot@/api/auth-users
  +# group: user1 user2 ...
  +AuthGroupFile @DocumentRoot@/api/auth-groups
  +/IfModule
   /Location
   /NoAutoConfig
  
  
  


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

2004-08-08 Thread gozer
gozer   2004/08/08 16:50:49

  Modified:t/conf   extra.last.conf.in
  Log:
  authen was recently renamed to authen_basic and authen_digest, fixing
  2 little rename omissions
  
  Revision  ChangesPath
  1.23  +2 -2  modperl-2.0/t/conf/extra.last.conf.in
  
  Index: extra.last.conf.in
  ===
  RCS file: /home/cvs/modperl-2.0/t/conf/extra.last.conf.in,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- extra.last.conf.in29 Apr 2004 00:19:35 -  1.22
  +++ extra.last.conf.in8 Aug 2004 23:50:48 -   1.23
  @@ -8,7 +8,7 @@
   'PerlInitHandler' = 'ModPerl::Test::add_config',
   'AuthType' = 'Basic',
   'AuthName' = 'PerlSection',
  -'PerlAuthenHandler' = 'TestHooks::authen',
  +'PerlAuthenHandler' = 'TestHooks::authen_basic',
   };
   /Perl
   
  @@ -51,7 +51,7 @@
   'PerlInitHandler'   = 'ModPerl::Test::add_config',
   'AuthType'  = 'Basic',
   'AuthName'  = 'PerlSection',
  -'PerlAuthenHandler' = 'TestHooks::authen',
  +'PerlAuthenHandler' = 'TestHooks::authen_basic',
   };
   /Perl
   
  
  
  


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

2004-08-08 Thread gozer
gozer   2004/08/08 17:17:05

  Modified:lib/Apache PerlSections.pm
  Log:
  Fix a bug in Perl sections with multiple aliases in a
  virtualhost container.
  
  Thread: http://marc.theaimsgroup.com/?t=10917643062
  Reported by : Kim Goldov [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.6   +6 -1  modperl-2.0/lib/Apache/PerlSections.pm
  
  Index: PerlSections.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/PerlSections.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PerlSections.pm   9 Jul 2004 08:01:20 -   1.5
  +++ PerlSections.pm   9 Aug 2004 00:17:05 -   1.6
  @@ -172,7 +172,12 @@
   $self-add_config($name $$entry\n);
   }
   elsif ($type eq 'ARRAY') {
  -$self-add_config($name @$entry\n);
  +if (grep {ref} @$entry) {
  +$self-dump_entry($name, $_) for @$entry;
  +}
  +else {
  +$self-add_config($name @$entry\n);
  +}
   }
   elsif ($type eq 'HASH') {
   $self-dump_hash($name, $entry);
  
  
  


cvs commit: modperl-2.0/todo api_status

2004-08-08 Thread stas
stas2004/08/08 17:33:02

  Modified:todo api_status
  Log:
  Apache::Access is done
  
  Revision  ChangesPath
  1.22  +1 -1  modperl-2.0/todo/api_status
  
  Index: api_status
  ===
  RCS file: /home/cvs/modperl-2.0/todo/api_status,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -u -r1.21 -r1.22
  --- api_status2 Aug 2004 18:03:20 -   1.21
  +++ api_status9 Aug 2004 00:33:02 -   1.22
  @@ -16,7 +16,7 @@
   - the file path is relative to the modperl-docs cvs repository
   #
   -- src/docs/2.0/api/Apache.pod
  --- src/docs/2.0/api/Apache/Access.pod
  +VV src/docs/2.0/api/Apache/Access.pod
   -- src/docs/2.0/api/Apache/CmdParms.pod
   -- src/docs/2.0/api/Apache/Command.pod
   +- src/docs/2.0/api/Apache/Connection.pod
  
  
  


cvs commit: modperl-2.0 Changes

2004-08-08 Thread gozer
gozer   2004/08/08 21:31:21

  Modified:.Changes
  Log:
  Forgot to note this bugfix in Changes
  
  Revision  ChangesPath
  1.430 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.429
  retrieving revision 1.430
  diff -u -r1.429 -r1.430
  --- Changes   8 Aug 2004 18:05:22 -   1.429
  +++ Changes   9 Aug 2004 04:31:20 -   1.430
  @@ -12,6 +12,9 @@
   
   =item 1.99_15-dev
   
  +Fix a bug in Perl sections with multiple aliases in a
  +virtualhost container. [Gozer]
  +
   PerlModule, PerlRequire, Perl and Perl is now supported in
   .htaccess. They will run for each request. [Gozer]