Merge pull request #8711 from reitermarkus/cloudflare
Check for CloudFlare protection on status code 403.
This commit is contained in:
commit
a47b4b432a
@ -143,9 +143,9 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false,
|
|||||||
|
|
||||||
unless http_status_ok?(details[:status])
|
unless http_status_ok?(details[:status])
|
||||||
# Check if the URL is protected by CloudFlare.
|
# Check if the URL is protected by CloudFlare.
|
||||||
if details[:status].to_i == 503 &&
|
if [403, 503].include?(details[:status].to_i) &&
|
||||||
details[:file].include?("set-cookie: __cfduid=") &&
|
details[:headers].include?("set-cookie: __cfduid=") &&
|
||||||
details[:file].include?("server: cloudflare")
|
details[:headers].include?("server: cloudflare")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -236,6 +236,7 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
|
|||||||
status: status_code,
|
status: status_code,
|
||||||
etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2],
|
etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2],
|
||||||
content_length: headers[/Content-Length: (\d+)/, 1],
|
content_length: headers[/Content-Length: (\d+)/, 1],
|
||||||
|
headers: headers,
|
||||||
file_hash: output_hash,
|
file_hash: output_hash,
|
||||||
file: output,
|
file: output,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user