Forum: Ruby Cannot access HTTPS

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
59a33b3125d7c10d38c6f5ae136b015b?d=identicon&s=25 Zhi-Qiang Lei (Guest)
on 2013-10-10 13:15
(Received via mailing list)
I used RVM to install Ruby 2.0 on my Mac OS X Mountain Lion. OpenSSL is
installed automatically by RVM before installing Ruby 2.0 (autolibs via
Homebrew). My problem is that 'net/http' cannot request through HTTPS.

Here is my script:
require 'net/http'

uri = URI('')

Net::HTTP.start(, uri.port,
                :use_ssl => uri.scheme == 'https') do |http|
  request = uri

  response = http.request request # Net::HTTPResponse object

puts response

Here is the output by running it:
`connect': undefined method `set_params' for
#<OpenSSL::SSL::SSLContext:0x007ff1ad0acea8> (NoMethodError)
  from Desktop/test.rb:5:in `<main>'

Does anyone have a clue? Thanks.

Zhi-Qiang Lei
Aa082c8b00a50928e5860dcd70bf2368?d=identicon&s=25 tamouse m. (tamouse_m)
on 2013-10-10 18:19
(Received via mailing list)
On Oct 10, 2013, at 6:14 AM, Zhi-Qiang Lei <>

> puts response

Looks like it may be a precedence problem. Try changing to this:

> Net::HTTP.start(, uri.port,
                :use_ssl => (uri.scheme == 'https')) do |http|

It's binding the :use_ssl => uri.scheme first, then doing the compare
77a7ebbce9a694eda5138af13f3a4805?d=identicon&s=25 Samuel Williams (Guest)
on 2013-11-04 05:19
(Received via mailing list)
I had the same problem, and I found just adding `require 'openssl'` at
top of the script fixed the issue. I don't know why though, didn't have
this problem until updating to the latest ruby 2.0 via RVM.
77a7ebbce9a694eda5138af13f3a4805?d=identicon&s=25 Samuel Williams (Guest)
on 2013-11-04 05:24
(Received via mailing list)
Here is an example:

http = Net::HTTP.start('', 443, :use_ssl => true)

NoMethodError: undefined method `set_params' for





from (irb):5

from /Users/samuel/.rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'

2.0.0p247 :006 > require 'openssl'

 => true

2.0.0p247 :007 > http = Net::HTTP.start('', 443, :use_ssl =>

 => #<Net::HTTP open=true>
59a33b3125d7c10d38c6f5ae136b015b?d=identicon&s=25 Zhi-Qiang Lei (Guest)
on 2013-11-04 05:53
(Received via mailing list)
I fixed the problem by reinstalling ruby by RVM.

Zhi-Qiang Lei
This topic is locked and can not be replied to.