Merge pull request #8612 from reitermarkus/audit-cloudflare-protection

Ignore URLs protected by CloudFlare when auditing.
This commit is contained in:
Markus Reiter 2020-09-06 00:25:59 +02:00 committed by GitHub
commit 9e0a26a2fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,13 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false,
end end
unless http_status_ok?(details[:status]) unless http_status_ok?(details[:status])
# Check if the URL is protected by CloudFlare.
if details[:status].to_i == 503 &&
details[:file].include?("set-cookie: __cfduid=") &&
details[:file].include?("server: cloudflare")
return
end
return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" return "The URL #{url} is not reachable (HTTP status code #{details[:status]})"
end end