diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-13 10:21:07 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-13 10:21:07 +0000 |
commit | 2ba3909c0a55672f541d8be94168ba41e7211ecb (patch) | |
tree | 9aa163445104d1d6a0004d64c739d34874e1b861 /lib | |
parent | 5112c6d1d9021a920a04e914449a81e9ede9a75e (diff) | |
download | ruby-2ba3909c0a55672f541d8be94168ba41e7211ecb.tar.gz |
Additional fix for r31933.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/http.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 2ff6e5524c..36fb418777 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -544,7 +544,6 @@ module Net #:nodoc: if opt if opt[:use_ssl] - require 'openssl' unless defined?(OpenSSL) opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) end http.methods.grep(/\A(\w+)=\z/) do |meth| @@ -657,10 +656,7 @@ module Net #:nodoc: # Returns true if SSL/TLS is being used with HTTP. def use_ssl? - if @use_ssl - require 'openssl' unless defined?(OpenSSL) - true - end + @use_ssl end # Turn on/off SSL. @@ -668,7 +664,12 @@ module Net #:nodoc: # If you change use_ssl value after session started, # a Net::HTTP object raises IOError. def use_ssl=(flag) - flag = (flag ? true : false) + flag = if flag + require 'openssl' unless defined?(OpenSSL) + true + else + false + end if started? and @use_ssl != flag raise IOError, "use_ssl value changed, but session already started" end |