Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Paul Taylor
RE: SSL w/ Basic Authentication via Proxy [ reply ]  
2007-04-12 13:49

Sorry - I had never used the Proxy method before, and thought that this was something you added...

Thanks

By: Justin Bailey
RE: SSL w/ Basic Authentication via Proxy [ reply ]  
2007-04-11 21:08
I don't think it's supported, sadly. Also this doesn't seem to be related to RubySSPI in any way - you might have better luck emailing the ruby-talk mailing list.

Justin

By: Paul Taylor
SSL w/ Basic Authentication via Proxy [ reply ]  
2007-04-11 20:59
Hi,

I have the following snippet of code that works with the WinSock proxy client:

uri = URI.parse("https://"; + ip_addr +"/")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |http|
request = Net::HTTP::Get.new('/Info.live.htm')
request.basic_auth 'username', 'password'
response = http.request(request)
response.value
puts response.body
end

My issue is that I need to do a batch of these (about 15) and each one takes about 15 seconds through WinSock. By using IE configured for the ISA server, that drops to about 2 seconds each. Since speed is important (I'd like to run this a few minutes apart at the most), I sought out a way to use the proxy directly. Ideally, I'd like to do this with the Proxy class, like so:

http = Net::HTTP.Proxy(proxy.host, proxy.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start(ip_addr) do |http|
request = Net::HTTP::Get.new('/Info.live.htm')
request.basic_auth 'username', 'password'
response = http.request(request)
response.value
puts response.body
end

Unfortunately, this fails because use_ssl and verify_mode are undefined methods of the Proxy class. If I comment out those line, I get this:

D:/InstantRails/ruby/lib/ruby/1.8/net/http.rb:2065:in `error!': 502 "Proxy Error ( Connection refused )" (Net::HTTPFatalError)

Which I would expect, since port 80 isn't open on the destination server.

Am I missing something, or can you currently not do SSL with this?

Thanks,
Paul