switch to httparty
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user