diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 95bb32c40a..9c35b36523 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -21,7 +21,7 @@ module Utils @curl end - def curl_args(*extra_args, show_output: false, user_agent: :default) + def curl_args(*extra_args, **options) args = [] # do not load .curlrc unless requested (must be the first argument) @@ -31,25 +31,25 @@ module Utils args << "--show-error" - args << "--user-agent" << case user_agent + args << "--user-agent" << case options[:user_agent] when :browser, :fake HOMEBREW_USER_AGENT_FAKE_SAFARI - when :default + when :default, nil HOMEBREW_USER_AGENT_CURL - else - user_agent + when String + options[:user_agent] end args << "--header" << "Accept-Language: en" - unless show_output + unless options[:show_output] == true args << "--fail" args << "--progress-bar" unless Context.current.verbose? args << "--verbose" if Homebrew::EnvConfig.curl_verbose? args << "--silent" unless $stdout.tty? end - args << "--retry" << Homebrew::EnvConfig.curl_retries + args << "--retry" << Homebrew::EnvConfig.curl_retries unless options[:retry] == false args + extra_args end