lib/onebox/helpers.rb in onebox-1.8.6 vs lib/onebox/helpers.rb in onebox-1.8.7
- old
+ new
@@ -17,9 +17,12 @@
def self.clean(html)
html.gsub(/<[^>]+>/, ' ').gsub(/\n/, '')
end
def self.fetch_response(location, limit=5, domain=nil, headers=nil)
+
+ limit = Onebox.options.redirect_limit if limit > Onebox.options.redirect_limit
+
raise Net::HTTPError.new('HTTP redirect too deep', location) if limit == 0
uri = URI(location)
uri = URI("#{domain}#{location}") if !uri.host