From: petter Date: Fri, 12 Dec 2008 11:47:32 +0000 (+0000) Subject: Fixed so that server_host is the hostname and not IP, as javscript will fail if the... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=517c59608c4bba1000019190b92f05415501fd51;p=varnish Fixed so that server_host is the hostname and not IP, as javscript will fail if the URL doesn't match. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3462 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-tools/webgui/Varnish/RequestHandler.pm b/varnish-tools/webgui/Varnish/RequestHandler.pm index 89432151..3730d8cd 100644 --- a/varnish-tools/webgui/Varnish/RequestHandler.pm +++ b/varnish-tools/webgui/Varnish/RequestHandler.pm @@ -13,6 +13,7 @@ use URI::Escape; use GD::Graph::lines; use POSIX qw(strftime); use List::Util qw(first); +use Socket; { my %request_ref_of; @@ -29,7 +30,9 @@ use List::Util qw(first); $response_content_ref_of{$new_object} = \""; $response_header_ref_of{$new_object} = {}; - $master_tmpl_var_of{$new_object}->{'server_host'} = $connection->sockhost(); + my $server_ip = $connection->sockhost(); + my $server_hostname = gethostbyaddr(inet_aton($server_ip), AF_INET); + $master_tmpl_var_of{$new_object}->{'server_host'} = $server_hostname; $master_tmpl_var_of{$new_object}->{'server_port'} = $connection->sockport(); return $new_object;