From e68d455c5ca71219873167d31140f85e0c52820a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 28 Jun 2013 19:16:12 +0200 Subject: [PATCH] Remove the http protocol from github-protocols, refs #1955 --- doc/04-schema.md | 7 ++++--- src/Composer/Command/ConfigCommand.php | 4 ++-- src/Composer/Config.php | 9 ++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/04-schema.md b/doc/04-schema.md index 3e449a958..cfb0567c7 100644 --- a/doc/04-schema.md +++ b/doc/04-schema.md @@ -606,9 +606,10 @@ The following options are supported: * **preferred-install:** Defaults to `auto` and can be any of `source`, `dist` or `auto`. This option allows you to set the install method Composer will prefer to use. -* **github-protocols:** Defaults to `["git", "https", "http"]`. A list of - protocols to use when cloning from github.com, in priority order. Use this if you - are behind a proxy or have somehow bad performances with the git protocol. +* **github-protocols:** Defaults to `["git", "https"]`. A list of protocols to + use when cloning from github.com, in priority order. You can reconfigure it to + prioritize the https protocol if you are behind a proxy or have somehow bad + performances with the git protocol. * **github-oauth:** A list of domain names and oauth keys. For example using `{"github.com": "oauthtoken"}` as the value of this option will use `oauthtoken` to access private repositories on github and to circumvent the low IP-based diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index a241b1426..3459569a7 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -297,8 +297,8 @@ EOT } foreach ($vals as $val) { - if (!in_array($val, array('git', 'https', 'http'))) { - return 'valid protocols include: git, https, http'; + if (!in_array($val, array('git', 'https'))) { + return 'valid protocols include: git, https'; } } diff --git a/src/Composer/Config.php b/src/Composer/Config.php index c704c34a2..601a21344 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -24,7 +24,7 @@ class Config 'use-include-path' => false, 'preferred-install' => 'auto', 'notify-on-install' => true, - 'github-protocols' => array('git', 'https', 'http'), + 'github-protocols' => array('git', 'https'), 'vendor-dir' => 'vendor', 'bin-dir' => '{$vendor-dir}/bin', 'cache-dir' => '{$home}/cache', @@ -200,6 +200,13 @@ class Config return $this->config[$key]; + case 'github-protocols': + if (reset($this->config['github-protocols']) === 'http') { + throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https" or "git"'); + } + + return $this->config[$key]; + default: if (!isset($this->config[$key])) { return null;