lib/nanoc/checking/checks/external_links.rb in nanoc-4.7.10 vs lib/nanoc/checking/checks/external_links.rb in nanoc-4.7.11
- old
+ new
@@ -67,17 +67,14 @@
timeouts = [3, 5, 10, 30, 60]
5.times do |i|
begin
Timeout.timeout(timeouts[i]) do
res = request_url_once(url)
- if res.code == '405'
- res = request_url_once(url, Net::HTTP::Get)
- end
end
rescue => e
last_err = e
- next # can not allow
+ next
end
if res.code =~ /^3..$/
if i == 4
return Result.new(href, 'too many redirects')
@@ -120,11 +117,11 @@
end
path
end
- def request_url_once(url, req_method = Net::HTTP::Head)
- req = req_method.new(path_for_url(url))
+ def request_url_once(url)
+ req = Net::HTTP::Get.new(path_for_url(url))
http = Net::HTTP.new(url.host, url.port)
if url.instance_of? URI::HTTPS
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end