From: Dick Davies Date: 2004-05-05T19:45:16+09:00 Subject: Re: RubyGem behind an authenticating proxy * Mehr, Assaph (Assaph) [0526 00:26]: > > I can't offer any real help; I can only say that RubyGems' proxy > > handling is completely outsourced to 'open-uri'. If you can > > demonstrate a simple app using just that, in which your particular > > proxy works, it would help. > > Why aren't you using 'net/http'? Probably because it doesn't support ftp :) AFAIK, open-uri is a wrapper round net/http anyway? It just means you can replace the below with a simple open(url) generally. It picks up your proxy from the environment too, which is nice. Pity about the authentication, but that sounds like a simple bug/missing feature. > This works for me. > > > require 'net/http' > > # basic location info: > proxy_addr = 'sg.proxy.avaya.com' > proxy_port = 8000 > proxy_user = 'assaph' > proxy_pass = 'xxx' > site = "www.weatherzone.com.au" > uri = "/local/local.jsp?fcast=94768&obs=94768&img=radar&rad=003&fn=true" > > # Get the data and write it to a file > Net::HTTP::Proxy(proxy_addr, proxy_port, proxy_user, > proxy_pass).start(site) { |http| > response = http.get(uri) > File.open("Weather.htm"), "w+") { |f| f.puts response.body } > } -- 1.79 x 10^12 furlongs per fortnight -- it's not just a good idea, it's the law! Rasputin :: Jack of All Trades - Master of Nuns