lib/nanoc/extra/checking/checks/external_links.rb in nanoc-3.6.1 vs lib/nanoc/extra/checking/checks/external_links.rb in nanoc-3.6.2

- old
+ new

@@ -101,10 +101,13 @@ res = nil 5.times do |i| begin Timeout::timeout(10) do res = request_url_once(url) + if res.code == '405' + res = request_url_once(url, Net::HTTP::Get) + end end rescue => e return Result.new(href, e.message) end @@ -131,12 +134,12 @@ end end raise 'should not have gotten here' end - def request_url_once(url) + def request_url_once(url, req_method = Net::HTTP::Head) path = (url.path.nil? || url.path.empty? ? '/' : url.path) - req = Net::HTTP::Head.new(path) + req = req_method.new(path) 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