protected function UpdateFetcher::doRequest in Drupal 9
Applies a GET request with a possible HTTP fallback.
This method falls back to HTTP in case there was some certificate problem.
Parameters
string $url: The URL.
array $options: The guzzle client options.
bool $with_http_fallback: Should the function fall back to HTTP.
Return value
string The body of the HTTP(S) request, or an empty string on failure.
1 call to UpdateFetcher::doRequest()
- UpdateFetcher::fetchProjectData in core/
modules/ update/ src/ UpdateFetcher.php - Retrieves the project information.
File
- core/
modules/ update/ src/ UpdateFetcher.php, line 96
Class
- UpdateFetcher
- Fetches project information from remote locations.
Namespace
Drupal\updateCode
protected function doRequest(string $url, array $options, bool $with_http_fallback) : string {
$data = '';
try {
$data = (string) $this->httpClient
->get($url, [
'headers' => [
'Accept' => 'text/xml',
],
])
->getBody();
} catch (TransferException $exception) {
watchdog_exception('update', $exception);
if ($with_http_fallback && strpos($url, "http://") === FALSE) {
$url = str_replace('https://', 'http://', $url);
return $this
->doRequest($url, $options, FALSE);
}
}
return $data;
}