summaryrefslogtreecommitdiff
path: root/test/net/http/test_http.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 15:29:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 15:29:36 +0000
commit3acc0ba1d8a58c515050258f97dcc223b6ec8ae0 (patch)
tree0da12a025fd8b2274a8d47fa388c78c28b359080 /test/net/http/test_http.rb
parentf56288d7a8b0972a0ceacd359dd0b7438f7540d0 (diff)
Host header should add branckets to IPv6 address [Bug #12642]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http/test_http.rb')
-rw-r--r--test/net/http/test_http.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index c5a77d3695..d3c2aecb9f 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -59,6 +59,33 @@ class TestNetHTTP < Test::Unit::TestCase
end
end
+ def test_addr_port
+ http = Net::HTTP.new 'hostname.example', nil, nil
+ addr_port = http.__send__ :addr_port
+ assert_equal 'hostname.example', addr_port
+
+ http.use_ssl = true
+ addr_port = http.__send__ :addr_port
+ assert_equal 'hostname.example:80', addr_port
+
+ http = Net::HTTP.new '203.0.113.1', nil, nil
+ addr_port = http.__send__ :addr_port
+ assert_equal '203.0.113.1', addr_port
+
+ http.use_ssl = true
+ addr_port = http.__send__ :addr_port
+ assert_equal '203.0.113.1:80', addr_port
+
+ http = Net::HTTP.new '2001:db8::1', nil, nil
+ addr_port = http.__send__ :addr_port
+ assert_equal '[2001:db8::1]', addr_port
+
+ http.use_ssl = true
+ addr_port = http.__send__ :addr_port
+ assert_equal '[2001:db8::1]:80', addr_port
+
+ end
+
def test_edit_path
http = Net::HTTP.new 'hostname.example', nil, nil