From 38ebb5a4e6284158bc1e7b4f21246aaeaae07591 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 7 Feb 2013 12:43:22 -0600 Subject: 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. --- Library/Homebrew/download_strategy.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library') 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') -- cgit v1.2.3