Get Host
@return string
184368
public function getHost()
    {
        if (isset($this->env['HOST'])) {
            if (strpos($this->env['HOST'], ':') !== false) {
                $hostParts = explode(':', $this->env['HOST']);

                return $hostParts[0];
            }

            return $this->env['HOST'];
        } else {
            return $this->env['SERVER_NAME'];
        }
    }
258171
public function getDomain()
    {
        $current = $this->server['HTTP_HOST'];
        $parts = explode('.', $current);

        $zone = array_pop($parts);
        $provider = array_pop($parts);

        return $provider . '.' . $zone;
    }
1005800
private String getTargetHost() {
        String host = getVirtualHost();
        if (null == host) {
            host = (isIncoming()) ? getServiceContext().getLocalAddr().getCanonicalHostName() : getServiceContext().getRemoteAddr().getCanonicalHostName();
        }
        return host;
    }
623585
protected function assembleHost() {
		if ($this->host === null) {
			return '/';
		}
		
		if ($this->port === null) {
			return $this->host;
		}
		
		return $this->host . ':' . $this->port;
	}
707312
public static function getLocalHost()
    {
        if ($nets = swoole_get_local_ip()) {
            foreach ($nets as $net => $host) {
                if (self::isUsableHost($host)) {
                    return $host;
                }
            }
        }

        return self::LOCAL_HOST;
    }
1224246
public String getHost()
    {
        // Return already determined host
        if (_host != null) return _host;

        // Return host from absolute URI
        _host = _uri.getHost();
        _port = _uri.getPort();
        if (_host != null) return _host;

        // Return host from header field
        _hostPort = _header.get(HttpFields.__Host);
        _host = _hostPort;
        _port = 0;
        if (_host != null && _host.length() > 0)
        {
            int colon = _host.lastIndexOf(':');
            if (colon >= 0)
            {
                if (colon < _host.length())
                {
                    try
                    {
                        _port = TypeUtil.parseInt(_host, colon + 1, -1, 10);
                    }
                    catch (Exception e)
                    {
                        LogSupport.ignore(log, e);
                    }
                }
                _host = _host.substring(0, colon);
            }

            return _host;
        }

        // Return host from connection
        if (_connection != null)
        {
            _host = _connection.getServerName();
            _port = _connection.getServerPort();
            if (_host != null && !InetAddrPort.__0_0_0_0.equals(_host)) return _host;
        }

        // Return the local host
        try
        {
            _host = InetAddress.getLocalHost().getHostAddress();
        }
        catch (java.net.UnknownHostException e)
        {
            LogSupport.ignore(log, e);
        }
        return _host;
    }
545272
private function getHostLength()
    {
        $hostLength = strpos($this->url, '/');
        $hostLength = (false === $hostLength) ? strlen($this->url) : $hostLength;

        return $hostLength;
    }
1328064
public static function getHostUri()
  {
    $sheme = (self::getHostParam("HTTPS") == "on") ? "https" : "http";

    $serverName = new Str(self::getHostParam("HTTP_HOST"));
    $serverPort = self::getHostParam("SERVER_PORT");
    $serverPort = ($serverPort != 80 && $serverPort != 443) ? ":" . $serverPort : "";

    if($serverName->endsWith($serverPort))
    {
      $serverName = $serverName->replace($serverPort, "");
    }

    return new Str($sheme . "://" . $serverName . $serverPort);
  }
701897
function GetSubdomain()
    {
        $host = $this->host;
        $sub = substr($host, 0, strlen($host) - strlen($this->GetDomain()));
        return rtrim($sub, '.');
    }
22364
protected static function getBaseUrl()
  {
    $baseUrl = 'https://';
    if (!self::$ssl) {
      $baseUrl = 'http://';
    }
    $baseUrl .= sprintf('%s:%s/%s/', self::$host, self::$port, self::$context);
    return $baseUrl;
  }
1075602
public function getHost()
    {
        if (! $this->host) {
            $this->host = UriSchemeFactory::make() . '://' . UriHostFactory::make();
        }

        return $this->host;
    }
225182
public function getHost()
    {
        $host = $this->headers->get('HTTP_HOST');
        if ($host) {
            if (strpos($host, ':') !== false) {
                $hostParts = explode(':', $host);

                return $hostParts[0];
            }

            return $host;
        }

        return $this->env->get('SERVER_NAME');
    }
504408
public String getHost()
    {
        if (_addr==null)
            return __0_0_0_0;
        
        return _addrIsHost?_addr.getHostName():_addr.getHostAddress();
    }
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;
    }
1198839
public static function getHost()
    {
        $host = '';
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && $host = $_SERVER['HTTP_X_FORWARDED_HOST']) {
            $elements = explode(',', $host);
            $host     = trim(end($elements));
        } else {
            if (isset($_SERVER['HTTP_HOST']) && !$host = $_SERVER['HTTP_HOST']) {
                if (isset($_SERVER['SERVER_NAME']) && !$host = $_SERVER['SERVER_NAME']) {
                    $host = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
                }
            }
        }
        // Remove port number from host
        $host = preg_replace('/:\d+$/', '', $host);

        return trim($host);
    }
1258833
public function resolveHost()
    {
        $host = $this->getHost();

        if ($host == null) {
            //check to see if there is an AuthenticationToken from which to retrieve it:
            $token = $this->getAuthenticationToken();
            //if ($token instanceof $HostAuthenticationToken) {
            if($token)
                $host = 'API Services';
            //}
        }

        if ($host == null) {
            $session = $this->resolveSession();
            if ($session != null) {
                $host = $session->getHost();
            }
        }

        return $host;

    }
42744
public function getHost()
    {
        $hostClass = $this->hostClass;
        $user = $hostClass::buildNoInitModel();
        /* @var BaseUserModel $user */
        return $this->hasOne($hostClass::className(), [$user->guidAttribute => 'createdBy']);
    }