audit.rb: always fake browser headers when getting appcast (#22811)
This commit is contained in:
parent
c50e5f6aa2
commit
07326d91ca
|
@ -104,7 +104,7 @@ class Hbc::Audit
|
|||
|
||||
def check_appcast_http_code
|
||||
odebug "Verifying appcast returns 200 HTTP response code"
|
||||
result = @command.run("curl", args: ["--compressed", "--location", "--output", "/dev/null", "--write-out", "%{http_code}", cask.appcast], print_stderr: false)
|
||||
result = @command.run("curl", args: ["--compressed", "--location", "--user-agent", Hbc::URL::FAKE_USER_AGENT, "--output", "/dev/null", "--write-out", "%{http_code}", cask.appcast], print_stderr: false)
|
||||
if result.success?
|
||||
http_code = result.stdout.chomp
|
||||
add_warning "unexpected HTTP response code retrieving appcast: #{http_code}" unless http_code == "200"
|
||||
|
@ -115,7 +115,7 @@ class Hbc::Audit
|
|||
|
||||
def check_appcast_checkpoint_accuracy
|
||||
odebug "Verifying appcast checkpoint is accurate"
|
||||
result = @command.run("curl", args: ["--compressed", "--location", cask.appcast], print_stderr: false)
|
||||
result = @command.run("curl", args: ["--compressed", "--location", "--user-agent", Hbc::URL::FAKE_USER_AGENT, cask.appcast], print_stderr: false)
|
||||
if result.success?
|
||||
processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}, "")
|
||||
# This step is necessary to replicate running `sed` from the command line
|
||||
|
|
Loading…
Reference in New Issue