src/Http/Request.php
private function initHostInfo()
    {
        if (PHP_SAPI === 'cli') {
            return '';
        }

        $protocol = 'http';
        if (strcasecmp($this->SERVER('HTTPS'), 'on') === 0) {
            $protocol = 'https';
        }

        if (($host = $this->SERVER('HTTP_HOST')) != null) {
            $this->hostInfo = $protocol . '://' . $host;
        } elseif (($host = $this->SERVER('SERVER_NAME')) != null) {
            $this->hostInfo = $protocol . '://' . $host;
            $port = $this->getServerPort();
            if (($protocol == 'http' && $port != 80) || ($protocol == 'https' && $port != 443)) {
                $this->hostInfo .= ':' . $port;
            }
        }

        return '';
    }
private function initHostInfo()
    {
        if (PHP_SAPI === 'cli') {
            return '';
        }

        $protocol = 'http';
        if (strcasecmp($this->SERVER('HTTPS'), 'on') === 0) {
            $protocol = 'https';
        }

        if (($host = $this->SERVER('HTTP_HOST')) != null) {
            $this->hostInfo = $protocol . '://' . $host;
        } elseif (($host = $this->SERVER('SERVER_NAME')) != null) {
            $this->hostInfo = $protocol . '://' . $host;
            $port = $this->getServerPort();
            if (($protocol == 'http' && $port != 80) || ($protocol == 'https' && $port != 443)) {
                $this->hostInfo .= ':' . $port;
            }
        }

        return '';
    }
设置Host信息

@return null|string