Nuby: using net/http*s* from behind a proxy server

Hey All,

I've had reasonable luck using net/http from behind a proxy server
here at work, but now I need to draw down SSL-encrypted pages via
https. Here's my latest, unsuccessful attempt:

# -------------------------------
require "uri"
require "net/https"

uri = URI.parse("https://appliedresearch.cancer.gov/crnportal/
directory")

ghc_proxy = Net::HTTP.Proxy(PROXYSERVER, PROXYPORT)

ghc_proxy.start(uri.host, uri.port) do |sess|
   sess.use_ssl = true
   puts("in block")
end
# -------------------------------

That gets me one of these here:

c:/ruby/lib/ruby/1.8/net/https.rb:121:in `use_ssl=': use_ssl value
changed, but session already started (IOError)

If I try to call .use_ssl= on my ghc_proxy object, I get:

undefined method `use_ssl=' for #<Class:0x2b3b030> (NoMethodError)

(Bonus question: shouldn't ghc_proxy be an instance of Net::HTTP, and
not Class, as seems to be indicated by that message?)

Can anybody give me a hint on this? I'm using ruby 1.8.6 on windows.

Thanks!

-Roy

could you solve this problem?

···

--
Posted via http://www.ruby-forum.com/.