mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
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 Homebrew/homebrew#17642.
This commit is contained in:
parent
7fbeb0df3d
commit
ef6d01fc8f
@ -1,3 +1,6 @@
|
|||||||
|
require 'open-uri'
|
||||||
|
require 'vendor/multi_json'
|
||||||
|
|
||||||
class AbstractDownloadStrategy
|
class AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, package
|
||||||
@url = package.url
|
@url = package.url
|
||||||
@ -153,9 +156,6 @@ end
|
|||||||
# Detect and download from Apache Mirror
|
# Detect and download from Apache Mirror
|
||||||
class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
|
class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
|
||||||
def _fetch
|
def _fetch
|
||||||
require 'open-uri'
|
|
||||||
require 'vendor/multi_json'
|
|
||||||
|
|
||||||
mirrors = MultiJson.decode(open("#{@url}&asjson=1").read)
|
mirrors = MultiJson.decode(open("#{@url}&asjson=1").read)
|
||||||
url = mirrors.fetch('preferred') + mirrors.fetch('path_info')
|
url = mirrors.fetch('preferred') + mirrors.fetch('path_info')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user