403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/UpdateSystem/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/UpdateSystem/Request.php
<?php

namespace Bitrix\Main\UpdateSystem;

use Bitrix\Main\SystemException;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\Web\HttpHeaders;
use Bitrix\Main\Web\Uri;

class Request
{
	private string $method = 'POST';
	private ?array $body = null;
	private Uri $url;
	private HttpClient $httpClient;

	public function __construct()
	{
		$this->httpClient = new HttpClient();
		$this->httpClient->setVersion('1.0');
	}

	public function setHeaders(HttpHeaders $headers): void
	{
		$this->httpClient->setHeaders($headers->toArray());
	}

	public function setUrl(Uri $url): void
	{
		$this->url = $url;
	}

	public function setMethod(string $method): void
	{
		$this->method = $method;
	}

	public function setProxy(array $proxyData): void
	{
		if (
			isset($proxyData['host'])
			&& !empty($proxyData['host'])
			&& isset($proxyData['port'])
			&& !empty($proxyData['port'])
		) {
			$this->httpClient->setProxy(
				$proxyData['host'],
				$proxyData['port'],
				$proxyData['user'] ?? null,
				$proxyData['password'] ?? null,
			);
		}
	}

	public function setBody(array $body): void
	{
		$this->body = $body;
	}

	/**
	 * @throws SystemException
	 * @throws \Exception
	 */
	public function send(): string
	{
		$this->url->addParams($this->body);
		$isSuccess = $this->httpClient->query(
			$this->method,
			$this->url->getLocator(),
			$this->body
		);

		if ($isSuccess)
		{
			return $this->httpClient->getResult();
		}
		else
		{
			if ($this->httpClient->getStatus() === 0 && empty($this->httpClient->getError()))
			{
				throw new \Exception('Invalid response from host: '.$this->url->getHost().' [RS01]', 400);
			}
			else
			{
				throw new SystemException(implode('\r\n', $this->httpClient->getError()).' [RS02]');
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit