From be418d81e650e269e50597175c8aa725b2025457 Mon Sep 17 00:00:00 2001 From: mavenor Date: Sat, 24 Feb 2024 00:19:24 +0530 Subject: [PATCH 1/2] Strategy#page_content: allow cURL to `--fail-with-body` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since `curl_output` (introduced in #15351) sets `show_output: true`, it doesn’t let it unless some form of --fail[...] is passed explicitly --- Library/Homebrew/livecheck/strategy.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index 1fd2c556ec..72500a9584 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -58,6 +58,9 @@ module Homebrew # `curl` arguments used in `Strategy#page_content` method. PAGE_CONTENT_CURL_ARGS = ([ "--compressed", + # Allow the return of an error code on exit, so that we can retry + # with a fake UA string (e.g. for Cloudflare-protected sites) + "--fail-with-body", # Include HTTP response headers in output, so we can identify the # final URL after any redirections "--include", From cf43d53ddce094de69f349e65f48e5b291368c49 Mon Sep 17 00:00:00 2001 From: Shreedhar Hegde Date: Sun, 25 Feb 2024 02:30:33 +0530 Subject: [PATCH 2/2] strategy#page_content: align comments to future intentions @samford is working on the ability to specify custom UA (among other things) in livecheck blocks; "retrying" will cease to be relevant Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> --- Library/Homebrew/livecheck/strategy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index 72500a9584..ea4a475901 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -58,8 +58,8 @@ module Homebrew # `curl` arguments used in `Strategy#page_content` method. PAGE_CONTENT_CURL_ARGS = ([ "--compressed", - # Allow the return of an error code on exit, so that we can retry - # with a fake UA string (e.g. for Cloudflare-protected sites) + # Return an error when the HTTP response code is 400 or greater but + # continue to return body content "--fail-with-body", # Include HTTP response headers in output, so we can identify the # final URL after any redirections