diff --git a/libraries/cms/installer/helper.php b/libraries/cms/installer/helper.php index 5affdd0d20a87..45523b8d46ac9 100644 --- a/libraries/cms/installer/helper.php +++ b/libraries/cms/installer/helper.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Registry\Registry; + jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.path'); @@ -38,7 +40,11 @@ public static function downloadPackage($url, $target = false) // Set user agent $version = new JVersion; - ini_set('user_agent', $version->getUserAgent('Installer')); + $agent = $version->getUserAgent('Installer'); + ini_set('user_agent', $agent); + + // Create option with userAgent to supply to transport + $httpTransportOpts = new Registry(array('userAgent' => $agent)); // Load installer plugins, and allow URL and headers modification $headers = array(); @@ -48,7 +54,7 @@ public static function downloadPackage($url, $target = false) try { - $response = JHttpFactory::getHttp()->get($url, $headers); + $response = JHttpFactory::getHttp($httpTransportOpts)->get($url, $headers); } catch (RuntimeException $exception) {