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])
|
||||
# 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")
|
||||
if [403, 503].include?(details[:status].to_i) &&
|
||||
details[:headers].include?("set-cookie: __cfduid=") &&
|
||||
details[:headers].include?("server: cloudflare")
|
||||
return
|
||||
end
|
||||
|
||||
@ -236,6 +236,7 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
|
||||
status: status_code,
|
||||
etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2],
|
||||
content_length: headers[/Content-Length: (\d+)/, 1],
|
||||
headers: headers,
|
||||
file_hash: output_hash,
|
||||
file: output,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user