mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
0d354933c5
commit
3b42acc8c1
2 changed files with 12 additions and 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>
|
Tue Jan 12 16:48:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/readline/readline.c (readline_readline): check if instream
|
* ext/readline/readline.c (readline_readline): check if instream
|
||||||
|
|
|
@ -471,15 +471,17 @@ module Net #:nodoc:
|
||||||
def HTTP.start(address, *arg, &block) # :yield: +http+
|
def HTTP.start(address, *arg, &block) # :yield: +http+
|
||||||
arg.pop if opt = Hash.try_convert(arg[-1])
|
arg.pop if opt = Hash.try_convert(arg[-1])
|
||||||
port, p_addr, p_port, p_user, p_pass = *arg
|
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)
|
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]
|
opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) if opt[:use_ssl]
|
||||||
http.methods.grep(/\A(\w+)=\z/) do |meth|
|
http.methods.grep(/\A(\w+)=\z/) do |meth|
|
||||||
key = $1.to_sym
|
key = $1.to_sym
|
||||||
opt.key?(key) or next
|
opt.key?(key) or next
|
||||||
http.__send__(meth, opt[key])
|
http.__send__(meth, opt[key])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
http.start(&block)
|
http.start(&block)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue