mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Rename curl_head
to curl_headers
.
This commit is contained in:
parent
545a332fef
commit
353818f508
@ -473,7 +473,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
|
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
|
||||||
end
|
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) }
|
parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) }
|
||||||
|
|
||||||
final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url)
|
final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url)
|
||||||
|
@ -182,7 +182,7 @@ module Homebrew
|
|||||||
headers = []
|
headers = []
|
||||||
|
|
||||||
[:default, :browser].each do |user_agent|
|
[:default, :browser].each do |user_agent|
|
||||||
output, _, status = curl_head(
|
output, _, status = curl_headers(
|
||||||
url,
|
url,
|
||||||
wanted_headers: ["location", "content-disposition"],
|
wanted_headers: ["location", "content-disposition"],
|
||||||
use_homebrew_curl: homebrew_curl,
|
use_homebrew_curl: homebrew_curl,
|
||||||
|
@ -12,7 +12,7 @@ describe CurlDownloadStrategy do
|
|||||||
let(:artifact_domain) { nil }
|
let(:artifact_domain) { nil }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(strategy).to receive(:curl_head).and_return({ responses: [{ headers: {} }] })
|
allow(strategy).to receive(:curl_headers).and_return({ responses: [{ headers: {} }] })
|
||||||
end
|
end
|
||||||
|
|
||||||
it "parses the opts and sets the corresponding args" do
|
it "parses the opts and sets the corresponding args" do
|
||||||
|
@ -205,7 +205,7 @@ module Utils
|
|||||||
curl_with_workarounds(*args, print_stderr: false, show_output: true, **options)
|
curl_with_workarounds(*args, print_stderr: false, show_output: true, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_head(*args, wanted_headers: [], **options)
|
def curl_headers(*args, wanted_headers: [], **options)
|
||||||
[[], ["--request", "GET"]].each do |request_args|
|
[[], ["--request", "GET"]].each do |request_args|
|
||||||
result = curl_output(
|
result = curl_output(
|
||||||
"--fail", "--location", "--silent", "--head", *request_args, *args,
|
"--fail", "--location", "--silent", "--head", *request_args, *args,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user