diff options
| author | Adam Vandenberg | 2010-06-25 19:13:20 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-06-25 19:13:20 -0700 |
| commit | d6f608c23e0dfce9403257da77d02cba8ee5a1ec (patch) | |
| tree | 2a46df7aa93f01a819e5493417ffee5c95f61bc5 /Library | |
| parent | 72d624b7146beaf4a97fff23aad27fd8e97f462c (diff) | |
| download | homebrew-d6f608c23e0dfce9403257da77d02cba8ee5a1ec.tar.bz2 | |
Add a download strategy that uses HTTP POST
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 251fbb4d2..02ca921ba 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -45,11 +45,16 @@ class CurlDownloadStrategy <AbstractDownloadStrategy @tarball_path end + # Private method, can be overridden if needed. + def _fetch + curl @url, '-o', @tarball_path + end + def fetch ohai "Downloading #{@url}" unless @tarball_path.exist? begin - curl @url, '-o', @tarball_path + _fetch rescue Exception ignore_interrupts { @tarball_path.unlink if @tarball_path.exist? } raise @@ -115,6 +120,18 @@ private end end +# Download via an HTTP POST. +class CurlPostDownloadStrategy <CurlDownloadStrategy + def initialize url, name, version, specs + super + end + + def _fetch + base_url,data = @url.split('?') + curl base_url, '-d', data, '-o', @tarball_path + end +end + # Use this strategy to download but not unzip a file. # Useful for installing jars. class NoUnzipCurlDownloadStrategy <CurlDownloadStrategy |
