lib/onebox/engine/standard_embed.rb in onebox-1.2.6 vs lib/onebox/engine/standard_embed.rb in onebox-1.2.7

- old
+ new

@@ -32,10 +32,15 @@ private def fetch_response(location, limit = 3) raise Net::HTTPError.new('HTTP redirect too deep', location) if limit == 0 - response = Net::HTTP.get_response(URI(location)) + uri = URI(location) + http = Net::HTTP.new(uri.host, uri.port) + http.open_timeout = Onebox.options.connect_timeout + http.read_timeout = Onebox.options.timeout + response = http.request_get(uri.request_uri) + case response when Net::HTTPSuccess then response when Net::HTTPRedirection then fetch_response(response['location'], limit - 1) else response.error!