Merge pull request #17356 from Homebrew/verify-fail-with-body

livecheck/strategy: verify `--fail-with-body` support
This commit is contained in:
Mike McQuaid 2024-05-24 08:29:34 +01:00 committed by GitHub
commit ea5023a4ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -219,7 +219,7 @@ module Homebrew
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?

View File

@ -470,6 +470,13 @@ module Utils
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/")