• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/web/httpclient.php
  • Класс: BitrixMainWebHttpClient
  • Вызов: HttpClient::checkRequest
protected function checkRequest(RequestInterface $request): bool
{
	$uri = $request->getUri();

	$scheme = $uri->getScheme();
	if ($scheme !== 'http' && $scheme !== 'https')
	{
		$this->addError('URI_SCHEME', 'Only http and https shemes are supported.');
		return false;
	}

	if ($uri->getHost() == '')
	{
		$this->addError('URI_HOST', 'Incorrect host in URI.');
		return false;
	}

	$punyUri = new Uri('http://' . $uri->getHost());
	$error = $punyUri->convertToPunycode();
	if ($error instanceof BitrixMainError)
	{
		$this->addError('URI_PUNICODE', "Error converting hostname to punycode: {$error->getMessage()}");
		return false;
	}

	if (!$this->privateIp)
	{
		$ip = IpAddress::createByUri($uri);
		if ($ip->isPrivate())
		{
			$this->addError('PRIVATE_IP', "Resolved IP is incorrect or private: {$ip->get()}");
			return false;
		}
		$this->effectiveIp = $ip;
	}

	return true;
}