1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
naruse 2011-06-06 01:53:41 +00:00
parent 55ea66cb11
commit 80651edad2
2 changed files with 11 additions and 3 deletions

View file

@ -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

View file

@ -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?