浏览代码

Fix code to use hostname only, refs #3026

Jordi Boggiano 11 年之前
父节点
当前提交
08e34858d6
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 4 3
      src/Composer/Util/Svn.php
  2. 1 1
      tests/Composer/Test/Util/SvnTest.php

+ 4 - 3
src/Composer/Util/Svn.php

@@ -289,9 +289,10 @@ class Svn
 
         $authConfig = $this->config->get('http-basic');
 
-        if (array_key_exists($this->url, $authConfig)) {
-            $this->credentials['username'] = $authConfig[$this->url]['username'];
-            $this->credentials['password'] = $authConfig[$this->url]['password'];
+        $host = parse_url($this->url, PHP_URL_HOST);
+        if (isset($authConfig[$host])) {
+            $this->credentials['username'] = $authConfig[$host]['username'];
+            $this->credentials['password'] = $authConfig[$host]['password'];
 
             return $this->hasAuth = true;
         }

+ 1 - 1
tests/Composer/Test/Util/SvnTest.php

@@ -60,7 +60,7 @@ class SvnTest extends \PHPUnit_Framework_TestCase
         $config->merge(array(
             'config' => array(
                 'http-basic' => array(
-                    $url => array('username' => 'foo', 'password' => 'bar')
+                    'svn.apache.org' => array('username' => 'foo', 'password' => 'bar')
                 )
             )
         ));