Retry curl_headers
on 400 codes.
This commit is contained in:
parent
e493d0cb04
commit
4b787fdee2
@ -216,10 +216,15 @@ module Utils
|
|||||||
if result.success? || result.exit_status == 22
|
if result.success? || result.exit_status == 22
|
||||||
parsed_output = parse_curl_output(result.stdout)
|
parsed_output = parse_curl_output(result.stdout)
|
||||||
|
|
||||||
|
if request_args.empty?
|
||||||
# If we didn't get any wanted header yet, retry using `GET`.
|
# If we didn't get any wanted header yet, retry using `GET`.
|
||||||
next if request_args.empty? && wanted_headers.any? &&
|
next if wanted_headers.any? &&
|
||||||
parsed_output.fetch(:responses).none? { |r| (r.fetch(:headers).keys & wanted_headers).any? }
|
parsed_output.fetch(:responses).none? { |r| (r.fetch(:headers).keys & wanted_headers).any? }
|
||||||
|
|
||||||
|
# Some CDNs respond with 400 codes for `HEAD` but resolve with `GET`.
|
||||||
|
next if (400..499).cover?(parsed_output.fetch(:responses).last&.fetch(:status_code).to_i)
|
||||||
|
end
|
||||||
|
|
||||||
return parsed_output if result.success?
|
return parsed_output if result.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user