switch to httparty

This commit is contained in:
r888888888
2017-06-29 17:10:07 -07:00
parent ed7b80c016
commit eb6c5e3af5
16 changed files with 108 additions and 182 deletions

View File

@@ -21,23 +21,12 @@ module Downloads
protected
def http_head_request(url, headers)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == "https"
http.use_ssl = true
end
http.request_head(uri.request_uri, headers) do |res|
return res
end
HTTParty.head(url, headers: headers)
end
def http_exists?(url, headers)
exists = false
res = http_head_request(url, headers)
if res.is_a?(Net::HTTPSuccess)
exists = true
end
exists
res.success?
end
end
end