A platform for community discussion. Free, open, simple.
SECURITY: ensures timeouts are correctly used on connect (#13455)
Joffrey JAFFEUXe50b7e911128
diff --git a/lib/final_destination.rb b/lib/final_destination.rbindex 348a44f4297..2cc9b5c305d 100644--- a/lib/final_destination.rb+++ b/lib/final_destination.rb@@ -196,6 +196,7 @@ class FinalDestinationresponse = Excon.public_send(@http_verb,@uri.to_s,read_timeout: timeout,+ connect_timeout: timeout,headers: headers,middlewares: middlewares)diff --git a/lib/onebox/helpers.rb b/lib/onebox/helpers.rbindex a3df3f2a042..6b8f4d3f251 100644--- a/lib/onebox/helpers.rb+++ b/lib/onebox/helpers.rb@@ -63,8 +63,7 @@ module Oneboxendresult = StringIO.new- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.normalized_scheme == 'https') do |http|- http.open_timeout = Onebox.options.connect_timeout+ Net::HTTP.start(uri.host, uri.port, open_timeout: Onebox.options.connect_timeout, use_ssl: uri.normalized_scheme == 'https') do |http|http.read_timeout = Onebox.options.timeouthttp.verify_mode = OpenSSL::SSL::VERIFY_NONE # Work around path building bugs@@ -118,8 +117,7 @@ module Oneboxdef self.fetch_content_length(location)uri = URI(location)- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.is_a?(URI::HTTPS)) do |http|- http.open_timeout = Onebox.options.connect_timeout+ Net::HTTP.start(uri.host, uri.port, open_timeout: Onebox.options.connect_timeout, use_ssl: uri.is_a?(URI::HTTPS)) do |http|http.read_timeout = Onebox.options.timeoutif uri.is_a?(URI::HTTPS)http.use_ssl = truediff --git a/lib/oneboxer.rb b/lib/oneboxer.rbindex 4a7461f871b..a1d1817d11f 100644--- a/lib/oneboxer.rb+++ b/lib/oneboxer.rb@@ -407,7 +407,8 @@ module Oneboxerignore_hostnames: blocked_domains,force_get_hosts: force_get_hosts,force_custom_user_agent_hosts: force_custom_user_agent_hosts,- preserve_fragment_url_hosts: preserve_fragment_url_hosts+ preserve_fragment_url_hosts: preserve_fragment_url_hosts,+ timeout: 5}if strategy && Oneboxer.strategies[strategy][:force_get_host]