On Thu, 2004-02-12 at 10:24 -0800, Stas Bekman wrote:
> Andrew Wyllie wrote:
> > 
> > 
> > So, after rereading my previous post, I found one slight difference 
> > (funny how
> > it works that way sometimes).  When I used telnet to connect to the 
> > server, it
> > used '::1' as an address for localhost as opposed to 127.0.0.1 .  So I 
> > changed all the
> > refs to localhost in httpd.conf to ::1 and sure enough, all the tests 
> > passed.  I'm going to look
> > into this a bit more to see why this is the case as I have always 
> > thought that both of these
> > cases should work the same way.  
> 
> So how can we make it into a setup that will work on both, ipv6 and ipv4?

The problem is that on most BSDs, IPv6 is starting to become the default
setup, at least, it's the case on my OpenBSD box.

Configuring httpd with --enable-v4-mapped will make it all work, but
it's not the default, so most people on those BSDs are getting an httpd
that will default to IPv6. Even localhost in /etc/hosts is going to be
'::1' (ipv6 equiv of localhost).

The following patch (short of being to detect at configure time the
IPv4/6 status of the box) hard-codes all the listening IP addresses to
127.0.0.1, effectively ensuring all the test suite runs under vanilla-
IPv4.

Ideally, I'd like to figure out a way to detect things correctly, and
pick between 127.0.0.1 and ::1 accordingly.

Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.204
diff -u -r1.204 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm        31 Jan 2004 01:53:09 -0000      1.204
+++ Apache-Test/lib/Apache/TestConfig.pm        2 Feb 2004 06:47:45 -0000
@@ -1002,7 +1002,7 @@
     my @out_config = ();
     if ($self->{vhosts}->{$module}->{namebased} < 2) {
         #extra config that should go *outside* the <VirtualHost ...>
-        @out_config = ([Listen => $port]);
+        @out_config = ([Listen => '127.0.0.1:' . $port]);
 
         if ($self->{vhosts}->{$module}->{namebased}) {
             push @out_config => [NameVirtualHost => "*:$port"];
@@ -1750,7 +1750,7 @@
 
 
 __DATA__
-Listen     @Port@
+Listen     127.0.0.1:@Port@
 
 ServerRoot   "@ServerRoot@"
 DocumentRoot "@DocumentRoot@"
Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.81
diff -u -r1.81 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm    24 Nov 2003 07:57:30 -0000      1.81
+++ Apache-Test/lib/Apache/TestConfigPerl.pm    2 Feb 2004 06:47:45 -0000
@@ -207,7 +207,7 @@
 sub set_connection_handler {
     my($self, $module, $args) = @_;
     my $port = $self->new_vhost($module);
-    $self->postamble(Listen => $port);
+    $self->postamble(Listen => '127.0.0.1:' . $port);
 }
 
 my %add_hook_config = (
Index: t/response/TestApache/conftree.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestApache/conftree.pm,v
retrieving revision 1.7
diff -u -r1.7 conftree.pm
--- t/response/TestApache/conftree.pm   8 Oct 2003 13:28:14 -0000       1.7
+++ t/response/TestApache/conftree.pm   2 Feb 2004 06:47:45 -0000
@@ -27,9 +27,9 @@
 
     ok $tree;
 
-    my $port = $tree->lookup('Listen');
+    my $listen = $tree->lookup('Listen');
 
-    ok t_cmp($vars->{port}, $port);
+    ok t_cmp('127.0.0.1:' . $vars->{port}, $listen);
 
     my $documentroot = $tree->lookup('DocumentRoot');
 

> > Anyway, for whatever it's worth, 
> > mod_perl 1.99_13
> > with perl 5.8.3 and apache 2.0.48 seems to build and test ok on FREEBSD 
> > current
> > (as of Feb 3, 2004).
> 
> That's good.
> __________________________________________________________________
> Stas Bekman            JAm_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
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to