diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index a49b47e709..2b2797d620 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -473,7 +473,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/") end - parsed_output = curl_head(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout) + parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout) parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) } final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index 8ac14dd951..72df2f4934 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -182,7 +182,7 @@ module Homebrew headers = [] [:default, :browser].each do |user_agent| - output, _, status = curl_head( + output, _, status = curl_headers( url, wanted_headers: ["location", "content-disposition"], use_homebrew_curl: homebrew_curl, diff --git a/Library/Homebrew/test/download_strategies/curl_spec.rb b/Library/Homebrew/test/download_strategies/curl_spec.rb index fc3dfb1df7..106eaf93bf 100644 --- a/Library/Homebrew/test/download_strategies/curl_spec.rb +++ b/Library/Homebrew/test/download_strategies/curl_spec.rb @@ -12,7 +12,7 @@ describe CurlDownloadStrategy do let(:artifact_domain) { nil } before do - allow(strategy).to receive(:curl_head).and_return({ responses: [{ headers: {} }] }) + allow(strategy).to receive(:curl_headers).and_return({ responses: [{ headers: {} }] }) end it "parses the opts and sets the corresponding args" do diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 4a6ca0cedd..4b2d3b227f 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -205,7 +205,7 @@ module Utils curl_with_workarounds(*args, print_stderr: false, show_output: true, **options) end - def curl_head(*args, wanted_headers: [], **options) + def curl_headers(*args, wanted_headers: [], **options) [[], ["--request", "GET"]].each do |request_args| result = curl_output( "--fail", "--location", "--silent", "--head", *request_args, *args,