summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-21 00:49:36 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-21 00:49:36 +0000
commit4e1bea5f5a46ff4c1a067ec280edc5f3da020a3a (patch)
treefd403a7420b175c8f372a6bf26cf044b360ddaca
parent4388d98671c7b798500fc622eb7ee903462989ab (diff)
merge revision(s) 48666: [Backport #10873]
* lib/uri/generic.rb (URI::Generic.build): use hostname= to detect and wrap IPv6 hosts. Build is accepting URI components and users may not expect that a host component needs to be wrapped with square brackets since it's not providing a URI. Note: initialize with arg_check => true does not wrap IPv6 hosts. by Joe Rafaniello <jrafanie@redhat.com> https://github.com/ruby/ruby/pull/765 fix GH-765 * test/uri/test_generic.rb: Add more tests git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog13
-rw-r--r--lib/uri/generic.rb2
-rw-r--r--test/uri/test_generic.rb20
-rw-r--r--version.h6
4 files changed, 34 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 93bf9d7a9c..7ff20ea7ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Sat Feb 21 09:48:48 2015 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic.build):
+ use hostname= to detect and wrap IPv6 hosts.
+ Build is accepting URI components and users may not expect
+ that a host component needs to be wrapped with square brackets
+ since it's not providing a URI.
+ Note: initialize with arg_check => true does not wrap IPv6 hosts.
+ by Joe Rafaniello <jrafanie@redhat.com>
+ https://github.com/ruby/ruby/pull/765 fix GH-765
+
+ * test/uri/test_generic.rb: Add more tests
+
Wed Feb 18 16:02:30 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/resolv.rb (Resolv::DNS::Resource#==, #hash): elements
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index b1195fdf0b..474a820d1b 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -192,7 +192,7 @@ module URI
if arg_check
self.scheme = scheme
self.userinfo = userinfo
- self.host = host
+ self.hostname = host
self.port = port
self.path = path
self.query = query
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index e8becd5b8e..edddefb756 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -725,12 +725,26 @@ class URI::TestGeneric < Test::Unit::TestCase
end
def test_build
- URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil])
+ u = URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil])
+ assert_equal('http://example.com:80/foo', u.to_s)
+
+ u = URI::Generic.build(:scheme => "http", :host => "::1", :path => "/bar/baz")
+ assert_equal("http://[::1]/bar/baz", u.to_s)
+ assert_equal("[::1]", u.host)
+ assert_equal("::1", u.hostname)
+
+ u = URI::Generic.build(:scheme => "http", :host => "[::1]", :path => "/bar/baz")
+ assert_equal("http://[::1]/bar/baz", u.to_s)
+ assert_equal("[::1]", u.host)
+ assert_equal("::1", u.hostname)
end
def test_build2
- URI::Generic.build2(path: "/foo bar/baz")
- URI::Generic.build2(['http', nil, 'example.com', 80, nil, '/foo bar' , nil, nil, nil])
+ u = URI::Generic.build2(path: "/foo bar/baz")
+ assert_equal('/foo%20bar/baz', u.to_s)
+
+ u = URI::Generic.build2(['http', nil, 'example.com', 80, nil, '/foo bar' , nil, nil, nil])
+ assert_equal('http://example.com:80/foo%20bar', u.to_s)
end
# 192.0.2.0/24 is TEST-NET. [RFC3330]
diff --git a/version.h b/version.h
index 492cc6ade0..f9ea8f0fd5 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2015-02-18"
-#define RUBY_PATCHLEVEL 634
+#define RUBY_RELEASE_DATE "2015-02-21"
+#define RUBY_PATCHLEVEL 635
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 18
+#define RUBY_RELEASE_DAY 21
#include "ruby/version.h"