hi
i was asked to post here an improved script
which detects the true ip of your virtual server.
i'm too lazy to describe how it works :)
(recursive cgi - nah nah :)
regards,
doytchin
---------------
#!/usr/bin/perl
# (c)2000 doytchin spiridonov
use IO::Socket;
$server = $ENV{'HTTP_HOST'};
$port = $ENV{'SERVER_PORT'};
$script = $ENV{'SCRIPT_NAME'};
$address = $ENV{'REMOTE_ADDR'};
$qs = $ENV{'QUERY_STRING'};
print "Content-type: text/plain\n\n";
if ($qs eq 'a') {
print "A=$address\n";
} else {
print "Server: $server\r\nPort: $port\r\n";
if ($s = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $server, PeerPort => $port)) {
$s->autoflush(1);
print $s "GET $script?a HTTP/1.0\n\n";
while (<$s>) {
chomp;
if (/^A=(.*)$/) { $ip = $1; }
}
print "IP: $ip\r\n";
} else { print "Unable to connect!\r\n"; }
}