diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 61d79fd22..5a9bac36c 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -52,7 +52,7 @@ class RemoteFilesystem if (isset($options['ssl']['cafile']) && (!is_readable($options['ssl']['cafile']) || !openssl_x509_parse(file_get_contents($options['ssl']['cafile'])))) { //check return value and test (it's subject to change) - throw new TransportException('The configured cafile could was not valid or could not be read.'); + throw new TransportException('The configured cafile was not valid or could not be read.'); } // handle the other externally set options normally. diff --git a/tests/Composer/Test/Util/RemoteFilesystemTest.php b/tests/Composer/Test/Util/RemoteFilesystemTest.php index eabfe9ed5..e1cda3780 100644 --- a/tests/Composer/Test/Util/RemoteFilesystemTest.php +++ b/tests/Composer/Test/Util/RemoteFilesystemTest.php @@ -178,6 +178,28 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase unlink($file); } + /** + * @group TLS + */ + public function testGetOptionsForUrlCreatesSecureTlsDefaults() + { + $io = $this->getMock('Composer\IO\IOInterface'); + + $res = $this->callGetOptionsForUrl($io, array('http://example.org', array('ssl'=>array('cafile'=>'/some/path/file.crt')))); + + $this->assertTrue(isset($res['ssl']['ciphers'])); + $this->assertRegExp("|!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK|", $res['ssl']['ciphers']); + $this->assertTrue($res['ssl']['verify_peer']); + $this->assertTrue($res['ssl']['SNI_enabled']); + $this->assertEquals(7, $res['ssl']['verify_depth']); + $this->assertEquals('example.org', $res['ssl']['CN_match']); + $this->assertEquals('example.org', $res['ssl']['SNI_server_name']); + $this->assertEquals('/some/path/file.crt', $res['ssl']['cafile']); + if (version_compare(PHP_VERSION, '5.4.13') >= 0) { + $this->assertTrue($res['ssl']['disable_compression']); + } + } + protected function callGetOptionsForUrl($io, array $args = array(), array $options = array()) { $fs = new RemoteFilesystem($io, $options);