D
Debaun, Steve
Hi all --
I just joined the list because I saw a post (from way back in 2002) about
using ruby and OpenSSL on win32. I was wondering if anyone has had any
recent successes, and if so, what shenanigans they involved.
I'm having a heck of a time figuring out what my problem here is; I've tried
three different ways to script access to a web page and they're all failing
when tried over https -- which makes me suspect it's a problem with my
openssl; specifically, with what versions I have installed.
Samples follow:
Win32, Ruby 1.8.4p3, OpenSSL 0.9.7b for windows.
Trying to manipulate a web page. They all fail over SSL. Calls using
similar tools to non-SSL pages do not fail.
Three different approaches:
1.
-----
require 'mechanize'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
agent = WWW::Mechanize.new
agent.user_agent_alias = 'Windows IE 6'
p = agent.get($urls[0])
-----
C:\dev>ruby mechtest.rb
warning: peer certificate won't be verified in this SSL session
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.3.1/lib/mechanize/net-overrides/n
et/http.rb:468:in `connect': OpenSSL::SSL::SSLError
2.
-----
require 'open-uri'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
open($urls[0]) { |r|
puts "New Cookie: #{r.set_cookie}"
}
-----
C:\dev>ruby openuritest.rb
c:/ruby/lib/ruby/1.8/open-uri.rb:237:in `open_http': undefined method
`set_default_paths' for #<OpenSSL::X509::Store:0x2c146f0> (NoMethodError)
3.
-----
require 'net/http'
require 'net/https'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
$uris = $urls.inject(Array.new) { |a,x| a << URI.parse(x) }
$uri_form = $uris[0]
http = Net::HTTP.new($uri_form.host, $uri_form.port)
http.use_ssl = true
r,d = http.get($uri_form.path,{})
-----
C:\dev>ruby nethttptest.rb
c:/ruby/lib/ruby/1.8/net/http.rb:565:in `connect': undefined method
`verify_mode' for nil:NilClass (NoMethodError)
This e-mail message may contain privileged and/or confidential information,
and is intended to be received only by persons entitled to receive such
information. If you have received this e-mail in error, please notify the
sender immediately. Please delete it and all attachments from any servers,
hard drives or any other media. Other use of this e-mail by you is strictly
prohibited.
All e-mails and attachments sent and received are subject to monitoring,
reading and archival by Seminis. The recipient of this e-mail is solely
responsible for checking for the presence of "Viruses" or other "Malware".
Seminis accepts no liability for any damage caused by any such code
transmitted by or accompanying this e-mail or any attachment.
I just joined the list because I saw a post (from way back in 2002) about
using ruby and OpenSSL on win32. I was wondering if anyone has had any
recent successes, and if so, what shenanigans they involved.
I'm having a heck of a time figuring out what my problem here is; I've tried
three different ways to script access to a web page and they're all failing
when tried over https -- which makes me suspect it's a problem with my
openssl; specifically, with what versions I have installed.
Samples follow:
Win32, Ruby 1.8.4p3, OpenSSL 0.9.7b for windows.
Trying to manipulate a web page. They all fail over SSL. Calls using
similar tools to non-SSL pages do not fail.
Three different approaches:
1.
-----
require 'mechanize'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
agent = WWW::Mechanize.new
agent.user_agent_alias = 'Windows IE 6'
p = agent.get($urls[0])
-----
C:\dev>ruby mechtest.rb
warning: peer certificate won't be verified in this SSL session
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.3.1/lib/mechanize/net-overrides/n
et/http.rb:468:in `connect': OpenSSL::SSL::SSLError
2.
-----
require 'open-uri'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
open($urls[0]) { |r|
puts "New Cookie: #{r.set_cookie}"
}
-----
C:\dev>ruby openuritest.rb
c:/ruby/lib/ruby/1.8/open-uri.rb:237:in `open_http': undefined method
`set_default_paths' for #<OpenSSL::X509::Store:0x2c146f0> (NoMethodError)
3.
-----
require 'net/http'
require 'net/https'
$urls = [ "https://www112.livemeeting.com/cc/mycompany/loginForm",
"https://www112.livemeeting.com/cc/mycompany/login",
]
$uris = $urls.inject(Array.new) { |a,x| a << URI.parse(x) }
$uri_form = $uris[0]
http = Net::HTTP.new($uri_form.host, $uri_form.port)
http.use_ssl = true
r,d = http.get($uri_form.path,{})
-----
C:\dev>ruby nethttptest.rb
c:/ruby/lib/ruby/1.8/net/http.rb:565:in `connect': undefined method
`verify_mode' for nil:NilClass (NoMethodError)
This e-mail message may contain privileged and/or confidential information,
and is intended to be received only by persons entitled to receive such
information. If you have received this e-mail in error, please notify the
sender immediately. Please delete it and all attachments from any servers,
hard drives or any other media. Other use of this e-mail by you is strictly
prohibited.
All e-mails and attachments sent and received are subject to monitoring,
reading and archival by Seminis. The recipient of this e-mail is solely
responsible for checking for the presence of "Viruses" or other "Malware".
Seminis accepts no liability for any damage caused by any such code
transmitted by or accompanying this e-mail or any attachment.