diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-06 01:53:41 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-06 01:53:41 +0000 |
commit | 80651edad291d40efc2cd7d3fd92d1e1e188956e (patch) | |
tree | 05587a7709d1ca96db825a8d6bab0f99776256ef | |
parent | 55ea66cb11e7b4181bd51a3bd176a73a32d7ace3 (diff) | |
download | ruby-80651edad291d40efc2cd7d3fd92d1e1e188956e.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/net/http.rb | 10 |
2 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Mon Jun 6 10:52:13 2011 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/http.rb: don't use autoload. + Mon Jun 6 09:39:43 2011 Aaron Patterson <aaron@tenderlovemaking.com> * 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? |