зеркало из https://github.com/github/ruby.git
Net::HTTP#start now pass :ENV to p_addr by default [Bug #13351]
To avoid this, pass nil explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0183613bf9
Коммит
67723c1e46
4
NEWS
4
NEWS
|
@ -86,6 +86,10 @@ with all sufficient information, see the ChangeLog file or Redmine
|
|||
|
||||
=== Compatibility issues (excluding feature bug fixes)
|
||||
|
||||
* Net::HTTP
|
||||
* Net::HTTP#start now pass :ENV to p_addr by default. [Bug #13351]
|
||||
To avoid this, pass nil explicitly.
|
||||
|
||||
* Random.raw_seed renamed to become Random.urandom. It is now
|
||||
applicable to non-seeding purposes due to [Bug #9569].
|
||||
|
||||
|
|
|
@ -560,7 +560,7 @@ module Net #:nodoc:
|
|||
|
||||
# :call-seq:
|
||||
# HTTP.start(address, port, p_addr, p_port, p_user, p_pass, &block)
|
||||
# HTTP.start(address, port=nil, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt, &block)
|
||||
# HTTP.start(address, port=nil, p_addr=:ENV, p_port=nil, p_user=nil, p_pass=nil, opt, &block)
|
||||
#
|
||||
# Creates a new Net::HTTP object, then additionally opens the TCP
|
||||
# connection and HTTP session.
|
||||
|
@ -591,6 +591,7 @@ 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
|
||||
p_addr = :ENV if arg.size < 2
|
||||
port = https_default_port if !port && opt && opt[:use_ssl]
|
||||
http = new(address, port, p_addr, p_port, p_user, p_pass)
|
||||
|
||||
|
|
|
@ -233,6 +233,23 @@ end
|
|||
|
||||
module TestNetHTTP_version_1_1_methods
|
||||
|
||||
def test_s_start
|
||||
h = Net::HTTP.start(config('host'), config('port'))
|
||||
assert_equal config('host'), h.address
|
||||
assert_equal config('port'), h.port
|
||||
assert_equal true, h.instance_variable_get(:@proxy_from_env)
|
||||
|
||||
h = Net::HTTP.start(config('host'), config('port'), :ENV)
|
||||
assert_equal config('host'), h.address
|
||||
assert_equal config('port'), h.port
|
||||
assert_equal true, h.instance_variable_get(:@proxy_from_env)
|
||||
|
||||
h = Net::HTTP.start(config('host'), config('port'), nil)
|
||||
assert_equal config('host'), h.address
|
||||
assert_equal config('port'), h.port
|
||||
assert_equal false, h.instance_variable_get(:@proxy_from_env)
|
||||
end
|
||||
|
||||
def test_s_get
|
||||
assert_equal $test_net_http_data,
|
||||
Net::HTTP.get(config('host'), '/', config('port'))
|
||||
|
|
Загрузка…
Ссылка в новой задаче