A timeout assigned after a connection attempt cannot shorten the attempt that already happened. Build the Net::HTTP instance first, set its timeouts, and then start it.

http = Net::HTTP.new('example.com', 443,
                     '203.0.113.10', 8080)
http.use_ssl = true
http.open_timeout = 5
http.read_timeout = 10
http.start do |session|
  response = session.get('/')
end

Choose the intended HTTP endpoint first; the HTTP proxy list offers candidates for permitted public requests. The numbers are example limits, not a recommendation for every workload. Connection setup and subsequent reads have different waits. A read timeout is not an overall deadline for a job that performs several requests or keeps retrying.

Use the timeout documentation for the Ruby version you deploy, including write and TLS-specific settings where relevant. An old example using Net::HTTP::Proxy may construct a proxy-configured class first; the values that matter still belong to the instance doing the work.

ХӀокхунах тера йаззамаш