perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: t\protocol\pseudo_http.t failure
Date Tue, 06 Jul 2004 02:33:39 GMT
On Mon, 5 Jul 2004, Steve Hay wrote:

> Stas Bekman wrote:
>
> >Steve Hay wrote:
> >
> >>Just tried out the latest CVS mp2 on Win32 and had a couple of
> >>failures.  One of them is t\protocol\pseudo_http.t.
> >
> >There is an auth file that I added to
> >t/htdocs/protocols/basic-auth. Do you think it should be
> >generated specially on windows and therefore it's not
> >cross-platform? Try to generate one yourself:
> >
> >htpasswd -bc basic-auth stas foobar
> >
> >overwriting the one in cvs and try the test again?
> >
> Yes, that's it.

Here's a patch that, for Win32, will generate this file at
the 'perl Makefile.PL' stage, and then use it in the tests.
It also changes checking for the mod_access module in this
test to mod_auth.
=========================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.143
diff -u -r1.143 Makefile.PL
--- Makefile.PL	5 Jul 2004 22:02:42 -0000	1.143
+++ Makefile.PL	6 Jul 2004 02:27:49 -0000
@@ -232,6 +232,9 @@
     printf "Configuring Apache/%s mod_perl/%s Perl/v%vd\n",
         $httpd_version, $VERSION, $^V;

+    # generate auth_file on Win32
+    win32_generate_auth('stas', 'foobar') if (WIN32());
+
     my $apr_config = $build->get_apr_config; #cache it

     # we need to know where apr-config and apu-configs are
@@ -468,6 +471,17 @@
     return unless (my $prefix = $build->{MP_AP_PREFIX});
     my $script = catfile($build->{cwd}, 'build', 'win32_fetch_apxs');
     my @args = ($^X, $script, "--with-apache2=$prefix");
+    system(@args) == 0 or die "system @args failed: $?";
+}
+
+sub win32_generate_auth {
+    my ($user, $passwd) = @_;
+    my $htpasswd = catfile $build->{MP_AP_PREFIX}, 'bin', 'htpasswd.exe';
+    unless (-e $htpasswd) {
+        die "Cannot find htpasswd";
+    }
+    my $auth_file = catfile qw(t htdocs protocols basic-auth-win32);
+    my @args = ($htpasswd, '-bc', $auth_file, $user, $passwd);
     system(@args) == 0 or die "system @args failed: $?";
 }

Index: t/htdocs/protocols/.cvsignore
===================================================================
RCS file: t/htdocs/protocols/.cvsignore
diff -N t/htdocs/protocols/.cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ t/htdocs/protocols/.cvsignore	6 Jul 2004 02:27:49 -0000
@@ -0,0 +1 @@
+basic-auth-win32
Index: t/protocol/pseudo_http.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/protocol/pseudo_http.t,v
retrieving revision 1.1
diff -u -r1.1 pseudo_http.t
--- t/protocol/pseudo_http.t	5 Jul 2004 01:36:47 -0000	1.1
+++ t/protocol/pseudo_http.t	6 Jul 2004 02:27:49 -0000
@@ -18,7 +18,7 @@
 my $passgood = "foobar";
 my $passbad  = "foObaR";

-plan tests => 13, have_access;
+plan tests => 13, have_auth;

 {
     # supply correct credential when prompted for such and ask the
Index: t/protocol/TestProtocol/pseudo_http.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/pseudo_http.pm,v
retrieving revision 1.1
diff -u -r1.1 pseudo_http.pm
--- t/protocol/TestProtocol/pseudo_http.pm	5 Jul 2004 01:36:47 -0000	1.1
+++ t/protocol/TestProtocol/pseudo_http.pm	6 Jul 2004 02:27:49 -0000
@@ -136,13 +136,18 @@
     PerlProcessConnectionHandler TestProtocol::pseudo_http

     <Location TestProtocol::pseudo_http>
-        <IfModule mod_access.c>
+        <IfModule mod_auth.c>
             Order Deny,Allow
             Allow from @servername@
             Require user stas
             Satisfy any
             # htpasswd -bc basic-auth stas foobar
-            AuthUserFile @ServerRoot@/htdocs/protocols/basic-auth
+            <IfModule !mpm_winnt.c>
+                AuthUserFile @ServerRoot@/htdocs/protocols/basic-auth
+            </IfModule>
+            <IfModule mpm_winnt.c>
+                AuthUserFile @ServerRoot@/htdocs/protocols/basic-auth-win32
+            </IfModule>
         </IfModule>
     </Location>

==================================================================

-- 
best regards,
randy


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message