Created
June 3, 2010 16:01
-
-
Save zimbatm/424061 to your computer and use it in GitHub Desktop.
Homebrew unsafe download stategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 04a8c2c1ad1c3b5ea644961275575e21e621540a Mon Sep 17 00:00:00 2001 | |
From: Jonas Pfenniger <jonas@pfenniger.name> | |
Date: Thu, 3 Jun 2010 17:59:45 +0200 | |
Subject: [PATCH] homebrew: new unsafe download stategy | |
Use with care, for hosting sites that use broken SSL certificates | |
(one provided) | |
--- | |
Library/Homebrew/download_strategy.rb | 19 +++++++++++++++++++ | |
1 files changed, 19 insertions(+), 0 deletions(-) | |
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb | |
index 6f2dff8..8153463 100644 | |
--- a/Library/Homebrew/download_strategy.rb | |
+++ b/Library/Homebrew/download_strategy.rb | |
@@ -123,6 +123,24 @@ class NoUnzipCurlDownloadStrategy <CurlDownloadStrategy | |
end | |
end | |
+# Use this stategy on broken SSL hosting sites | |
+class CurlUnsafeDownloadStrategy <CurlDownloadStrategy | |
+ def fetch | |
+ ohai "Downloading #{@url}" | |
+ unless @tarball_path.exist? | |
+ begin | |
+ curl @url, '--insecure', '-o', @tarball_path | |
+ rescue Exception | |
+ ignore_interrupts { @tarball_path.unlink if @tarball_path.exist? } | |
+ raise | |
+ end | |
+ else | |
+ puts "File already downloaded and cached to #{HOMEBREW_CACHE}" | |
+ end | |
+ return @tarball_path # thus performs checksum verification | |
+ end | |
+end | |
+ | |
class SubversionDownloadStrategy <AbstractDownloadStrategy | |
def initialize url, name, version, specs | |
super | |
@@ -329,6 +347,7 @@ def detect_download_strategy url | |
when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy | |
when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy | |
when %r[^http://svn.apache.org/repos/] then SubversionDownloadStrategy | |
+ when %r[^https://forge.ocamlcore.org/] then CurlUnsafeDownloadStrategy | |
else CurlDownloadStrategy | |
end | |
end | |
-- | |
1.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment