diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-26 15:29:36 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-26 15:29:36 +0000 |
commit | 1270660bf1b1262c4fcb852106a91c720277988a (patch) | |
tree | 0da12a025fd8b2274a8d47fa388c78c28b359080 /lib | |
parent | 43bb0238ee52c34aab58b1c2b7afb75751209148 (diff) | |
download | ruby-1270660bf1b1262c4fcb852106a91c720277988a.tar.gz |
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 'lib')
-rw-r--r-- | lib/net/http.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 0fec32bb84..90f299f705 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1612,11 +1612,10 @@ module Net #:nodoc: private def addr_port - if use_ssl? - address() + (port == HTTP.https_default_port ? '' : ":#{port()}") - else - address() + (port == HTTP.http_default_port ? '' : ":#{port()}") - end + addr = address + addr = "[#{addr}]" if addr.include?(":") + default_port = use_ssl? ? HTTP.https_default_port : HTTP.http_default_port + default_port == port ? addr : "#{addr}:#{port}" end def D(msg) |