Method code for $http_daemon.figure_site_url()

[Turn on line numbering]
var host, curr, h, port;

curr = .current_ports();
if ((h = find h in (curr) where (listlen(h) == 2))) {
    [port, host] = curr[h];
    host = $dns.hostname(host);
} else {
    host = $dns.hostname("");
    port = curr[1][1];
}
if (port != 80)
    site_url = host + ":" + port;
else
    site_url = host;
return site_url;

// Created 22-Aug-1995 as a part of ColdCore, see: @help Credit

Tlon