Skip to content

Commit

Permalink
livecheck/strategy: verify fail-with-body support
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFromCanada committed May 23, 2024
1 parent c5fba87 commit 07e69b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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 @@ def curl_http_content_headers_and_checksum(
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

0 comments on commit 07e69b0

Please # to comment.