想使用Net::HTTP的代理功能访问网页,代码如下
require 'net/http'
proxy_addr = '12.161.250.205'
proxy_port = 1080
url = URI.parse('http://www.iteye.com')
res = Net::HTTP::Proxy(proxy_addr , proxy_port ).start(url.host, url.port) {|http|
http.get('/')
}
结果报错如下:
c:/ruby/lib/ruby/1.8/net/protocol.rb:135:in `sysread': end of file reached (EOFE
rror)
from c:/ruby/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
from c:/ruby/lib/ruby/1.8/timeout.rb:62:in `timeout'
from c:/ruby/lib/ruby/1.8/timeout.rb:93:in `timeout'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from c:/ruby/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
from c:/ruby/lib/ruby/1.8/net/http.rb:2009:in `read_new'
from c:/ruby/lib/ruby/1.8/net/http.rb:1050:in `request'
from c:/ruby/lib/ruby/1.8/net/http.rb:772:in `get'
from web1.rb:22
from c:/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
from c:/ruby/lib/ruby/1.8/net/http.rb:440:in `start'
from web1.rb:21
Thanks in Advance
相关推荐
[ NoFuserEx - v1.1 ] ...If something doesn't work properly, you can notify me or fix it yourself. This is an open-source, if you paid for this, you got ripped off :P Press any key to exit...
It doesn't magically circumvent any browser content policy restrictions either, so rendering cross-origin content will require a proxy to get the content to the same origin. The script is still in a...
] Sorry that HTTP proxy support wasn‘t added in this release, it‘s impossible due to blocking sockets architecture, but ICQ HTTP PROXY protocol has been discovered and parsed (for developers: see ...
Currently, [PATH=] and [HOST=] sections only work under ; CGI/FastCGI. ; http://php.net/ini.sections ; Directives are specified using the following syntax: ; directive = value ; Directive names are ...
* When TDropFileTarget.GetDataOnEnter is set to True, the component doesn't work with WinZip. Although the file names are received correctly by TDropFileTarget, WinZip doesn't extract the files and...
Third, if ISPs decide to charge more money to highly profitable content providers (in countries where net neutrality doesn't apply), the content providers can avoid these extra payments. 16. The ...
Here is the direct URL at Amazon UK (nearest to my home, please don't use another): http://www.amazon.co.uk/exec/obidos/gc-email-order1/ref=g_gc_email/202-6198323-6681414 For more generous amount, ...
这个问题的出现是因为Babel默认只转换新的JavaScript句法(syntax),而不转换新的API,例如Iterator、Generator、Set、Maps、Proxy、Reflect、Symbol、Promise等全局对象,以及一些定义在全局对象上的方法(比如...
console.error('Your browser doesn\'t seem to support WebRTC'); } // set options for (item in options) { this.config[item] = options[item]; } // log if configured to if (this.config.log) ...