diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/net/http.rb | 14 |
2 files changed, 12 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Tue Jan 12 16:48:46 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/net/http.rb (Net::HTTP.start): options may not be given. + Tue Jan 12 16:48:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/readline/readline.c (readline_readline): check if instream 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) |