diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http.rb | 8 |
2 files changed, 7 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Wed Aug 10 02:53:27 2011 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/http.rb: come back autoload. OpenSSL constant is used + some places, so it leads mistakes like HTTP.start. + Tue Aug 9 22:57:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com> * ext/date/date_parse.c (date_zone_to_diff): add RB_GC_GUARD. diff --git a/lib/net/http.rb b/lib/net/http.rb index 7c9032aaa6..7b9ec4f568 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -21,6 +21,7 @@ require 'net/protocol' require 'uri' +autoload :OpenSSL, 'openssl' module Net #:nodoc: @@ -666,12 +667,7 @@ module Net #:nodoc: # If you change use_ssl value after session started, # a Net::HTTP object raises IOError. def use_ssl=(flag) - flag = if flag - require 'openssl' unless defined?(OpenSSL) - true - else - false - end + flag = flag ? true : false if started? and @use_ssl != flag raise IOError, "use_ssl value changed, but session already started" end |