# File lib/standard/facets/net/http.rb, line 13 def self.download(url, limit = nil) limit ||= 10 raise ArgumentError, 'HTTP redirect too deep' if limit.zero? resp = Net::HTTP.get_response(URI.parse(url)) case resp when Net::HTTPSuccess then resp when Net::HTTPRedirection then download(resp['location'], limit - 1) else resp.error! end end