diff options
| author | Jack Nagel | 2013-08-02 18:18:34 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-08-02 18:25:17 -0500 |
| commit | 26503dacdfa46a15a48d87e6b970e0551e900434 (patch) | |
| tree | c4f9bb4948de16d3a1ddf0243ff40328d5684e99 /Library | |
| parent | e0c4ba120d17e207533c784c9ff5cb5a8995878b (diff) | |
| download | homebrew-26503dacdfa46a15a48d87e6b970e0551e900434.tar.bz2 | |
Always load net/https before referencing related constants
I put this require inside the method body, because eager-loading
net/https is slow compared to the rest of Homebrew, and utils.rb is
loaded for each `brew` invocation.
It's probably worth breaking up global.rb a bit, to reduce the amount of
code we are loading unnecessarily, but hopefully also to make inter-file
dependencies a bit more obvious.
Fixes #21617.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/utils.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index e1f1b6b98..818354993 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -244,6 +244,8 @@ module GitHub extend self Error = Class.new(StandardError) def open url, headers={}, &block + require 'net/https' # for exception classes below + default_headers = {'User-Agent' => HOMEBREW_USER_AGENT} default_headers['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN Kernel.open(url, default_headers.merge(headers), &block) |
