ruby-changes:37826
From: nagachika <ko1@a...>
Date: Mon, 9 Mar 2015 22:00:30 +0900 (JST)
Subject: [ruby-changes:37826] nagachika:r49907 (ruby_2_1): merge revision(s) r48666: [Backport #10875]
nagachika 2015-03-09 22:00:13 +0900 (Mon, 09 Mar 2015) New Revision: 49907 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49907 Log: merge revision(s) r48666: [Backport #10875] * 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@r...> https://github.com/ruby/ruby/pull/765 fix GH-765 * test/uri/test_generic.rb: Add more tests Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/lib/uri/generic.rb branches/ruby_2_1/test/uri/test_generic.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 49906) +++ ruby_2_1/ChangeLog (revision 49907) @@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Mar 9 21:52:41 2015 NARUSE, Yui <naruse@r...> + + * 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@r...> + https://github.com/ruby/ruby/pull/765 fix GH-765 + + * test/uri/test_generic.rb: Add more tests + Tue Mar 3 02:42:27 2015 Eric Wong <e@8...> * ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX Index: ruby_2_1/lib/uri/generic.rb =================================================================== --- ruby_2_1/lib/uri/generic.rb (revision 49906) +++ ruby_2_1/lib/uri/generic.rb (revision 49907) @@ -192,7 +192,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/uri/generic.rb#L192 if arg_check self.scheme = scheme self.userinfo = userinfo - self.host = host + self.hostname = host self.port = port self.path = path self.query = query Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 49906) +++ ruby_2_1/version.h (revision 49907) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.5" -#define RUBY_RELEASE_DATE "2015-03-03" -#define RUBY_PATCHLEVEL 306 +#define RUBY_RELEASE_DATE "2015-03-09" +#define RUBY_PATCHLEVEL 307 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 3 +#define RUBY_RELEASE_DAY 9 #include "ruby/version.h" Index: ruby_2_1/test/uri/test_generic.rb =================================================================== --- ruby_2_1/test/uri/test_generic.rb (revision 49906) +++ ruby_2_1/test/uri/test_generic.rb (revision 49907) @@ -741,12 +741,26 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/uri/test_generic.rb#L741 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] Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48666 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/