When you call get_response
on the Proxy(HTTP) class, you get a Net::HTTPResponse
instance, and it doesn't respond to start
or open_timeout=
.
Use Net::HTTP::Proxy
to create an proxied HTTP class, create an instance of that class, and then modify the timeout settings on that instance. And then you can use the instance to fetch contents from behind a proxy.
proxy_http = Net::HTTP.Proxy(proxy_ip, proxy_port).new(uri.host)
proxy_http.open_timeout = 5
proxy_http.read_timeout = 10
response = proxy_http.get(uri.path)