summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-06 01:53:41 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-06 01:53:41 +0000
commit80651edad291d40efc2cd7d3fd92d1e1e188956e (patch)
tree05587a7709d1ca96db825a8d6bab0f99776256ef /lib/net/http.rb
parent55ea66cb11e7b4181bd51a3bd176a73a32d7ace3 (diff)
* 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
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb10
1 files changed, 7 insertions, 3 deletions
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?