aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2013-02-07 12:43:22 -0600
committerJack Nagel2013-02-07 12:45:37 -0600
commit38ebb5a4e6284158bc1e7b4f21246aaeaae07591 (patch)
tree3f5bf3e8d4e25d8912d35e6d90396ae678c4adff /Library/Homebrew
parentb34f7727bd4dde2578fc8f1158bd71baf52fd748 (diff)
downloadhomebrew-38ebb5a4e6284158bc1e7b4f21246aaeaae07591.tar.bz2
download_strategy: move requires out of method
This can cause subtle issues when an exception is marshaled between the build process and the main Homebrew process, as the marshaled exception may contain URI objects even when the main Homebrew process has not loaded the URI library. Closes #17642.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/download_strategy.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index faa1b96db..af3e089ad 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -1,3 +1,6 @@
+require 'open-uri'
+require 'vendor/multi_json'
+
class AbstractDownloadStrategy
def initialize name, package
@url = package.url
@@ -153,9 +156,6 @@ end
# Detect and download from Apache Mirror
class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
def _fetch
- require 'open-uri'
- require 'vendor/multi_json'
-
mirrors = MultiJson.decode(open("#{@url}&asjson=1").read)
url = mirrors.fetch('preferred') + mirrors.fetch('path_info')