浏览代码

Remove the http protocol from github-protocols, refs #1955

Jordi Boggiano 12 年之前
父节点
当前提交
e68d455c5c
共有 3 个文件被更改,包括 14 次插入6 次删除
  1. 4 3
      doc/04-schema.md
  2. 2 2
      src/Composer/Command/ConfigCommand.php
  3. 8 1
      src/Composer/Config.php

+ 4 - 3
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

+ 2 - 2
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';
                         }
                     }
 

+ 8 - 1
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;