This is a followup on my previous patch to attempt and solve the
problems people are having with Apache-Test on boxes with IPv6 and no
support for ipv4-mapped addresses in httpd.
Instead of hard-coding 127.0.0.1 in the listen directive, this patch
uses the servername instead.
The original problem was with statements such as:
Listen 80
That on IPv6 with no IPv4-mapped address would end up listening strictly
on the IPv6 loopback address (::1)
What seems to me like a superior solution is to use the servername
instead. That way, if a user has trouble because localhost defaults
to ::1 on his/her setup, passing -servername to ./t/TEST will fix the
problem.
For example
./t/TEST -servername some.name.for.an.ipv4.address.of.this.box
And then, of course, once LWP & Perl become IPv6 friendly, the tests
will be successfull even if localhost on the box points to ::1.
Only annoying side-effect is that this patch disables name-lookups on
the servername (I couldn't find a reason why it was doing it in the
first place anyhos).
mod_perl 2.0 tests 100% fine with it, and so does perl-framework (no
new errors).
Thoughts ?
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.209
diff -u -I$Id -r1.209 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 20 Feb 2004 23:51:54 -0000 1.209
+++ Apache-Test/lib/Apache/TestConfig.pm 21 Feb 2004 00:06:17 -0000
@@ -634,19 +634,8 @@
my $module = shift || '';
my $name = $vars->{servername};
- my $resolve = \$self->{resolved}->{$name};
- unless ($$resolve) {
- if (gethostbyname $name) {
- $$resolve = $name;
- }
- else {
- $$resolve = $self->default_loopback;
- warn "lookup $name failed, using $$resolve for client tests\n";
- }
- }
-
- join ':', $$resolve || 'localhost', $self->port($module || '');
+ join ':', $name , $self->port($module || '');
}
#look for mod_foo.so
@@ -1004,7 +993,7 @@
my @out_config = ();
if ($self->{vhosts}->{$module}->{namebased} < 2) {
#extra config that should go *outside* the <VirtualHost ...>
- @out_config = ([Listen => '127.0.0.1:' . $port]);
+ @out_config = ([Listen => $vars->{servername} . ':' . $port]);
if ($self->{vhosts}->{$module}->{namebased}) {
push @out_config => [NameVirtualHost => "*:$port"];
@@ -1772,7 +1761,7 @@
__DATA__
-Listen 127.0.0.1:@Port@
+Listen @ServerName@:@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.82
diff -u -I$Id -r1.82 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm 18 Feb 2004 00:30:57 -0000 1.82
+++ Apache-Test/lib/Apache/TestConfigPerl.pm 21 Feb 2004 00:06:17 -0000
@@ -207,7 +207,8 @@
sub set_connection_handler {
my($self, $module, $args) = @_;
my $port = $self->new_vhost($module);
- $self->postamble(Listen => '127.0.0.1:' . $port);
+ my $vars = $self->{vars};
+ $self->postamble(Listen => $vars->{servername} . ':' . $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.8
diff -u -I$Id -r1.8 conftree.pm
--- t/response/TestApache/conftree.pm 18 Feb 2004 00:30:57 -0000 1.8
+++ t/response/TestApache/conftree.pm 21 Feb 2004 00:06:17 -0000
@@ -29,7 +29,7 @@
my $listen = $tree->lookup('Listen');
- ok t_cmp('127.0.0.1:' . $vars->{port}, $listen);
+ ok t_cmp(join(':', $vars->{servername}, $vars->{port}), $listen);
my $documentroot = $tree->lookup('DocumentRoot');
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]