Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livecheck/strategy: verify --fail-with-body support #17356

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/livecheck/strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def self.page_content(url, homebrew_curl: false)
stdout, stderr, status = curl_output(
*PAGE_CONTENT_CURL_ARGS, url,
**DEFAULT_CURL_OPTIONS,
use_homebrew_curl: homebrew_curl,
use_homebrew_curl: homebrew_curl || !curl_supports_fail_with_body?,
user_agent:
)
next unless status.success?
Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/utils/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@
T.must(file).unlink
end

def curl_supports_fail_with_body?
@curl_supports_fail_with_body ||= Hash.new do |h, key|
h[key] = Version.new(curl_output("-V").stdout[/curl (\d+(\.\d+)+)/, 1]) >= Version.new("7.76.0")

Check warning on line 475 in Library/Homebrew/utils/curl.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/curl.rb#L474-L475

Added lines #L474 - L475 were not covered by tests
end
@curl_supports_fail_with_body[curl_path]

Check warning on line 477 in Library/Homebrew/utils/curl.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/curl.rb#L477

Added line #L477 was not covered by tests
end

def curl_supports_tls13?
@curl_supports_tls13 ||= Hash.new do |h, key|
h[key] = quiet_system(curl_executable, "--tlsv1.3", "--head", "https://brew.sh/")
Expand Down
Loading