[PATCH] module2path/module2url pod

2004-12-08 Thread Christopher H. Laco
Here's my first crack at pod for module2path and module2url.
I decided to put it at the end of the FUNCTONS head1. It didn't seem to 
make much sense at the beginning and it felt like I should keep focus on 
the exported functions.

Let me know if you had something else in mind and I'll rework it.
-=Chris
Index: lib/Apache/TestRequest.pm
===
--- lib/Apache/TestRequest.pm   (revision 94)
+++ lib/Apache/TestRequest.pm   (working copy)
@@ -1088,6 +1088,50 @@
 specification, section 9.2, at
 Ihttp://www.faqs.org/rfcs/rfc2616.html for more information.
 
+=head2 Helper Functions
+
+CApache::TestRequest also includes a few helper functions to aid in
+the creation of urls used in the functions above.
+
+=over 4
+
+=item module2path
+
+  my $module = 'MyTestModule::TestHandler';
+  my $path   = Apache::TestRequest::module2path($module);
+# returns 'MyTestModule__TestHandler'
+
+  my $res = GET /$path;
+
+Converts a module name to a path safe for use in the various request
+methods above.
+
+=item module2url
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri= Apache::TestRequest::module2url($module);
+# returns 'http://host:port/MyTestModule__TestHandler'
+
+  my $res = GET $uri;
+
+Converts a module name to a full uri including the current
+configurations host:port and sets Cmodule accordingly.
+
+The default scheme used is Chttp. You can override this by passing
+your preferred scheme into an optional second param:
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri = Apache::TestRequest::module2uri($module, {scheme = 'https'});
+# returns 'https://host:port/MyTestModule__TestHandler'
+
+You may also override the default path with a path of your own:
+
+  my $module = 'MyTestModule::TestHandler';
+  my $uri = Apache::TestRequest::module2uri($module, {path = '/foo'});
+# returns 'http://host:port/foo'
+
+=back
+
 =head1 ENVIRONMENT VARIABLES
 
 The following environment variables can affect the behavior of


Re: apxs calls on Win32

2004-12-08 Thread Randy Kobes
On Tue, 7 Dec 2004, Stas Bekman wrote:

 As soon as you see dup like this, think refactoring :) e.g. add
 untaint_path(), that does the work and call it:

local $ENV{PATH}) = untaint_path($ENV{PATH});

 Otherwise +1.

 And of course this wrapper should probably used in open_cmd too!

Here's a patch that does that:
==
Index: lib/Apache/TestConfig.pm
===
--- lib/Apache/TestConfig.pm(revision 56)
+++ lib/Apache/TestConfig.pm(working copy)
@@ -1045,12 +1045,8 @@
 my($self, $cmd) = @_;
 # untaint some %ENV fields
 local @ENV{ qw(IFS CDPATH ENV BASH_ENV) };
+local $ENV{PATH} = untaint_path($ENV{PATH});

-# Temporarily untaint PATH
-(local $ENV{PATH}) = ( $ENV{PATH} =~ /(.*)/ );
-# -T disallows relative directories in the PATH
-$ENV{PATH} = join ':', grep !/^\./, split /:/, $ENV{PATH};
-
 # launder for -T
 $cmd = $1 if $cmd =~ /(.*)/;

@@ -1663,7 +1659,8 @@
 return unless $self-{APXS};
 my $val;
 unless (exists $self-{_apxs}{$q}) {
-local @ENV{ qw(PATH IFS CDPATH ENV BASH_ENV) };
+local @ENV{ qw(IFS CDPATH ENV BASH_ENV) };
+local $ENV{PATH} = untaint_path($ENV{PATH});
 my $devnull = devnull();
 my $apxs = shell_ready($self-{APXS});
 $val = qx($apxs -q $q 2$devnull);
@@ -1684,6 +1681,17 @@
 $self-{_apxs}{$q};
 }

+# Temporarily untaint PATH
+sub untaint_path {
+my $path = shift;
+($path) = ( $path =~ /(.*)/ );
+# win32 uses ';' for a path separator, assume others use ':'
+my $sep = WIN32 ? ';' : ':';
+# -T disallows relative directories in the PATH
+$path = join $sep, grep !/^\./, split /$sep/, $path;
+return $path;
+}
+
 sub pop_dir {
 my $dir = shift;

==
I tried committing it, but was denied access (I ensured I
did a co with https); perhaps some permissions need
adjusting (I did have commit access under cvs).

-- 
best regards,
randy


Re: [PATCH] module2path/module2url pod

2004-12-08 Thread Stas Bekman
Christopher H. Laco wrote:
Here's my first crack at pod for module2path and module2url.
I decided to put it at the end of the FUNCTONS head1. It didn't seem to 
make much sense at the beginning and it felt like I should keep focus on 
the exported functions.
There is already one head1 FUNCTIONS there.
I've called your header:
  =head2 URL Manipulation Functions
since all function in this module are 'helper functions' :)
Let me know if you had something else in mind and I'll rework it.
Looks good. I've massaged it a bit and commited.
Thanks Chris.
--
__
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: apxs calls on Win32

2004-12-08 Thread Stas Bekman
Randy Kobes wrote:
On Wed, 8 Dec 2004, Stas Bekman wrote:

I've requested to restore it (you indeed don't have it). Let me know if
you want me to commit this or wait for when you get the access again
(should hopefully be restored tomorrow).

Thanks, Stas. If you have a minute, feel free to commit it;
otherwise, I'll do it when it's restored. Thanks.
It's in.
--
__
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: [OT] CVS - SVN Thoughts

2004-12-08 Thread Stas Bekman
Christopher H. Laco wrote:
This is mostly off topic, but I wanted to get thoughts from the 
committers on how they're liking the conversion from CVS to SVN so far. 
What do you really like/hate about it vs. CVS?

I've been toying around with the idea of moving that way at home. I'm 
not to sure I'm keen having to use copy for tagging and such, but maybe 
that's just the CVS brainwashing in me. I do dig the http/WebDAV 
background. It seems a lot easier to give the world read access.
I guess this is a wrong forum. May be you will have a better luck with svn 
users list, whatever it is? Personally I haven't done any moves myself 
yet, so I can't tell.

--
__
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: Building flood on AMD64

2004-12-08 Thread Philippe Marzouk
On Sat, Dec 04, 2004 at 09:25:59PM -0600, Robert Lowe wrote:
 Hi!
 
 I tried building flood-0.4 on an AMD64 box running FC3 but stalled
 immediately:
 
 checking build system type... Invalid configuration 
 `x86_64-unknown-linux-gnu': machine `x86_64-unknown' not recognized
 configure: error: /bin/sh ./config.sub x86_64-unknown-linux-gnu failed
 
 Any way around this??

Try flood from cvs because 0.4 is prehistoric and update config.sub and
config.guess.

Never tried it myself but that seems the logical next step.

Philippe


Re: apxs calls on Win32

2004-12-08 Thread Joe Schaefer
Stas Bekman [EMAIL PROTECTED] writes:

 I've requested to restore it (you indeed don't have it).

Sorry about that Randy.  I've been trying for weeks to 
get our httpd-test commit access restored.

-- 
Joe Schaefer



Re: [PATCH] module2path/module2url pod

2004-12-08 Thread Christopher H. Laco
Stas Bekman wrote:
Christopher H. Laco wrote:
Here's my first crack at pod for module2path and module2url.
I decided to put it at the end of the FUNCTONS head1. It didn't seem 
to make much sense at the beginning and it felt like I should keep 
focus on the exported functions.

There is already one head1 FUNCTIONS there.
I've called your header:
  =head2 URL Manipulation Functions
since all function in this module are 'helper functions' :)
Let me know if you had something else in mind and I'll rework it.

Looks good. I've massaged it a bit and commited.
Thanks Chris.
Shouldn't that be:
Index: TestRequest.pm
===
--- TestRequest.pm  (revision 111269)
+++ TestRequest.pm  (working copy)
@@ -1121,7 +1121,7 @@
 =head3 Cmodule2url
   $url = Apache::TestRequest::module2url($module);
-  $url = Apache::TestRequest::module2url($module, %options);
+  $url = Apache::TestRequest::module2url($module, \%options);
 Convert a module name to a full URL including the current
 configurations Chostname:port and sets Cmodule accordingly.
Maybe it's just me. The former leads me to believe that I might be able 
to do:
	module2url('MyMod::Test',
		scheme = 'https', path = '/merge3/');
instead of
	module2url('MyMod::Test',
		{scheme = 'https', path = '/merge3/'});
while the later make that more clear.

Any other grunt work can work on?
-=Chris


Re: [PATCH] module2path/module2url pod

2004-12-08 Thread Stas Bekman
Christopher H. Laco wrote:
Shouldn't that be:
Index: TestRequest.pm

-  $url = Apache::TestRequest::module2url($module, %options);
+  $url = Apache::TestRequest::module2url($module, \%options);
Thanks Chris, fixed.
Any other grunt work can work on?
if you didn't get tired from module2url manipulations, there are a few 
tests in the httpd-test repository that could use the same refactoring. 
This is the repository used by the httpd project. To exract it do:

svn checkout http://svn.apache.org/repos/asf/httpd/test/trunk/ httpd-test
it lives in httpd-test/perl-framework/t/
Other than that, I'm going to commit soon a new test framework that tests 
Apache-Test config itself, so you may want to help out with that, once 
it's in. You are on the [EMAIL PROTECTED] list, right? That list 
shows all the commits to the httpd-test project (which includes Apache-Test).

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