diff --git a/common/HttpClient.php b/common/HttpClient.php index 6ba2eea..15043fc 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -125,7 +125,11 @@ class HttpClient */ public function setHost(string $host) { - $this->host = $host; + $this->host = $this->replaceHost($host); + $match_quest = '/^[a-zA-Z\-](\.[a-zA-Z\-])*/'; + if (preg_match($match_quest, $this->host)) { + $this->addHeader('Host', $this->host); + } } /** @@ -262,7 +266,6 @@ class HttpClient if ($this->checkIsIp($host)) { return $host; } - $this->addHeader('Host', $host); return System::gethostbyname($host); }