ANNOUNCE: Krang RSS 1.00

2004-08-17 Thread Peter Leonard
We're pleased to announce that Krang RSS v1.00 has been released.
Krang RSS is a Krang element-library addon that creates RSS files for the 
purposes of syndication.  RSS is designed to be easily integrated into 
existing Krang element libraries with minimal work.

From the documentation:
The RSS element library addon to Krang is designed to generate RSS files 
for your website.  Creating and publishing an RSS story at the root 
category of your site will result in an RSS 2.0 file of the 5 
most-recently-published stories on the site.

Download Krang RSS addon from the Krang add-on repository on the Krang 
website:

 http://krang.sourceforge.net/
 - the Krang Team
--
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


mod_perl2 and document_root

2004-08-17 Thread Dave Della Costa
Hey folks, I'm trying to learn how to use mod_perl to change document_root on
the fly, but I'm having a lot of difficulty with it.  Here's the setup:

Apache/2.0.50, mod_perl/1.99_11 Perl/v5.8.4 PHP/4.3.8 Server

I'm calling the code this way:

PerlTransHandler  MyApache::RewriteURI

...and this is what RewriteURI looks like (yes, wholly ripped off from the
documentation...):

###
package MyApache::RewriteURI;

use strict;
use warnings;

use Apache::RequestRec;
use Apache::RequestUtil;

use Apache::Const -compile = qw(DECLINED);

sub handler {
my $r = shift;

$r-document_root(/home/ddellacosta/web_dev/stuff/htdocs);

warn DOCUMENT_ROOT =  . $r-document_root() . \n;

$r-uri(forgot.phtml);

return Apache::DECLINED;
}

1;
###


When I try to run this, I get an Internal Server Error and this message in the
error_log:

Usage: Apache::RequestRec::document_root(r) at
/usr/lib/apache2/lib/perl/MyApache/RewriteURI.pm line 14.\n

Floating around on the web are dozens of examples of being able to set
document_root the way I'm trying to set it.  However, I cannot seem to get this
to work.  Am I doing something ridiculously obviously wrong?  I am a mod_perl
newbie.

Thanks for any help!

Dave D.




-- 
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: write results of subrequest to file

2004-08-17 Thread Philippe M. Chiasson

Geoffrey Young wrote:
Perrin Harkins wrote:
On Fri, 2004-08-13 at 11:06, Geoffrey Young wrote:

you can't do that with mod_perl 1.0 - you can $sub-run() but that result
goes right to the client.

For comparison, how would you do this in mp2?  With a filter?

pretty much.  I believe that subrequests in apache2 have the same
limitations as before wrt calling run().  but if the main reason you want to
capture a subrequest is to post-process dynamic content then you can simply
insert an output filter to do that for you, as that is what they were
designed for.
Nah, you can do it in a much cleaner way in mp2.
See http://perl.apache.org/docs/2.0/api/Apache/SubRequest.html#C_lookup_uri_,
but basically you can
my $data;
my $subr = $r-lookup_uri($uri, $filter);
$subr-run;
And $filter can be a very simple output filter that just stashes data as it
comes out or anything else you feel like doing.
--Geoff
--

Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: write results of subrequest to file

2004-08-17 Thread Stas Bekman
Philippe M. Chiasson wrote:

Geoffrey Young wrote:
Perrin Harkins wrote:
On Fri, 2004-08-13 at 11:06, Geoffrey Young wrote:

you can't do that with mod_perl 1.0 - you can $sub-run() but that 
result
goes right to the client.

For comparison, how would you do this in mp2?  With a filter?

pretty much.  I believe that subrequests in apache2 have the same
limitations as before wrt calling run().  but if the main reason you 
want to
capture a subrequest is to post-process dynamic content then you can 
simply
insert an output filter to do that for you, as that is what they were
designed for.

Nah, you can do it in a much cleaner way in mp2.
See 
http://perl.apache.org/docs/2.0/api/Apache/SubRequest.html#C_lookup_uri_,
but basically you can

my $data;
my $subr = $r-lookup_uri($uri, $filter);
$subr-run;
And $filter can be a very simple output filter that just stashes data as it
comes out or anything else you feel like doing.
Hmm, and where do you get this $filter object from? Do you have a working 
example?

--
__
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


How to close a socket when all you have in an Apache::Connection object

2004-08-17 Thread Ken Simpson
I'm writing a protocol handler for mod_perl 2.0.

If all I have is an Apache::Connection object, how can I tell Apache I
want to close the connection? I tried sending an end of stream bucket
down the bucket brigade, but that clearly did nothing.

What's the canonical solution?

Regards,
Ken

-- 
MailChannels: Control Your Email
http://www.mailchannels.com

Ken Simpson, CEO
+1-604-729-1741

-- 
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: mod_perl2 and document_root

2004-08-17 Thread Stas Bekman
Dave Della Costa wrote:
Hey folks, I'm trying to learn how to use mod_perl to change document_root on
the fly, but I'm having a lot of difficulty with it.  Here's the setup:
Apache/2.0.50, mod_perl/1.99_11 Perl/v5.8.4 PHP/4.3.8 Server
I'm calling the code this way:
PerlTransHandler  MyApache::RewriteURI
...and this is what RewriteURI looks like (yes, wholly ripped off from the
documentation...):
###
package MyApache::RewriteURI;
use strict;
use warnings;
use Apache::RequestRec;
use Apache::RequestUtil;
use Apache::Const -compile = qw(DECLINED);
sub handler {
my $r = shift;
$r-document_root(/home/ddellacosta/web_dev/stuff/htdocs);
warn DOCUMENT_ROOT =  . $r-document_root() . \n;
$r-uri(forgot.phtml);
return Apache::DECLINED;
}
1;
###
When I try to run this, I get an Internal Server Error and this message in the
error_log:
Usage: Apache::RequestRec::document_root(r) at
/usr/lib/apache2/lib/perl/MyApache/RewriteURI.pm line 14.\n
Floating around on the web are dozens of examples of being able to set
document_root the way I'm trying to set it.  However, I cannot seem to get this
to work.  Am I doing something ridiculously obviously wrong?  I am a mod_perl
newbie.
Right. The examples you've found are from mod_perl 1, Apache2 has this in 
its docs:

/**
 * Retrieve the document root for this server
 * @param r The current request
 * @warning Don't use this!  If your request went through a Userdir, or
 * something like that, it'll screw you.  But it's back-compatible...
 * @return The document root
 * @deffunc const char *ap_document_root(request_rec *r)
 */
AP_DECLARE(const char *) ap_document_root(request_rec *r);
we haven't had a chance yet to work on figuring out how to solve it for 
mp2. Let me do some research and I'll be back to you shortly.

--
__
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


How to tell if there's data waiting on a NON-blocking Apache connection?

2004-08-17 Thread Ken Simpson
Oops -- the subject line was wrong last time. Let's try again:

If all I have is an Apache::Connection object, is there a way to tell
whether data is available from the connection's socket in the case
where the connection has been put into nonblocking mode.

Thanks,
Ken

-- 
MailChannels: Control Your Email
http://www.mailchannels.com

Ken Simpson, CEO
+1-604-729-1741

-- 
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: How to tell if there's data waiting on a NON-blocking Apache connection?

2004-08-17 Thread Stas Bekman
Ken Simpson wrote:
Oops -- the subject line was wrong last time. Let's try again:
If all I have is an Apache::Connection object, is there a way to tell
whether data is available from the connection's socket in the case
where the connection has been put into nonblocking mode.
$c-client_socket gives you the socket object, now I suppose you want to 
poll() it for read. Unfortunately we haven't exposed APR::Poll yet. Take a 
look at the C API:

http://lxr.webperf.org/source.cgi/srclib/apr/include/apr_poll.h
http://docx.webperf.org/apr__poll_8h.html
http://docx.webperf.org/group__apr__poll.html
Is that what you are after?
--
__
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: write results of subrequest to file

2004-08-17 Thread Stas Bekman
Philippe M. Chiasson wrote:

Stas Bekman wrote:
Philippe M. Chiasson wrote:
Geoffrey Young wrote:

Perrin Harkins wrote:

On Fri, 2004-08-13 at 11:06, Geoffrey Young wrote:

you can't do that with mod_perl 1.0 - you can $sub-run() but that 
result
goes right to the client.


For comparison, how would you do this in mp2?  With a filter?


pretty much.  I believe that subrequests in apache2 have the same
limitations as before wrt calling run().  but if the main reason you 
want to
capture a subrequest is to post-process dynamic content then you can 
simply
insert an output filter to do that for you, as that is what they were
designed for.

Nah, you can do it in a much cleaner way in mp2.
See 
http://perl.apache.org/docs/2.0/api/Apache/SubRequest.html#C_lookup_uri_, 

but basically you can
my $data;
my $subr = $r-lookup_uri($uri, $filter);
$subr-run;
And $filter can be a very simple output filter that just stashes data 
as it
comes out or anything else you feel like doing.

Hmm, and where do you get this $filter object from? Do you have a 
working example?

Hmm, I think you just got me there. I didn't think long enough before 
answering
that one ;-)

I can see why one can't do that now that I've looked at code for a few 
minutes,
and sorry for misleading anybody on this one.
Ah, no, I think it's quite do-able, I just thought that you had an example 
at hand. The $filter argument is just a pointer to somewhere in the filter 
chain. So I suppose on could add a filter for the subrequest and pass 
$filter: $subr-output_filters. But as I don't have a test, I can't vouch 
for it to work. If you want I can write a test for it later, but now I 
need to resolve if a few other issues first. So let me know if you want me 
to work on this.

--
__
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: How to tell if there's data waiting on a NON-blocking Apache connection?

2004-08-17 Thread Ken Simpson
 $c-client_socket gives you the socket object, now I suppose you want to 
 poll() it for read. Unfortunately we haven't exposed APR::Poll yet. Take a 
 look at the C API:
 
 http://lxr.webperf.org/source.cgi/srclib/apr/include/apr_poll.h
 http://docx.webperf.org/apr__poll_8h.html
 http://docx.webperf.org/group__apr__poll.html
 
 Is that what you are after?

Yes, this is exactly what we need. Ideally, the APR interface should
support the operations supported by IO::Select -- but it appears to.

How much work is it to write the mappings for APR::Poll? I've never
done it before but.. well we could give it a shot!

TTUL
Ken

-- 
MailChannels: Control Your Email
http://www.mailchannels.com

Ken Simpson, CEO
+1-604-729-1741

-- 
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: How to tell if there's data waiting on a NON-blocking Apache connection?

2004-08-17 Thread Stas Bekman
Ken Simpson wrote:
$c-client_socket gives you the socket object, now I suppose you want to 
poll() it for read. Unfortunately we haven't exposed APR::Poll yet. Take a 
look at the C API:

http://lxr.webperf.org/source.cgi/srclib/apr/include/apr_poll.h
http://docx.webperf.org/apr__poll_8h.html
http://docx.webperf.org/group__apr__poll.html
Is that what you are after?

Yes, this is exactly what we need. Ideally, the APR interface should
support the operations supported by IO::Select -- but it appears to.
the APR::Socket object is an opaque one, so it can't interoperate with any 
other perl modules. Have you looked if there is some C api to get the 
native socket object? There could be one (as they have for file objects), 
I didn't check.

How much work is it to write the mappings for APR::Poll? I've never
done it before but.. well we could give it a shot!
What C functions do you need to be exposed? it should be really quick if 
it can be exposed as is, without needing to write a special glue code...

--
__
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: mod_perl2 and document_root

2004-08-17 Thread Geoffrey Young

 Right. The examples you've found are from mod_perl 1, Apache2 has this
 in its docs:
 
 /**
  * Retrieve the document root for this server
  * @param r The current request
  * @warning Don't use this!  If your request went through a Userdir, or
  * something like that, it'll screw you.  But it's back-compatible...
  * @return The document root
  * @deffunc const char *ap_document_root(request_rec *r)
  */
 AP_DECLARE(const char *) ap_document_root(request_rec *r);
 
 we haven't had a chance yet to work on figuring out how to solve it for
 mp2. Let me do some research and I'll be back to you shortly.

in mp1 $r-document_root is misleading in the sense that it is _not_ locally
scoped to $r - if you set it the change remains for all subsequent requests,
since you are really altering the core configuration data.  any example you
find for mp1 _should_ include a mechanism for resetting $r-document_root to
it's original value or it's misleading at best.  something like this

  http://www.modperlcookbook.org/code/ch04/Cookbook/Userdir.pm

is more proper than what you have.

being able to alter DocumentRoot is valuable as long as you understand the
ramifications, so I see no reason why we shouldn't continue to make it a
writable feature in mp2.  however, I very much dislike having it hang off of
$r and would prefer it to hang off of $s so that people understand that its
lifetime extends beyond the current request.

--Geoff



-- 
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: mod_perl2 and document_root

2004-08-17 Thread Glenn Strauss
On Tue, Aug 17, 2004 at 04:45:20PM -0700, Stas Bekman wrote:
 Right. The examples you've found are from mod_perl 1, Apache2 has this in 
 its docs:
 
 /**
  * Retrieve the document root for this server
  * @param r The current request
  * @warning Don't use this!  If your request went through a Userdir, or
  * something like that, it'll screw you.  But it's back-compatible...
  * @return The document root
  * @deffunc const char *ap_document_root(request_rec *r)
  */
 AP_DECLARE(const char *) ap_document_root(request_rec *r);
 
 we haven't had a chance yet to work on figuring out how to solve it for 
 mp2. Let me do some research and I'll be back to you shortly.

In Apache2, mod_userdir sets a note named mod_userdir_user in
the r-notes table, so there is a way to detect if you are in a
Userdir request (if using mod_userdir).  However, that note only
tells you the target user, not the path.

The path is typically $HOME/public_html of the user, though
that is configurable with the UserDir directive, so YMMV.

Cheers,
Glenn

-- 
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: mod_perl2 and document_root

2004-08-17 Thread Stas Bekman
Glenn Strauss wrote:
On Tue, Aug 17, 2004 at 04:45:20PM -0700, Stas Bekman wrote:
Right. The examples you've found are from mod_perl 1, Apache2 has this in 
its docs:

/**
* Retrieve the document root for this server
* @param r The current request
* @warning Don't use this!  If your request went through a Userdir, or
* something like that, it'll screw you.  But it's back-compatible...
* @return The document root
* @deffunc const char *ap_document_root(request_rec *r)
*/
AP_DECLARE(const char *) ap_document_root(request_rec *r);
we haven't had a chance yet to work on figuring out how to solve it for 
mp2. Let me do some research and I'll be back to you shortly.

In Apache2, mod_userdir sets a note named mod_userdir_user in
the r-notes table, so there is a way to detect if you are in a
Userdir request (if using mod_userdir).  However, that note only
tells you the target user, not the path.
Ah, cool, thanks, I was just about to look at userdir
The path is typically $HOME/public_html of the user, though
that is configurable with the UserDir directive, so YMMV.
So how do other applications that desire to rely on document_root get this 
special userdir doc-root?

--
__
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: mod_perl2 and document_root

2004-08-17 Thread Stas Bekman
Geoffrey Young wrote:
Right. The examples you've found are from mod_perl 1, Apache2 has this
in its docs:
/**
* Retrieve the document root for this server
* @param r The current request
* @warning Don't use this!  If your request went through a Userdir, or
* something like that, it'll screw you.  But it's back-compatible...
* @return The document root
* @deffunc const char *ap_document_root(request_rec *r)
*/
AP_DECLARE(const char *) ap_document_root(request_rec *r);
we haven't had a chance yet to work on figuring out how to solve it for
mp2. Let me do some research and I'll be back to you shortly.

in mp1 $r-document_root is misleading in the sense that it is _not_ locally
scoped to $r - if you set it the change remains for all subsequent requests,
since you are really altering the core configuration data.  any example you
find for mp1 _should_ include a mechanism for resetting $r-document_root to
it's original value or it's misleading at best.  something like this
  http://www.modperlcookbook.org/code/ch04/Cookbook/Userdir.pm
is more proper than what you have.
being able to alter DocumentRoot is valuable as long as you understand the
ramifications, so I see no reason why we shouldn't continue to make it a
writable feature in mp2.  however, I very much dislike having it hang off of
$r and would prefer it to hang off of $s so that people understand that its
lifetime extends beyond the current request.
+1
the bigger problem (which i've explained on the dev list) in the parallel 
thread, is that under threaded mpms, that changing the document_root in 
one thread will affect all other threads, which is most certainly break 
things. So unless I'm missing something, that won't work for worker mpm.

At the moment we have about 10 methods, which access server global 
structures and if you use those to set those structures, you limit your 
users to non-threaded mpms.

--
__
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/response/TestAPI module.pm

2004-08-17 Thread gozer
gozer   2004/08/17 13:39:46

  Modified:t/response/TestAPI module.pm
  Log:
  Improve Apache::Module tests to make usage of the entire API on the
  whole apache module list.
  
  Revision  ChangesPath
  1.16  +24 -38modperl-2.0/t/response/TestAPI/module.pm
  
  Index: module.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/module.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- module.pm 11 Aug 2004 00:13:50 -  1.15
  +++ module.pm 17 Aug 2004 20:39:46 -  1.16
  @@ -18,50 +18,20 @@
   my $r = shift;
   
   my $cfg = Apache::Test::config();
  -
  +
   my $top_module = Apache::Module-top_module;
   
  -#no promise that mod_perl will be the top_module
  -my $top_module_name = (defined $top_module  $top_module-name()) || '';
  +my $module_count = 0;
  +for (my $modp = $top_module; $modp; $modp = $modp-next) {
  +$module_count++;
  +}
   
  -my $tests = 11;
  +my $tests = 10 + ( 5 * $module_count );
   
   plan $r, tests = $tests;
   
  -t_debug top_module: $top_module_name;
  -ok $top_module;
  -
  -ok t_cmp($top_module-version,
  - $cfg-{httpd_info}-{MODULE_MAGIC_NUMBER_MAJOR},
  - q{$top_module-version});
  -
  -ok t_cmp($top_module-module_index,
  - scalar(keys %{ $cfg-{modules} }),
  - q{$top_module-module_index})
  -|| 1; # the A-T config could be wrong
  -
  -if (0) { #XXX: currently fails with --enable-mods-shared=all
  -local $cfg-{modules}-{'mod_perl.c'} = 1;
  -my $modules = {};
  -
  -for (my $modp = $top_module; $modp; $modp = $modp-next) {
  -if ($modp  $modp-name) {
  -$modules-{$modp-name} = 1;
  -}
  -}
  -
  -my %alias = (
  -'sapi_apache2.c' = 'mod_php4.c',
  -);
  -
  -while (my($key, $val) = each %alias) {
  -next unless $modules-{$key};
  -delete $modules-{$key};
  -$modules-{$val} = 1;
  -}
  -
  -ok t_cmp($modules, $cfg-{modules}, Modules list);
  -}
  +my $core = Apache::Module::find_linked_module('core.c');
  +ok defined $core  $core-name eq 'core.c';
   
   #.c
   ok t_cmp(Apache::Module::loaded('mod_perl.c'), 1,
  @@ -94,6 +64,22 @@
   
   ok t_cmp(Apache::Module::loaded(''), 0,
Apache::Module::loaded(''));
  +
  +
  +ok t_cmp ref($top_module), 'Apache::Module', 'top_module';
  +
  +my $mmn_major = $cfg-{httpd_info}{MODULE_MAGIC_NUMBER_MAJOR};
  +my $mmn_minor = $cfg-{httpd_info}{MODULE_MAGIC_NUMBER_MINOR};
  +for (my $modp = $top_module; $modp; $modp = $modp-next) {
  +my $name = $modp-name;
  +ok $name;
  +t_debug(Testing module:  . $modp-name);
  +ok $modp-version == $mmn_major;
  +ok $modp-minor_version = $mmn_minor;
  +ok $modp-module_index = 0;
  +my $cmds = $modp-cmds;
  +ok !defined($cmds) || ref($cmds) eq 'Apache::Command';
  +}
   
   Apache::OK;
   }
  
  
  


cvs commit: modperl-2.0/t/hooks hookrun.t

2004-08-17 Thread stas
stas2004/08/17 22:49:03

  Added:   t/hooks/TestHooks hookrun.pm
   t/hooks  hookrun.t
  Log:
  Apache::HookRun tests
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/hooks/TestHooks/hookrun.pm
  
  Index: hookrun.pm
  ===
  package TestHooks::hookrun;
  
  # this test runs all Apache phases from within the very first http
  # phase
  
  # XXX: may be improve the test to do a full-blown test, where each
  # phase does something useful.
  
  # see also TestProtocol::pseudo_http
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestUtil ();
  use Apache::HookRun ();
  use APR::Table ();
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestTrace;
  
  use Apache::Const -compile = qw(OK DECLINED DONE SERVER_ERROR);
  
  my $path = '/' . Apache::TestRequest::module2path(__PACKAGE__);
  
  my @phases = qw(
  PerlPostReadRequestHandler
  PerlTransHandler
  PerlMapToStorageHandler
  PerlHeaderParserHandler
  PerlAccessHandler
  PerlAuthenHandler
  PerlAuthzHandler
  PerlTypeHandler
  PerlFixupHandler
  PerlResponseHandler
  PerlLogHandler
  );
  
  sub post_read_request {
  my $r = shift;
  my $rc;
  
  $r-push_handlers(PerlTransHandler= \any);
  $r-push_handlers(PerlMapToStorageHandler = \any);
  $r-push_handlers(PerlHeaderParserHandler = \any);
  $r-push_handlers(PerlAccessHandler   = \any);
  $r-push_handlers(PerlAuthenHandler   = \any);
  $r-push_handlers(PerlAuthzHandler= \any);
  $r-push_handlers(PerlTypeHandler = \any);
  $r-push_handlers(PerlFixupHandler= \any);
  $r-push_handlers(PerlLogHandler  = \any);
  
  any($r); # indicate that the post_read_request phase was run
  
  # for the full Apache logic for running phases starting from
  # post_read_request and ending with fixup see
  # ap_process_request_internal in httpd-2.0/server/request.c
  
  $rc = $r-run_translate_name;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_map_to_storage;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  # this must be run all a big havoc will happen in the following
  # phases
  $r-location_merge($path);
  
  $rc = $r-run_header_parser;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  my $args = $r-args || '';
  if ($args eq 'die') {
  $r-die(Apache::SERVER_ERROR);
  return Apache::DONE;
  }
  
  $rc = $r-run_access_checker;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_auth_checker;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_check_user_id;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_type_checker;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_fixups;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  # $r-run_handler is called internally by $r-invoke_handler,
  # invoke_handler sets all kind of filters, and does a few other
  # things but it's possible to call $r-run_handler, bypassing
  # invoke_handler
  $rc = $r-invoke_handler;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  $rc = $r-run_log_transaction;
  return $rc unless $rc == Apache::OK or $rc == Apache::DECLINED;
  
  return Apache::DONE;
  
  # Apache runs ap_finalize_request_protocol on return of this
  # handler
  }
  
  sub any {
  my $r = shift;
  
  my $callback = Apache::current_callback();
  
  debug running $callback\n;
  $r-notes-set($callback = 1);
  
  # unset the callback that was already run
  $r-set_handlers($callback = []);
  
  Apache::OK;
  }
  
  sub response {
  my $r = shift;
  
  my @pre_response = (@phases)[0..($#phases-2)];
  plan tests = scalar(@pre_response);
  
  for my $phase (@pre_response) {
  my $note = $r-notes-get($phase);
  $r-print($phase:$note\n);
  }
  
  Apache::OK;
  }
  
  1;
  __END__
  NoAutoConfig
  VirtualHost TestHooks::hookrun
  PerlModule TestHooks::hookrun
  PerlPostReadRequestHandler Apache::Reload
  PerlPostReadRequestHandler TestHooks::hookrun::post_read_request
  Location /TestHooks__hookrun
  SetHandler modperl
  PerlResponseHandlerTestHooks::hookrun::response
  
  AuthName modperl
  AuthType none
  Require valid-user
  /Location
  /VirtualHost
  /NoAutoConfig
  
  
  
  1.1  modperl-2.0/t/hooks/hookrun.t
  
  Index: hookrun.t
  ===
  use strict;
  use 

cvs commit: modperl-2.0/xs/Apache/RequestUtil Apache__RequestUtil.h

2004-08-17 Thread stas
stas2004/08/17 22:52:22

  Modified:xs/Apache/RequestUtil Apache__RequestUtil.h
  Log:
  a helpful note for the future
  
  Revision  ChangesPath
  1.25  +2 -0  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.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- Apache__RequestUtil.h 18 Aug 2004 05:46:10 -  1.24
  +++ Apache__RequestUtil.h 18 Aug 2004 05:52:22 -  1.25
  @@ -62,6 +62,8 @@
   request_rec *r;
   server_rec *s = c-base_server;
   
  +/* see: httpd-2.0/server/protocol.c:ap_read_request */
  +
   if (!base_pool) {
   base_pool = c-pool;
   }
  
  
  


cvs commit: modperl-2.0 Changes

2004-08-17 Thread stas
stas2004/08/17 22:55:26

  Modified:xs/maps  apache_functions.map
   .Changes
  Log:
  Disable Apache::HookRun::run_create_request -- it's already run by
  Apache::RequestRec-new
  
  Revision  ChangesPath
  1.97  +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.96
  retrieving revision 1.97
  diff -u -u -r1.96 -r1.97
  --- apache_functions.map  17 Aug 2004 22:51:24 -  1.96
  +++ apache_functions.map  18 Aug 2004 05:55:26 -  1.97
  @@ -464,7 +464,7 @@
ap_run_handler
ap_run_log_transaction
   ap_run_rewrite_args
  - ap_run_create_request
  +?ap_run_create_request
   ap_run_error_log
   ap_run_get_mgmt_items
ap_run_map_to_storage
  
  
  
  1.453 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.452
  retrieving revision 1.453
  diff -u -u -r1.452 -r1.453
  --- Changes   18 Aug 2004 05:46:10 -  1.452
  +++ Changes   18 Aug 2004 05:55:26 -  1.453
  @@ -12,6 +12,9 @@
   
   =item 1.99_15-dev
   
  +Disable Apache::HookRun::run_create_request -- it's already run
  +internally by Apache::RequestRec-new [Stas]
  +
   Update Apache::RequestRec-new() to initialize members of request_rec
   which were added some time ago (without it we were getting segfaults
   in the new pseudo_http test. [Stas]