• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/web/httpclient.php
  • Класс: BitrixMainWebHttpClient
  • Вызов: HttpClient::createHandler
protected function createHandler(RequestInterface $request)
{
	if ($this->sslVerify === false)
	{
		$this->contextOptions['ssl']['verify_peer_name'] = false;
		$this->contextOptions['ssl']['verify_peer'] = false;
		$this->contextOptions['ssl']['allow_self_signed'] = true;
	}

	$handlerOptions = [
		'waitResponse' => $this->waitResponse,
		'bodyLengthMax' => $this->bodyLengthMax,
		'proxyHost' => $this->proxyHost,
		'proxyPort' => $this->proxyPort,
		'effectiveIp' => $this->effectiveIp,
		'contextOptions' => $this->contextOptions,
		'socketTimeout' => $this->socketTimeout,
		'streamTimeout' => $this->streamTimeout,
		'curlLogFile' => $this->curlLogFile,
	];

	$responseBuilder = new HttpResponseBuilder();

	if ($this->useCurl)
	{
		$handler = new HttpCurlHandler($request, $responseBuilder, $handlerOptions);
	}
	else
	{
		$handler = new HttpSocketHandler($request, $responseBuilder, $handlerOptions);
	}

	if ($this->logger !== null)
	{
		$handler->setLogger($this->logger);
		$handler->setDebugLevel($this->debugLevel);
	}

	if ($this->shouldFetchBody !== null)
	{
		$handler->shouldFetchBody($this->shouldFetchBody);
	}

	return $handler;
}