Преглед на файлове

Lift openssl requirement for github archives (thanks @pborreli)

Jordi Boggiano преди 13 години
родител
ревизия
3ad905ae99
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      src/Composer/Downloader/FileDownloader.php

+ 6 - 1
src/Composer/Downloader/FileDownloader.php

@@ -51,7 +51,12 @@ abstract class FileDownloader implements DownloaderInterface
         echo 'Downloading '.$url.' to '.$fileName.PHP_EOL;
 
         if (0 === strpos($url, 'https:') && !extension_loaded('openssl')) {
-            throw new \RuntimeException('You must enable the openssl extension to download files via https');
+            // bypass https for github if openssl is disabled
+            if (preg_match('{^https://(github.com/[^/]+/[^/]+/(zip|tar)ball/[^/]+)$}i', $url, $match)) {
+                $url = 'http://nodeload.'.$match[1];
+            } else {
+                throw new \RuntimeException('You must enable the openssl extension to download files via https');
+            }
         }
 
         copy($url, $fileName);