function DiagnoseCommand::checkHttp
Return value
string|string[]|true
1 call to DiagnoseCommand::checkHttp()
- DiagnoseCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ DiagnoseCommand.php - Executes the current command.
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ DiagnoseCommand.php, line 325
Class
- DiagnoseCommand
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
private function checkHttp(string $proto, Config $config) {
$result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
if ($result !== true) {
return $result;
}
$result = [];
if ($proto === 'https' && $config->get('disable-tls') === true) {
$tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
}
try {
$this->httpDownloader
->get($proto . '://repo.packagist.org/packages.json');
} catch (TransportException $e) {
$hints = HttpDownloader::getExceptionHints($e);
if (null !== $hints && count($hints) > 0) {
foreach ($hints as $hint) {
$result[] = $hint;
}
}
$result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
}
if (isset($tlsWarning)) {
$result[] = $tlsWarning;
}
if (count($result) > 0) {
return $result;
}
return true;
}