【发布时间】:2013-06-01 03:44:10
【问题描述】:
我正在尝试通过一些代理服务器访问一些内容,但我得到了:
<Errno::ETIMEDOUT: Connection timed out - connect(2)>
我修改了代码并尝试增加超时时间如下:
require 'open-uri'
require 'net/http'
response = Net::HTTP::Proxy(proxy_ip, proxy_port).get_response(uri.host, uri.path)
response.start(uri.host) do |http|
http.open_timeout = 5
http.read_timeout = 10
end
现在它无法识别open_timeout 和start
undefined method `open_timeout=' for #<Net::HTTPOK 200 OK readbody=true>>
undefined method `start..
有什么帮助吗?
【问题讨论】:
标签: ruby-on-rails ruby proxy net-http