lib/onebox/helpers.rb in onebox-1.8.7 vs lib/onebox/helpers.rb in onebox-1.8.8

- old
+ new

@@ -34,9 +34,15 @@ if uri.is_a?(URI::HTTPS) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE end + headers ||= {} + + if Onebox.options.user_agent && !headers['User-Agent'] + headers['User-Agent'] = Onebox.options.user_agent + end + request = Net::HTTP::Get.new(uri.request_uri, headers) start_time = Time.now size_bytes = Onebox.options.max_download_kb * 1024 http.request(request) do |response|