From: Robert Citek Date: 2007-12-21T12:52:21+09:00 Subject: Re: connecting via a proxy On Dec 20, 2007 6:22 PM, Daniel Sheppard wrote: > > 1) in the example below, is our corporate firewall the reason > > I for the error? > > 2) if so, how can I configure ruby to use the firewall > > specified in http_proxy? > > 1) Probably > 2) Look at the documentation for the Net::HTTP library - there's a proxy > example there. Thanks for the hints. Specifically, this is the link I looked at: http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html To demonstrate that I can get the proxy to work, I picked google as a simple example. Here's what I can do with elinks and with the http_proxy environment variable set: $ elinks -source http://www.google.com | wc 2 173 5212 With ruby this code works: $ ruby -r'net/http' -e ' proxy_addr = "www-gw32" ; proxy_port = 3128 ; res=Net::HTTP::Proxy(proxy_addr, proxy_port).start("www.google.com") {|http| http.get("/"); } puts res.body ; ' | wc 3 173 5213 While I understand that example (mostly), I don't understand how to wrap that around my existing code. Outside of the proxy, this works just fine: ruby -rbio -e 'reg = Bio::Registry.new' When I'm behind the proxy, how can I tell Bio::Registry to use the proxy connection? Regards, - Robert