diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-09-01 11:12:05 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-09-01 11:12:05 +0000 |
commit | a44e7fc4c46ec353afbadd60d729710d8f1c251f (patch) | |
tree | 7b7b5baca889291c8d949282f4b352be0dc2f2d3 | |
parent | 8e742eac4c6448bba0c09268b761bad5b9028772 (diff) | |
download | lighttpd-git-a44e7fc4c46ec353afbadd60d729710d8f1c251f.tar.gz |
replace 'localhost' by gethostbyaddr for 127.0.0.1
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@669 152afb58-edef-0310-8abb-c4023f1b3aa9
-rwxr-xr-x | tests/LightyTest.pm | 7 | ||||
-rwxr-xr-x | tests/core-response.t | 4 | ||||
-rwxr-xr-x | tests/mod-redirect.t | 8 | ||||
-rwxr-xr-x | tests/mod-userdir.t | 2 |
4 files changed, 13 insertions, 8 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index ca65ba67..120db313 100755 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -4,6 +4,7 @@ package LightyTest; use strict; use IO::Socket; use Test::More; +use Socket; use Cwd 'abs_path'; sub new { @@ -27,7 +28,11 @@ sub new { $self->{LIGHTTPD_PIDFILE} = $self->{TESTDIR}.'/tmp/lighttpd/lighttpd.pid'; $self->{PIDOF_PIDFILE} = $self->{TESTDIR}.'/tmp/lighttpd/pidof.pid'; $self->{PORT} = 2048; - + + my ($name, $aliases, $addrtype, $net) = gethostbyaddr(inet_aton("127.0.0.1"), AF_INET); + + $self->{HOSTNAME} = $name; + bless($self, $class); return $self; diff --git a/tests/core-response.t b/tests/core-response.t index 7988383e..abd95f09 100755 --- a/tests/core-response.t +++ b/tests/core-response.t @@ -77,14 +77,14 @@ $t->{REQUEST} = ( <<EOF GET /dummydir HTTP/1.0 EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/dummydir/' } ]; ok($tf->handle_http($t) == 0, 'internal redirect in directory'); $t->{REQUEST} = ( <<EOF GET /dummydir?foo HTTP/1.0 EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/?foo' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/dummydir/?foo' } ]; ok($tf->handle_http($t) == 0, 'internal redirect in directory + querystring'); ## simple-vhost diff --git a/tests/mod-redirect.t b/tests/mod-redirect.t index 99f95967..b57ac3e2 100755 --- a/tests/mod-redirect.t +++ b/tests/mod-redirect.t @@ -21,7 +21,7 @@ GET /redirect/ HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/' } ]; ok($tf->handle_http($t) == 0, 'external redirect'); $t->{REQUEST} = ( <<EOF @@ -29,7 +29,7 @@ GET /redirect/ HTTP/1.0 Host: zzz.example.org EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/zzz' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/zzz' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub'); $t->{REQUEST} = ( <<EOF @@ -37,7 +37,7 @@ GET /redirect/ HTTP/1.0 Host: remoteip.example.org EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/127.0.0.1' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/127.0.0.1' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip'); $t->{REQUEST} = ( <<EOF @@ -45,7 +45,7 @@ GET /redirect/ HTTP/1.0 Host: remoteip2.example.org EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/remoteip2' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/remoteip2' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip2'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-userdir.t b/tests/mod-userdir.t index 890e73aa..33f4ab0e 100755 --- a/tests/mod-userdir.t +++ b/tests/mod-userdir.t @@ -29,7 +29,7 @@ $t->{REQUEST} = ( <<EOF GET /~jan HTTP/1.0 EOF ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/~jan/' } ]; +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ]; ok($tf->handle_http($t) == 0, 'valid user + redirect'); $t->{REQUEST} = ( <<EOF |