mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
api: use Utils::Curl.curl_args
This sets user-agent nicely and avoids some duplication.
This commit is contained in:
parent
ec9bb2fe68
commit
d5a1f3e02c
@ -48,15 +48,11 @@ module Homebrew
|
|||||||
odie "Need to download #{url} but cannot as root! Run `brew update` without `sudo` first then try again."
|
odie "Need to download #{url} but cannot as root! Run `brew update` without `sudo` first then try again."
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: consider using more of Utils::Curl
|
curl_args = Utils::Curl.curl_args + %W[
|
||||||
curl_args = %W[
|
|
||||||
--compressed
|
--compressed
|
||||||
--speed-limit #{ENV.fetch("HOMEBREW_CURL_SPEED_LIMIT")}
|
--speed-limit #{ENV.fetch("HOMEBREW_CURL_SPEED_LIMIT")}
|
||||||
--speed-time #{ENV.fetch("HOMEBREW_CURL_SPEED_TIME")}
|
--speed-time #{ENV.fetch("HOMEBREW_CURL_SPEED_TIME")}
|
||||||
]
|
]
|
||||||
curl_args << "--progress-bar" unless Context.current.verbose?
|
|
||||||
curl_args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
|
|
||||||
curl_args << "--silent" if !$stdout.tty? || Context.current.quiet?
|
|
||||||
|
|
||||||
insecure_download = (ENV["HOMEBREW_SYSTEM_CA_CERTIFICATES_TOO_OLD"].present? ||
|
insecure_download = (ENV["HOMEBREW_SYSTEM_CA_CERTIFICATES_TOO_OLD"].present? ||
|
||||||
ENV["HOMEBREW_FORCE_BREWED_CA_CERTIFICATES"].present?) &&
|
ENV["HOMEBREW_FORCE_BREWED_CA_CERTIFICATES"].present?) &&
|
||||||
|
@ -106,7 +106,7 @@ module Utils
|
|||||||
args << "--fail"
|
args << "--fail"
|
||||||
args << "--progress-bar" unless Context.current.verbose?
|
args << "--progress-bar" unless Context.current.verbose?
|
||||||
args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
|
args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
|
||||||
args << "--silent" unless $stdout.tty?
|
args << "--silent" if !$stdout.tty? || Context.current.quiet?
|
||||||
end
|
end
|
||||||
|
|
||||||
args << "--connect-timeout" << connect_timeout.round(3) if connect_timeout.present?
|
args << "--connect-timeout" << connect_timeout.round(3) if connect_timeout.present?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user