function RemoteFilesystem::getOptionsForUrl
Parameters
mixed[] $additionalOptions:
Return value
mixed[]
1 call to RemoteFilesystem::getOptionsForUrl()
- RemoteFilesystem::get in vendor/
composer/ composer/ src/ Composer/ Util/ RemoteFilesystem.php - Get file content or copy action.
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ RemoteFilesystem.php, line 618
Class
- RemoteFilesystem
- @internal @author François Pluchino <francois.pluchino@opendisplay.com> @author Jordi Boggiano <j.boggiano@seld.be> @author Nils Adermann <naderman@naderman.de>
Namespace
Composer\UtilCode
protected function getOptionsForUrl(string $originUrl, array $additionalOptions) {
$tlsOptions = [];
$headers = [];
if (extension_loaded('zlib')) {
$headers[] = 'Accept-Encoding: gzip';
}
$options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
if (!$this->degradedMode) {
// degraded mode disables HTTP/1.1 which causes issues with some bad
// proxies/software due to the use of chunked encoding
$options['http']['protocol_version'] = 1.1;
$headers[] = 'Connection: close';
}
$headers = $this->authHelper
->addAuthenticationHeader($headers, $originUrl, $this->fileUrl);
$options['http']['follow_location'] = 0;
if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
$options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
}
foreach ($headers as $header) {
$options['http']['header'][] = $header;
}
return $options;
}