From 3b42acc8c10d95f09792e8b1ab3d237a827e98fa Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 12 Jan 2010 07:48:48 +0000 Subject: * lib/net/http.rb (Net::HTTP.start): options may not be given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/http.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/net/http.rb b/lib/net/http.rb index 31546d3020..3571db1e19 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -471,14 +471,16 @@ module Net #:nodoc: def HTTP.start(address, *arg, &block) # :yield: +http+ arg.pop if opt = Hash.try_convert(arg[-1]) port, p_addr, p_port, p_user, p_pass = *arg - port = https_default_port if opt[:use_ssl] && !port + port = https_default_port if !port && opt && opt[:use_ssl] http = new(address, port, p_addr, p_port, p_user, p_pass) - opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) if opt[:use_ssl] - http.methods.grep(/\A(\w+)=\z/) do |meth| - key = $1.to_sym - opt.key?(key) or next - http.__send__(meth, opt[key]) + if opt + opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) if opt[:use_ssl] + http.methods.grep(/\A(\w+)=\z/) do |meth| + key = $1.to_sym + opt.key?(key) or next + http.__send__(meth, opt[key]) + end end http.start(&block) -- cgit v1.2.3