perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r164920 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestRequest.pm
Date Wed, 27 Apr 2005 00:00:13 GMT
Author: stas
Date: Tue Apr 26 17:00:11 2005
New Revision: 164920

URL: http://svn.apache.org/viewcvs?rev=164920&view=rev
Log:
Fix Apache::TestRequest::hostport to return the default host:port
string if $Apache::TestRequest::Module is 'default' or undef

Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/TestRequest.pm

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/Changes?rev=164920&r1=164919&r2=164920&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Tue Apr 26 17:00:11 2005
@@ -8,6 +8,9 @@
 
 =item 1.23-dev
 
+Fix Apache::TestRequest::hostport to return the default host:port
+string if $Apache::TestRequest::Module is 'default' or undef [Stas]
+
 Fix Apache::TestRequest::module2url to allow passing '' as a URI
 path. [Stas]
 

Modified: perl/Apache-Test/trunk/lib/Apache/TestRequest.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/TestRequest.pm?rev=164920&r1=164919&r2=164920&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestRequest.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestRequest.pm Tue Apr 26 17:00:11 2005
@@ -180,16 +180,19 @@
 
 sub hostport {
     my $config = shift || Apache::Test::config();
-    local $config->{vars}->{scheme} =
-      $Apache::TestRequest::Scheme || $config->{vars}->{scheme};
+    my $vars = $config->{vars};
+    local $vars->{scheme} =
+        $Apache::TestRequest::Scheme || $vars->{scheme};
     my $hostport = $config->hostport;
 
+    my $default_hostport = join ':', $vars->{servername}, $vars->{port};
     if (my $module = $Apache::TestRequest::Module) {
-        $hostport = $config->{vhosts}->{$module}->{hostport}
-          unless $module eq 'default';
+        $hostport = $module eq 'default'
+            ? $default_hostport
+            : $config->{vhosts}->{$module}->{hostport};
     }
 
-    $hostport;
+    $hostport || $default_hostport;
 }
 
 sub resolve_url {
@@ -268,9 +271,7 @@
     local $Apache::TestRequest::Module = $module if $module;
 
     my $hostport = hostport(Apache::Test::config());
-    die "can't find hostport for '$module',\n",
-        "make sure that vhost_socket() was passed a valid module name"
-            unless defined $hostport;
+
     my($host, $port) = split ':', $hostport;
     my(%args) = (PeerAddr => $host, PeerPort => $port);
 



Mime
View raw message