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

R

rpardee

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top