dougm 01/04/19 14:21:20 Modified: Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm TestRequest.pm Log: allow test modules to configure VirtualHosts and hit them with test requests Revision Changes Path 1.9 +1 -1 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm =================================================================== RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestConfig.pm 2001/04/13 00:51:54 1.8 +++ TestConfig.pm 2001/04/19 21:21:16 1.9 @@ -564,7 +564,7 @@ $include_headers{$h} : $h; require Apache::TestRequest; - Apache::TestRequest::http_raw_get($self->{hostport}, + Apache::TestRequest::http_raw_get($self, $url, $ih); } 1.9 +7 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm =================================================================== RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestConfigPerl.pm 2001/04/19 17:21:32 1.8 +++ TestConfigPerl.pm 2001/04/19 21:21:17 1.9 @@ -178,12 +178,19 @@ while (<$fh>) { next unless /\S+/; + chomp; $self->replace; my($directive, $rest) = split /\s+/, $_, 2; if ($outside_container{$directive}) { $self->postamble($directive => $rest); } elsif ($directive =~ m/^<(\w+)/) { + if ($directive eq '<VirtualHost') { + $rest =~ s/>$//; + my $port = $self->new_vhost($rest); + $self->postamble(Listen => $port); + $rest = "_default_:$port>"; + } $self->postamble($directive => $rest); my $end = "</$1>"; while (<$fh>) { 1.3 +15 -2 modperl-2.0/Apache-Test/lib/Apache/TestRequest.pm Index: TestRequest.pm =================================================================== RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestRequest.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestRequest.pm 2001/04/04 04:36:58 1.2 +++ TestRequest.pm 2001/04/19 21:21:18 1.3 @@ -27,11 +27,23 @@ my $UA; my $Config; +sub hostport { + my $config = shift; + my $hostport = $config->{hostport}; + + if (my $module = $Apache::TestRequest::Module) { + $hostport = $config->{vhosts}->{$module}->{hostport}; + } + + $hostport; +} + sub resolve_url { my $url = shift; return $url if $url =~ m,^(\w+):/,; $url = "/$url" unless $url =~ m,^/,; - return "http://$Config->{hostport}$url"; + my $hostport = hostport($Config); + return "http://$hostport$url"; } my %wanted_args = map {$_, 1} qw(username password realm content); @@ -145,9 +157,10 @@ } sub http_raw_get { - my($hostport, $url, $want_headers) = @_; + my($config, $url, $want_headers) = @_; $url ||= "/"; + my $hostport = hostport($config); require IO::Socket; my $s = IO::Socket::INET->new($hostport);