Skip to content

Commit

Permalink
Merge pull request Homebrew#17356 from Homebrew/verify-fail-with-body
Browse files Browse the repository at this point in the history
livecheck/strategy: verify `--fail-with-body` support
  • Loading branch information
MikeMcQuaid authored May 24, 2024
2 parents ff950e6 + 07e69b0 commit ea5023a
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")
end
@curl_supports_fail_with_body[curl_path]
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 ea5023a

Please sign in to comment.