[前][次][番号順一覧][スレッド一覧]

ruby-changes:20851

From: naruse <ko1@a...>
Date: Wed, 10 Aug 2011 02:58:18 +0900 (JST)
Subject: [ruby-changes:20851] naruse:r32899 (trunk): * lib/net/http.rb: come back autoload. OpenSSL constant is used

naruse	2011-08-10 02:56:40 +0900 (Wed, 10 Aug 2011)

  New Revision: 32899

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32899

  Log:
    * lib/net/http.rb: come back autoload. OpenSSL constant is used
      some places, so it leads mistakes like HTTP.start.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32898)
+++ ChangeLog	(revision 32899)
@@ -1,3 +1,8 @@
+Wed Aug 10 02:53:27 2011  NARUSE, Yui  <naruse@r...>
+
+	* 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@g...>
 
 	* ext/date/date_parse.c (date_zone_to_diff): add RB_GC_GUARD.
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb	(revision 32898)
+++ lib/net/http.rb	(revision 32899)
@@ -21,6 +21,7 @@
 
 require 'net/protocol'
 require 'uri'
+autoload :OpenSSL, 'openssl'
 
 module Net   #:nodoc:
 
@@ -666,12 +667,7 @@
     # 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]