我試圖訪問一個使用Net :: HTTP :: Proxy的QA環境網站來獲取響應。但是當我嘗試訪問時,我總是收到SocketError連接。請找到我正在嘗試使用的代碼段。通過代理使用net :: HTTP代理在ruby中訪問網站
proxy_addr = "http://autoproxy1.qa.com"
proxy_class = Net::HTTP::Proxy(proxy_addr,80).start("mywebsite.com")
這是我得到
SocketError: getaddrinfo: Name or service not known
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:581:in `initialize'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:581:in `open'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:581:in `block in connect'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/timeout.rb:82:in `timeout'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:581:in `connect'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:574:in `do_start'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:569:in `start'
from /site/ruby/ruby-1.9.1-4/lib/ruby/1.9.1/net/http.rb:453:in `start'
from (irb):6
from /site/ruby/ruby-1.9.1-4/bin/irb:12:in `<main>'
錯誤我能夠通過配置瀏覽器的自動代理設置訪問使用硒同一個網站。但我需要通過Net :: HTTP獲得它的響應。請讓我知道是否有其他方式。