From 80651edad291d40efc2cd7d3fd92d1e1e188956e Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 6 Jun 2011 01:53:41 +0000 Subject: * lib/net/http.rb: don't use autoload. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ lib/net/http.rb | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a95d7ca66f..eddc448b55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jun 6 10:52:13 2011 NARUSE, Yui + + * lib/net/http.rb: don't use autoload. + Mon Jun 6 09:39:43 2011 Aaron Patterson * ext/psych/parser.c (parse): release event objects to plug memory diff --git a/lib/net/http.rb b/lib/net/http.rb index 9a99338d50..d3be00036b 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -20,9 +20,7 @@ # require 'net/protocol' -autoload :OpenSSL, 'openssl' require 'uri' -autoload :SecureRandom, 'securerandom' module Net #:nodoc: @@ -545,7 +543,10 @@ module Net #:nodoc: http = new(address, port, p_addr, p_port, p_user, p_pass) if opt - opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) if opt[:use_ssl] + 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| key = $1.to_sym opt.key?(key) or next @@ -656,6 +657,7 @@ module Net #:nodoc: # Returns true if SSL/TLS is being used with HTTP. def use_ssl? + require 'openssl' unless defined?(OpenSSL) @use_ssl end @@ -1961,6 +1963,7 @@ module Net #:nodoc: end opt = @form_option.dup + require 'securerandom' unless defined?(SecureRandom) opt[:boundary] ||= SecureRandom.urlsafe_base64(40) self.set_content_type(self.content_type, boundary: opt[:boundary]) if chunked? @@ -1981,6 +1984,7 @@ module Net #:nodoc: def encode_multipart_form_data(out, params, opt) charset = opt[:charset] boundary = opt[:boundary] + require 'securerandom' unless defined?(SecureRandom) boundary ||= SecureRandom.urlsafe_base64(40) chunked_p = chunked? -- cgit v1.2.3