Return the name of the host the request was made from.

@return string - host name
345703
public function getRemoteHostname() {
        static $hostname = null;
        if (!$hostname) {
            /** @var string $hostname */
            $hostname = NetTools::getHostByAddress($this->getRemoteAddress());
        }
        return $hostname;
    }
626568
private function _hostname()
    {
        if (PSI_USE_VHOST === true) {
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
        } else {
            $buffer = $this->_get_Win32_ComputerSystem();
            if (!$buffer && CommonFunctions::executeProgram('reg', 'query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName /v ComputerName', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^\s*ComputerName\s+REG_SZ\s+(\S+)\s*$/mi", $strBuf, $buffer2)) {
                    $buffer[0]['Name'] = $buffer2[1];
            }
            if ($buffer) {
                $result = $buffer[0]['Name'];
                $ip = gethostbyname($result);
                if ($ip != $result) {
                    if ((version_compare("10.0.0.0", $ip, "<=") && version_compare($ip, "10.255.255.255", "<=")) ||
                        (version_compare("172.16.0.0", $ip, "<=") && version_compare($ip, "172.31.255.255", "<=")) ||
                        (version_compare("192.168.0.0", $ip, "<=") && version_compare($ip, "192.168.255.255", "<=")) ||
                        (version_compare("127.0.0.0", $ip, "<=") && version_compare($ip, "127.255.255.255", "<=")) ||
                        (version_compare("169.254.1.0", $ip, "<=") && version_compare($ip, "169.254.254.255", "<=")) ||
                        (version_compare("255.255.255.255", $ip, "=="))) {
                        $this->sys->setHostname($result); // internal ip
                    } else {
                        $this->sys->setHostname(gethostbyaddr($ip));
                    }
                }
            } else {
                if (CommonFunctions::readenv('COMPUTERNAME', $hnm)) $this->sys->setHostname($hnm);
            }
        }
    }
214904
public function getHost() : string
    {
        $host = null;

        if ($this->isUsingTrustedProxy() && $this->headers->has(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST])) {
            $hosts = explode(',', $this->headers->get(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST]));
            $host = trim(end($hosts));
        }

        if ($host === null) {
            $host = $this->headers->get('HOST');
        }

        if ($host === null) {
            $host = $this->server->get('SERVER_NAME');
        }

        if ($host === null) {
            // Return an empty string by default so we can do string operations on it later
            $host = $this->server->get('SERVER_ADDR', '');
        }

        // Remove the port number
        $host = strtolower(preg_replace("/:\d+$/", '', trim($host)));

        // Check for forbidden characters
        // Credit: Symfony HTTPFoundation
        if (!empty($host) && !empty(preg_replace("/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/", '', $host))) {
            throw new InvalidArgumentException("Invalid host \"$host\"");
        }

        return $host;
    }
1296055
public static function host(): ?string
    {
        $ip = self::ip();

        if (isset(static::$hosts[$ip])) {
            return static::$hosts[$ip];
        }

        $host = gethostbyaddr($ip);
        static::$hosts[$ip] = ($host === '') ? null : $host;
        return static::$hosts[$ip];
    }
970304
public function getDomain()
    {
        if($this->getScheme() && $this->getHost()) {
            return $this->getScheme() . '://' . $this->getHost();
        }

        return false;
    }
1322527
public function getHttpHost()
    {
        if (isset($_SERVER['HTTP_HOST'])
            && isset($_SERVER['SERVER_NAME'])
            && $_SERVER['HTTP_HOST'] === $_SERVER['SERVER_NAME']
        ) {
            return $_SERVER['HTTP_HOST'];
        }

        if (isset($_SERVER['HTTP_HOST'])) {
            return $_SERVER['HTTP_HOST'];
        }

        // This is the least reliable, due to the ability to spoof it
        if (isset($_SERVER['SERVER_NAME'])) {
            return $_SERVER['SERVER_NAME'];
        }

        return null;
    }
97902
public function get_hostlist()
    {
        $default_hosts = (array) $this->getprop('default_host');
        $out           = array();

        foreach ($default_hosts as $key => $name) {
            if (!empty($name)) {
                $out[] = rcube_utils::parse_host(is_numeric($key) ? $name : $key);
            }
        }

        return $out;
    }
669216
def hostname(self):
    """"""
    hostname_artifact = self._hostnames.get(self.CURRENT_SESSION, None)
    if not hostname_artifact:
      return ''

    return hostname_artifact.name or ''
216221
public function getName()
    {
        $name = '';

        switch ($this->_clientId)
        {
            case Bootstrapper::SITE:
                $name = 'site';
                break;
            case Bootstrapper::ADMIN:
                $name = 'administrator';
                break;
            default:
                $name = 'cli';
                break;
        }

        return $name;
    }
440982
public function getUserHost()
    {
        foreach ($this->ipHeaders as $ipHeader) {
            if ($this->hasHeader($ipHeader)) {
                return gethostbyaddr(trim(explode(',', $this->getHeaderLine($ipHeader))[0]));
            }
        }

        return $this->getRemoteHost();
    }
222119
protected function _hostname()
    {
        if (PSI_USE_VHOST === true) {
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
        } else {
            if (CommonFunctions::rfts('/proc/sys/kernel/hostname', $result, 1, 4096, PSI_DEBUG && (PSI_OS != 'Android'))) {
                $result = trim($result);
                $ip = gethostbyname($result);
                if ($ip != $result) {
                    $this->sys->setHostname(gethostbyaddr($ip));
                }
            } elseif (CommonFunctions::executeProgram('hostname', '', $ret)) {
                $this->sys->setHostname($ret);
            }

        }
    }
563438
public function getHostName()
    {
        if (strpos($this->getWorkingHost(), ':') === false) {
            return $this->getWorkingHost();
        }

        $info = explode(':', $this->getWorkingHost());
        return $info[0];
    }
602050
protected function _hostname() {
        $components = parse_url(Router::url('/', true));
        if (isset($components['host'])) {
            return $components['host'];
        }
        return null;
    }
1110804
public String getHost() {
		String host = getAsNullableString("host");
		host = host != null ? host : getAsNullableString("ip");
		return host;
	}
982389
public static final String getHostName() {
		if (cachedHostName != null) {
			return cachedHostName;
		}

		// User-defined public hostname
		String name = System.getProperty("hostname");
		if (name == null || name.isEmpty()) {
			try {
				name = InetAddress.getLocalHost().getHostName();
			} catch (Exception ignored) {
				name = null;
			}
		}
		if (name == null || name.isEmpty() || name.contains("localhost")) {
			try {
				name = System.getenv().get("COMPUTERNAME");
			} catch (Exception ignored) {
				name = null;
			}
		}
		if (name == null || name.isEmpty()) {
			cachedHostName = "localhost";
		} else {
			cachedHostName = name.toLowerCase();
		}
		return cachedHostName;
	}
248950
public function getName()
    {
        $name = 'Request consumer: ';
        if ($this->queue) {
            $name .= ' on queue: ' . $this->queue->getName();
            $name .= ', on host: ' 
                . $this->queue->getConnection()->getHost() . ':' . $this->queue->getConnection() ->getPort();
            $name .= ', ' . $this->queue->getConnection()->isConnected() ? 'connected' : 'disconnected';
        }
        
        return $name;
    }
33265
public static function getHostname()
    {
        // Check trusted requires config file which is not ready yet
        $host = Url::getHost($checkIfTrusted = false);

        // Remove any port number to get actual hostname
        $host = Url::getHostSanitized($host);

        return $host;
    }